diff --git a/sklearn/ensemble/_gradient_boosting.c b/sklearn/ensemble/_gradient_boosting.c index 3db06fc1c4772..bcbae890c6ad1 100644 --- a/sklearn/ensemble/_gradient_boosting.c +++ b/sklearn/ensemble/_gradient_boosting.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.2 on Sat Jan 25 22:10:02 2014 */ +/* Generated by Cython 0.20 on Sat Jan 25 15:12:51 2014 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -19,6 +19,7 @@ #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else +#define CYTHON_ABI "0_20" #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -53,6 +54,9 @@ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif +#if CYTHON_COMPILING_IN_PYPY +#define Py_OptimizeFlag 0 +#endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -60,7 +64,7 @@ #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_As_int(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ @@ -113,12 +117,14 @@ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type #endif -#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 +#if PY_VERSION_HEX < 0x02060000 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 @@ -131,19 +137,38 @@ #if PY_VERSION_HEX < 0x02060000 #define Py_TPFLAGS_HAVE_VERSION_TAG 0 #endif +#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT) + #define Py_TPFLAGS_IS_ABSTRACT 0 +#endif +#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE) + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#define __Pyx_PyUnicode_Concat(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \ + PyNumber_Add(a, b) : PyUnicode_Concat(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type @@ -176,7 +201,7 @@ #else #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) @@ -201,6 +226,7 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -344,8 +370,20 @@ typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \ + (sizeof(type) < sizeof(Py_ssize_t)) || \ + (sizeof(type) > sizeof(Py_ssize_t) && \ + likely(v < (type)PY_SSIZE_T_MAX || \ + v == (type)PY_SSIZE_T_MAX) && \ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \ + v == (type)PY_SSIZE_T_MIN))) || \ + (sizeof(type) == sizeof(Py_ssize_t) && \ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \ + v == (type)PY_SSIZE_T_MAX))) ) static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); @@ -356,9 +394,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif +#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((char*)s) #define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) #define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) #if PY_MAJOR_VERSION < 3 @@ -380,7 +420,6 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -389,7 +428,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params() { +static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys = NULL; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; @@ -414,7 +453,7 @@ static int __Pyx_init_sys_getdefaultencoding_params() { if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } @@ -438,7 +477,7 @@ static int __Pyx_init_sys_getdefaultencoding_params() { #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params() { +static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys = NULL; PyObject* default_encoding = NULL; char* default_encoding_c; @@ -509,7 +548,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "_gradient_boosting.pyx", - "numpy.pxd", + "__init__.pxd", "stringsource", "type.pxd", "_tree.pxd", @@ -606,7 +645,7 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; #endif -/* "numpy.pxd":723 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -615,7 +654,7 @@ typedef volatile __pyx_atomic_int_type __pyx_atomic_int; */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":724 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -624,7 +663,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":725 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -633,7 +672,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":726 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -642,7 +681,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":730 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -651,7 +690,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":731 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -660,7 +699,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":732 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -669,7 +708,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":733 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -678,7 +717,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":737 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -687,7 +726,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":738 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -696,7 +735,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":747 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -705,7 +744,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":748 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -714,7 +753,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":749 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -723,7 +762,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":751 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -732,7 +771,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":752 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -741,7 +780,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":753 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -750,7 +789,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":755 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -759,7 +798,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":756 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -768,7 +807,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":758 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -777,7 +816,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":759 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -786,7 +825,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":760 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -917,7 +956,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_BestFirstTreeBuilder; struct __pyx_obj_7sklearn_4tree_5_tree_DepthFirstTreeBuilder; struct __pyx_MemviewEnum_obj; -/* "numpy.pxd":762 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -926,7 +965,7 @@ struct __pyx_MemviewEnum_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":763 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -935,7 +974,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":764 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -944,7 +983,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":766 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -959,7 +998,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_11TreeBuilder_build; struct __pyx_opt_args_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build; struct __pyx_opt_args_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build; -/* "sklearn/tree/_tree.pxd":113 +/* "sklearn/tree/_tree.pxd":114 * # ============================================================================= * * cdef struct Node: # <<<<<<<<<<<<<< @@ -975,7 +1014,7 @@ struct __pyx_t_7sklearn_4tree_5_tree_Node { __pyx_t_7sklearn_4tree_5_tree_SIZE_t n_samples; }; -/* "sklearn/tree/_tree.pxd":158 +/* "sklearn/tree/_tree.pxd":159 * SIZE_t n_node_samples) nogil * cdef void _resize(self, SIZE_t capacity) * cdef int _resize_c(self, SIZE_t capacity=*) nogil # <<<<<<<<<<<<<< @@ -987,7 +1026,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree__resize_c { __pyx_t_7sklearn_4tree_5_tree_SIZE_t capacity; }; -/* "sklearn/tree/_tree.pxd":165 +/* "sklearn/tree/_tree.pxd":166 * cpdef np.ndarray predict(self, np.ndarray[DTYPE_t, ndim=2] X) * cpdef np.ndarray apply(self, np.ndarray[DTYPE_t, ndim=2] X) * cpdef compute_feature_importances(self, normalize=*) # <<<<<<<<<<<<<< @@ -999,7 +1038,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_compute_feature_importances { PyObject *normalize; }; -/* "sklearn/tree/_tree.pxd":173 +/* "sklearn/tree/_tree.pxd":174 * * cdef class TreeBuilder: * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -1011,7 +1050,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_11TreeBuilder_build { PyArrayObject *sample_weight; }; -/* "sklearn/tree/_tree.pxd":178 +/* "sklearn/tree/_tree.pxd":179 * * cdef class DepthFirstTreeBuilder(TreeBuilder): * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -1023,7 +1062,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build { PyArrayObject *sample_weight; }; -/* "sklearn/tree/_tree.pxd":183 +/* "sklearn/tree/_tree.pxd":184 * * cdef class BestFirstTreeBuilder(TreeBuilder): * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -1034,7 +1073,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build { PyArrayObject *sample_weight; }; -/* "sklearn/tree/_tree.pxd":126 +/* "sklearn/tree/_tree.pxd":127 * * * cdef class Tree: # <<<<<<<<<<<<<< @@ -1062,7 +1101,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Tree { }; -/* "sklearn/tree/_tree.pxd":172 +/* "sklearn/tree/_tree.pxd":173 * # ============================================================================= * * cdef class TreeBuilder: # <<<<<<<<<<<<<< @@ -1117,6 +1156,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Splitter { __pyx_t_7sklearn_4tree_5_tree_SIZE_t n_samples; __pyx_t_7sklearn_4tree_5_tree_SIZE_t *features; __pyx_t_7sklearn_4tree_5_tree_SIZE_t n_features; + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *feature_values; __pyx_t_7sklearn_4tree_5_tree_SIZE_t start; __pyx_t_7sklearn_4tree_5_tree_SIZE_t end; __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *X; @@ -1153,7 +1193,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Criterion { }; -/* "View.MemoryView":927 +/* "View.MemoryView":930 * * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< @@ -1193,7 +1233,7 @@ struct __pyx_array_obj { }; -/* "sklearn/tree/_tree.pxd":182 +/* "sklearn/tree/_tree.pxd":183 * * * cdef class BestFirstTreeBuilder(TreeBuilder): # <<<<<<<<<<<<<< @@ -1205,7 +1245,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_BestFirstTreeBuilder { }; -/* "sklearn/tree/_tree.pxd":177 +/* "sklearn/tree/_tree.pxd":178 * * * cdef class DepthFirstTreeBuilder(TreeBuilder): # <<<<<<<<<<<<<< @@ -1231,7 +1271,7 @@ struct __pyx_MemviewEnum_obj { -/* "sklearn/tree/_tree.pxd":172 +/* "sklearn/tree/_tree.pxd":173 * # ============================================================================= * * cdef class TreeBuilder: # <<<<<<<<<<<<<< @@ -1245,7 +1285,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_TreeBuilder { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_TreeBuilder *__pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder; -/* "sklearn/tree/_tree.pxd":177 +/* "sklearn/tree/_tree.pxd":178 * * * cdef class DepthFirstTreeBuilder(TreeBuilder): # <<<<<<<<<<<<<< @@ -1259,7 +1299,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_DepthFirstTreeBuilder { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_DepthFirstTreeBuilder *__pyx_vtabptr_7sklearn_4tree_5_tree_DepthFirstTreeBuilder; -/* "sklearn/tree/_tree.pxd":126 +/* "sklearn/tree/_tree.pxd":127 * * * cdef class Tree: # <<<<<<<<<<<<<< @@ -1300,7 +1340,7 @@ struct __pyx_vtabstruct_memoryview { static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":927 +/* "View.MemoryView":930 * * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< @@ -1352,7 +1392,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *__pyx_vtabptr_7sklearn_4tree_5_tree_Splitter; -/* "sklearn/tree/_tree.pxd":182 +/* "sklearn/tree/_tree.pxd":183 * * * cdef class BestFirstTreeBuilder(TreeBuilder): # <<<<<<<<<<<<<< @@ -1452,7 +1492,7 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, @@ -1508,14 +1548,22 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ - -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/ +#include + +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif + #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif @@ -1523,32 +1571,32 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject * #define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ - static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); -#include +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) -#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); @@ -1581,6 +1629,18 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/ +static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject* none = _PyList_Extend((PyListObject*)L, v); + if (unlikely(!none)) + return -1; + Py_DECREF(none); + return 0; +#else + return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); +#endif +} + #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; @@ -1599,7 +1659,8 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/ static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename); /*proto*/ + int lineno, const char *filename, + int full_traceback); /*proto*/ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ @@ -1634,6 +1695,8 @@ static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b); static int __Pyx_ValidateAndInit_memviewslice( @@ -1652,11 +1715,13 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_nn_ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_double(PyObject *); -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value); + +static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *); -static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value); -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -1670,7 +1735,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif -#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX +#if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else @@ -1756,7 +1821,7 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #endif #endif -static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject *); +static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *); static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice *mvs, char order, int ndim); @@ -1773,40 +1838,11 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); static int __Pyx_check_binary_version(void); @@ -1989,296 +2025,293 @@ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static char __pyx_k_1[] = "left_sample_frac:%f, n_samples current: %d, n_samples left: %d"; -static char __pyx_k_2[] = "Total weight should be 1.0 but was %.9f"; -static char __pyx_k_3[] = "ndarray is not C contiguous"; -static char __pyx_k_5[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_7[] = "Non-native byte order not supported"; -static char __pyx_k_9[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_10[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_13[] = "Format string allocated too short."; -static char __pyx_k_15[] = "Empty shape tuple for cython.array"; -static char __pyx_k_17[] = "itemsize <= 0 for cython.array"; -static char __pyx_k_20[] = "unable to allocate shape or strides."; -static char __pyx_k_22[] = "Invalid shape in axis %d: %d."; -static char __pyx_k_23[] = "Invalid mode, expected 'c' or 'fortran', got %s"; -static char __pyx_k_25[] = "unable to allocate array data."; -static char __pyx_k_27[] = "Can only create a buffer that is contiguous in memory."; -static char __pyx_k_29[] = "Unable to convert item to object"; -static char __pyx_k_31[] = "Buffer view does not expose strides"; -static char __pyx_k_33[] = ""; -static char __pyx_k_34[] = ""; -static char __pyx_k_37[] = "Cannot index with type '%s'"; -static char __pyx_k_39[] = "Indirect dimensions not supported"; -static char __pyx_k_41[] = "Index out of bounds (axis %d)"; -static char __pyx_k_42[] = "Step may not be zero (axis %d)"; -static char __pyx_k_43[] = "All dimensions preceding dimension %d must be indexed and not sliced"; -static char __pyx_k_44[] = "Out of bounds on buffer access (axis %d)"; -static char __pyx_k_45[] = "Cannot transpose memoryview with indirect dimensions"; -static char __pyx_k_46[] = "got differing extents in dimension %d (got %d and %d)"; -static char __pyx_k_47[] = "Dimension %d is not direct"; -static char __pyx_k_50[] = "/Users/joel/repos/scikit-learn/sklearn/ensemble/_gradient_boosting.pyx"; -static char __pyx_k_51[] = "sklearn.ensemble._gradient_boosting"; -static char __pyx_k_56[] = "getbuffer(obj, view, flags)"; -static char __pyx_k_57[] = ""; -static char __pyx_k_59[] = ""; -static char __pyx_k_61[] = ""; -static char __pyx_k_63[] = ""; -static char __pyx_k_65[] = ""; -static char __pyx_k__B[] = "B"; -static char __pyx_k__H[] = "H"; -static char __pyx_k__I[] = "I"; -static char __pyx_k__K[] = "K"; -static char __pyx_k__L[] = "L"; -static char __pyx_k__O[] = "O"; -static char __pyx_k__Q[] = "Q"; -static char __pyx_k__X[] = "X"; -static char __pyx_k__b[] = "b"; -static char __pyx_k__c[] = "c"; -static char __pyx_k__d[] = "d"; -static char __pyx_k__f[] = "f"; -static char __pyx_k__g[] = "g"; -static char __pyx_k__h[] = "h"; -static char __pyx_k__i[] = "i"; -static char __pyx_k__k[] = "k"; -static char __pyx_k__l[] = "l"; -static char __pyx_k__q[] = "q"; -static char __pyx_k__Zd[] = "Zd"; -static char __pyx_k__Zf[] = "Zf"; -static char __pyx_k__Zg[] = "Zg"; -static char __pyx_k__id[] = "id"; -static char __pyx_k__np[] = "np"; -static char __pyx_k__obj[] = "obj"; -static char __pyx_k__out[] = "out"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__bool[] = "bool"; -static char __pyx_k__int8[] = "int8"; -static char __pyx_k__intp[] = "intp"; -static char __pyx_k__mode[] = "mode"; -static char __pyx_k__name[] = "name"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__ones[] = "ones"; -static char __pyx_k__pack[] = "pack"; -static char __pyx_k__rand[] = "rand"; -static char __pyx_k__size[] = "size"; -static char __pyx_k__step[] = "step"; -static char __pyx_k__stop[] = "stop"; -static char __pyx_k__tree[] = "tree"; -static char __pyx_k__ASCII[] = "ASCII"; -static char __pyx_k__DTYPE[] = "DTYPE"; -static char __pyx_k__dtype[] = "dtype"; -static char __pyx_k__error[] = "error"; -static char __pyx_k__flags[] = "flags"; -static char __pyx_k__numpy[] = "numpy"; -static char __pyx_k__range[] = "range"; -static char __pyx_k__scale[] = "scale"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__stage[] = "stage"; -static char __pyx_k__start[] = "start"; -static char __pyx_k__tree_[] = "tree_"; -static char __pyx_k__zeros[] = "zeros"; -static char __pyx_k__astype[] = "astype"; -static char __pyx_k__decode[] = "decode"; -static char __pyx_k__encode[] = "encode"; -static char __pyx_k__extend[] = "extend"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__struct[] = "struct"; -static char __pyx_k__unpack[] = "unpack"; -static char __pyx_k__xrange[] = "xrange"; -static char __pyx_k__float32[] = "float32"; -static char __pyx_k__float64[] = "float64"; -static char __pyx_k__fortran[] = "fortran"; -static char __pyx_k__memview[] = "memview"; -static char __pyx_k__np_bool[] = "np_bool"; -static char __pyx_k__np_int8[] = "np_int8"; -static char __pyx_k__np_intp[] = "np_intp"; -static char __pyx_k__np_ones[] = "np_ones"; -static char __pyx_k__Ellipsis[] = "Ellipsis"; -static char __pyx_k____main__[] = "__main__"; -static char __pyx_k____name__[] = "__name__"; -static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__n_bagged[] = "n_bagged"; -static char __pyx_k__np_zeros[] = "np_zeros"; -static char __pyx_k__TypeError[] = "TypeError"; -static char __pyx_k____class__[] = "__class__"; -static char __pyx_k__enumerate[] = "enumerate"; -static char __pyx_k__IndexError[] = "IndexError"; -static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k____import__[] = "__import__"; -static char __pyx_k__estimators[] = "estimators"; -static char __pyx_k__learn_rate[] = "learn_rate"; -static char __pyx_k__np_float32[] = "np_float32"; -static char __pyx_k__np_float64[] = "np_float64"; -static char __pyx_k__MemoryError[] = "MemoryError"; -static char __pyx_k__sample_mask[] = "sample_mask"; -static char __pyx_k__RuntimeError[] = "RuntimeError"; -static char __pyx_k__n_estimators[] = "n_estimators"; -static char __pyx_k__random_state[] = "random_state"; -static char __pyx_k__predict_stage[] = "predict_stage"; -static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; -static char __pyx_k__n_total_in_bag[] = "n_total_in_bag"; -static char __pyx_k__predict_stages[] = "predict_stages"; -static char __pyx_k__target_feature[] = "target_feature"; -static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; -static char __pyx_k__allocate_buffer[] = "allocate_buffer"; -static char __pyx_k__dtype_is_object[] = "dtype_is_object"; -static char __pyx_k__n_total_samples[] = "n_total_samples"; -static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer"; -static char __pyx_k___random_sample_mask[] = "_random_sample_mask"; -static PyObject *__pyx_kp_s_1; -static PyObject *__pyx_kp_u_10; -static PyObject *__pyx_kp_u_13; -static PyObject *__pyx_kp_s_15; -static PyObject *__pyx_kp_s_17; -static PyObject *__pyx_kp_s_2; -static PyObject *__pyx_kp_s_20; -static PyObject *__pyx_kp_s_22; -static PyObject *__pyx_kp_s_23; -static PyObject *__pyx_kp_s_25; -static PyObject *__pyx_kp_s_27; -static PyObject *__pyx_kp_s_29; -static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_s_31; -static PyObject *__pyx_kp_s_33; -static PyObject *__pyx_kp_s_34; -static PyObject *__pyx_kp_s_37; -static PyObject *__pyx_kp_s_39; -static PyObject *__pyx_kp_s_44; -static PyObject *__pyx_kp_s_46; -static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_s_50; -static PyObject *__pyx_n_s_51; -static PyObject *__pyx_kp_s_57; -static PyObject *__pyx_kp_s_59; -static PyObject *__pyx_kp_s_61; -static PyObject *__pyx_kp_s_63; -static PyObject *__pyx_kp_s_65; -static PyObject *__pyx_kp_u_7; -static PyObject *__pyx_kp_u_9; -static PyObject *__pyx_n_s__ASCII; -static PyObject *__pyx_n_s__DTYPE; -static PyObject *__pyx_n_s__Ellipsis; -static PyObject *__pyx_n_s__IndexError; -static PyObject *__pyx_n_s__K; -static PyObject *__pyx_n_s__MemoryError; -static PyObject *__pyx_n_b__O; -static PyObject *__pyx_n_s__RuntimeError; -static PyObject *__pyx_n_s__TypeError; -static PyObject *__pyx_n_s__ValueError; -static PyObject *__pyx_n_s__X; -static PyObject *__pyx_n_s____class__; -static PyObject *__pyx_n_s____import__; -static PyObject *__pyx_n_s____main__; -static PyObject *__pyx_n_s____name__; -static PyObject *__pyx_n_s____pyx_getbuffer; -static PyObject *__pyx_n_s____pyx_releasebuffer; -static PyObject *__pyx_n_s____pyx_vtable__; -static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s___random_sample_mask; -static PyObject *__pyx_n_s__allocate_buffer; -static PyObject *__pyx_n_s__astype; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__bool; -static PyObject *__pyx_n_b__c; -static PyObject *__pyx_n_s__c; -static PyObject *__pyx_n_u__c; -static PyObject *__pyx_n_s__decode; -static PyObject *__pyx_n_s__dtype; -static PyObject *__pyx_n_s__dtype_is_object; -static PyObject *__pyx_n_s__encode; -static PyObject *__pyx_n_s__enumerate; -static PyObject *__pyx_n_s__error; -static PyObject *__pyx_n_s__estimators; -static PyObject *__pyx_n_s__extend; -static PyObject *__pyx_n_s__flags; -static PyObject *__pyx_n_s__float32; -static PyObject *__pyx_n_s__float64; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_b__fortran; -static PyObject *__pyx_n_s__fortran; -static PyObject *__pyx_n_s__i; -static PyObject *__pyx_n_s__id; -static PyObject *__pyx_n_s__int8; -static PyObject *__pyx_n_s__intp; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__k; -static PyObject *__pyx_n_s__learn_rate; -static PyObject *__pyx_n_s__memview; -static PyObject *__pyx_n_s__mode; -static PyObject *__pyx_n_s__n_bagged; -static PyObject *__pyx_n_s__n_estimators; -static PyObject *__pyx_n_s__n_total_in_bag; -static PyObject *__pyx_n_s__n_total_samples; -static PyObject *__pyx_n_s__name; -static PyObject *__pyx_n_s__ndim; -static PyObject *__pyx_n_s__np; -static PyObject *__pyx_n_s__np_bool; -static PyObject *__pyx_n_s__np_float32; -static PyObject *__pyx_n_s__np_float64; -static PyObject *__pyx_n_s__np_int8; -static PyObject *__pyx_n_s__np_intp; -static PyObject *__pyx_n_s__np_ones; -static PyObject *__pyx_n_s__np_zeros; -static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; -static PyObject *__pyx_n_s__ones; -static PyObject *__pyx_n_s__out; -static PyObject *__pyx_n_s__pack; -static PyObject *__pyx_n_s__predict_stage; -static PyObject *__pyx_n_s__predict_stages; -static PyObject *__pyx_n_s__rand; -static PyObject *__pyx_n_s__random_state; -static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__sample_mask; -static PyObject *__pyx_n_s__scale; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__stage; -static PyObject *__pyx_n_s__start; -static PyObject *__pyx_n_s__step; -static PyObject *__pyx_n_s__stop; -static PyObject *__pyx_n_s__struct; -static PyObject *__pyx_n_s__target_feature; -static PyObject *__pyx_n_s__tree; -static PyObject *__pyx_n_s__tree_; -static PyObject *__pyx_n_s__unpack; -static PyObject *__pyx_n_s__xrange; -static PyObject *__pyx_n_s__zeros; +static char __pyx_k_B[] = "B"; +static char __pyx_k_H[] = "H"; +static char __pyx_k_I[] = "I"; +static char __pyx_k_K[] = "K"; +static char __pyx_k_L[] = "L"; +static char __pyx_k_O[] = "O"; +static char __pyx_k_Q[] = "Q"; +static char __pyx_k_X[] = "X"; +static char __pyx_k_b[] = "b"; +static char __pyx_k_c[] = "c"; +static char __pyx_k_d[] = "d"; +static char __pyx_k_f[] = "f"; +static char __pyx_k_g[] = "g"; +static char __pyx_k_h[] = "h"; +static char __pyx_k_i[] = "i"; +static char __pyx_k_k[] = "k"; +static char __pyx_k_l[] = "l"; +static char __pyx_k_q[] = "q"; +static char __pyx_k_Zd[] = "Zd"; +static char __pyx_k_Zf[] = "Zf"; +static char __pyx_k_Zg[] = "Zg"; +static char __pyx_k_id[] = "id"; +static char __pyx_k_np[] = "np"; +static char __pyx_k_obj[] = "obj"; +static char __pyx_k_out[] = "out"; +static char __pyx_k_base[] = "base"; +static char __pyx_k_bool[] = "bool"; +static char __pyx_k_int8[] = "int8"; +static char __pyx_k_intp[] = "intp"; +static char __pyx_k_main[] = "__main__"; +static char __pyx_k_mode[] = "mode"; +static char __pyx_k_name[] = "name"; +static char __pyx_k_ndim[] = "ndim"; +static char __pyx_k_ones[] = "ones"; +static char __pyx_k_pack[] = "pack"; +static char __pyx_k_rand[] = "rand"; +static char __pyx_k_size[] = "size"; +static char __pyx_k_step[] = "step"; +static char __pyx_k_stop[] = "stop"; +static char __pyx_k_test[] = "__test__"; +static char __pyx_k_tree[] = "tree_"; +static char __pyx_k_ASCII[] = "ASCII"; +static char __pyx_k_DTYPE[] = "DTYPE"; +static char __pyx_k_class[] = "__class__"; +static char __pyx_k_dtype[] = "dtype"; +static char __pyx_k_error[] = "error"; +static char __pyx_k_flags[] = "flags"; +static char __pyx_k_numpy[] = "numpy"; +static char __pyx_k_range[] = "range"; +static char __pyx_k_scale[] = "scale"; +static char __pyx_k_shape[] = "shape"; +static char __pyx_k_stage[] = "stage"; +static char __pyx_k_start[] = "start"; +static char __pyx_k_zeros[] = "zeros"; +static char __pyx_k_astype[] = "astype"; +static char __pyx_k_decode[] = "decode"; +static char __pyx_k_encode[] = "encode"; +static char __pyx_k_format[] = "format"; +static char __pyx_k_import[] = "__import__"; +static char __pyx_k_name_2[] = "__name__"; +static char __pyx_k_struct[] = "struct"; +static char __pyx_k_tree_2[] = "tree"; +static char __pyx_k_unpack[] = "unpack"; +static char __pyx_k_xrange[] = "xrange"; +static char __pyx_k_float32[] = "float32"; +static char __pyx_k_float64[] = "float64"; +static char __pyx_k_fortran[] = "fortran"; +static char __pyx_k_memview[] = "memview"; +static char __pyx_k_np_bool[] = "np_bool"; +static char __pyx_k_np_int8[] = "np_int8"; +static char __pyx_k_np_intp[] = "np_intp"; +static char __pyx_k_np_ones[] = "np_ones"; +static char __pyx_k_Ellipsis[] = "Ellipsis"; +static char __pyx_k_itemsize[] = "itemsize"; +static char __pyx_k_n_bagged[] = "n_bagged"; +static char __pyx_k_np_zeros[] = "np_zeros"; +static char __pyx_k_TypeError[] = "TypeError"; +static char __pyx_k_enumerate[] = "enumerate"; +static char __pyx_k_IndexError[] = "IndexError"; +static char __pyx_k_ValueError[] = "ValueError"; +static char __pyx_k_estimators[] = "estimators"; +static char __pyx_k_learn_rate[] = "learn_rate"; +static char __pyx_k_np_float32[] = "np_float32"; +static char __pyx_k_np_float64[] = "np_float64"; +static char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; +static char __pyx_k_MemoryError[] = "MemoryError"; +static char __pyx_k_sample_mask[] = "sample_mask"; +static char __pyx_k_RuntimeError[] = "RuntimeError"; +static char __pyx_k_n_estimators[] = "n_estimators"; +static char __pyx_k_random_state[] = "random_state"; +static char __pyx_k_predict_stage[] = "predict_stage"; +static char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static char __pyx_k_n_total_in_bag[] = "n_total_in_bag"; +static char __pyx_k_predict_stages[] = "predict_stages"; +static char __pyx_k_target_feature[] = "target_feature"; +static char __pyx_k_allocate_buffer[] = "allocate_buffer"; +static char __pyx_k_dtype_is_object[] = "dtype_is_object"; +static char __pyx_k_n_total_samples[] = "n_total_samples"; +static char __pyx_k_pyx_releasebuffer[] = "__pyx_releasebuffer"; +static char __pyx_k_random_sample_mask[] = "_random_sample_mask"; +static char __pyx_k_strided_and_direct[] = ""; +static char __pyx_k_strided_and_indirect[] = ""; +static char __pyx_k_contiguous_and_direct[] = ""; +static char __pyx_k_MemoryView_of_r_object[] = ""; +static char __pyx_k_MemoryView_of_r_at_0x_x[] = ""; +static char __pyx_k_contiguous_and_indirect[] = ""; +static char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; +static char __pyx_k_getbuffer_obj_view_flags[] = "getbuffer(obj, view, flags)"; +static char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct"; +static char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; +static char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)"; +static char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)"; +static char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; +static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; +static char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data."; +static char __pyx_k_strided_and_direct_or_indirect[] = ""; +static char __pyx_k_home_larsb_src_scikit_learn_skl[] = "/home/larsb/src/scikit-learn/sklearn/ensemble/_gradient_boosting.pyx"; +static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced"; +static char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides"; +static char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory."; +static char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions"; +static char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; +static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; +static char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; +static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; +static char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; +static char __pyx_k_Total_weight_should_be_1_0_but_w[] = "Total weight should be 1.0 but was %.9f"; +static char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object"; +static char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)"; +static char __pyx_k_left_sample_frac_f_n_samples_cur[] = "left_sample_frac:%f, n_samples current: %d, n_samples left: %d"; +static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_sklearn_ensemble__gradient_boost[] = "sklearn.ensemble._gradient_boosting"; +static char __pyx_k_unable_to_allocate_shape_or_stri[] = "unable to allocate shape or strides."; +static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; +static PyObject *__pyx_n_s_ASCII; +static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri; +static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is; +static PyObject *__pyx_kp_s_Cannot_index_with_type_s; +static PyObject *__pyx_n_s_DTYPE; +static PyObject *__pyx_n_s_Ellipsis; +static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; +static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; +static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; +static PyObject *__pyx_n_s_IndexError; +static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; +static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; +static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d; +static PyObject *__pyx_n_s_K; +static PyObject *__pyx_n_s_MemoryError; +static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x; +static PyObject *__pyx_kp_s_MemoryView_of_r_object; +static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; +static PyObject *__pyx_n_b_O; +static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a; +static PyObject *__pyx_n_s_RuntimeError; +static PyObject *__pyx_kp_s_Total_weight_should_be_1_0_but_w; +static PyObject *__pyx_n_s_TypeError; +static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object; +static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_n_s_X; +static PyObject *__pyx_n_s_allocate_buffer; +static PyObject *__pyx_n_s_astype; +static PyObject *__pyx_n_s_base; +static PyObject *__pyx_n_s_bool; +static PyObject *__pyx_n_b_c; +static PyObject *__pyx_n_s_c; +static PyObject *__pyx_n_u_c; +static PyObject *__pyx_n_s_class; +static PyObject *__pyx_kp_s_contiguous_and_direct; +static PyObject *__pyx_kp_s_contiguous_and_indirect; +static PyObject *__pyx_n_s_decode; +static PyObject *__pyx_n_s_dtype; +static PyObject *__pyx_n_s_dtype_is_object; +static PyObject *__pyx_n_s_encode; +static PyObject *__pyx_n_s_enumerate; +static PyObject *__pyx_n_s_error; +static PyObject *__pyx_n_s_estimators; +static PyObject *__pyx_n_s_flags; +static PyObject *__pyx_n_s_float32; +static PyObject *__pyx_n_s_float64; +static PyObject *__pyx_n_s_format; +static PyObject *__pyx_n_b_fortran; +static PyObject *__pyx_n_s_fortran; +static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi; +static PyObject *__pyx_kp_s_home_larsb_src_scikit_learn_skl; +static PyObject *__pyx_n_s_i; +static PyObject *__pyx_n_s_id; +static PyObject *__pyx_n_s_import; +static PyObject *__pyx_n_s_int8; +static PyObject *__pyx_n_s_intp; +static PyObject *__pyx_n_s_itemsize; +static PyObject *__pyx_kp_s_itemsize_0_for_cython_array; +static PyObject *__pyx_n_s_k; +static PyObject *__pyx_n_s_learn_rate; +static PyObject *__pyx_kp_s_left_sample_frac_f_n_samples_cur; +static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_memview; +static PyObject *__pyx_n_s_mode; +static PyObject *__pyx_n_s_n_bagged; +static PyObject *__pyx_n_s_n_estimators; +static PyObject *__pyx_n_s_n_total_in_bag; +static PyObject *__pyx_n_s_n_total_samples; +static PyObject *__pyx_n_s_name; +static PyObject *__pyx_n_s_name_2; +static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; +static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; +static PyObject *__pyx_n_s_ndim; +static PyObject *__pyx_n_s_np; +static PyObject *__pyx_n_s_np_bool; +static PyObject *__pyx_n_s_np_float32; +static PyObject *__pyx_n_s_np_float64; +static PyObject *__pyx_n_s_np_int8; +static PyObject *__pyx_n_s_np_intp; +static PyObject *__pyx_n_s_np_ones; +static PyObject *__pyx_n_s_np_zeros; +static PyObject *__pyx_n_s_numpy; +static PyObject *__pyx_n_s_obj; +static PyObject *__pyx_n_s_ones; +static PyObject *__pyx_n_s_out; +static PyObject *__pyx_n_s_pack; +static PyObject *__pyx_n_s_predict_stage; +static PyObject *__pyx_n_s_predict_stages; +static PyObject *__pyx_n_s_pyx_getbuffer; +static PyObject *__pyx_n_s_pyx_releasebuffer; +static PyObject *__pyx_n_s_pyx_vtable; +static PyObject *__pyx_n_s_rand; +static PyObject *__pyx_n_s_random_sample_mask; +static PyObject *__pyx_n_s_random_state; +static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_sample_mask; +static PyObject *__pyx_n_s_scale; +static PyObject *__pyx_n_s_shape; +static PyObject *__pyx_n_s_size; +static PyObject *__pyx_n_s_sklearn_ensemble__gradient_boost; +static PyObject *__pyx_n_s_stage; +static PyObject *__pyx_n_s_start; +static PyObject *__pyx_n_s_step; +static PyObject *__pyx_n_s_stop; +static PyObject *__pyx_kp_s_strided_and_direct; +static PyObject *__pyx_kp_s_strided_and_direct_or_indirect; +static PyObject *__pyx_kp_s_strided_and_indirect; +static PyObject *__pyx_n_s_struct; +static PyObject *__pyx_n_s_target_feature; +static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_tree; +static PyObject *__pyx_n_s_tree_2; +static PyObject *__pyx_kp_s_unable_to_allocate_array_data; +static PyObject *__pyx_kp_s_unable_to_allocate_shape_or_stri; +static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; +static PyObject *__pyx_n_s_unpack; +static PyObject *__pyx_n_s_xrange; +static PyObject *__pyx_n_s_zeros; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_int_15; -static PyObject *__pyx_k_tuple_4; -static PyObject *__pyx_k_tuple_6; -static PyObject *__pyx_k_tuple_8; -static PyObject *__pyx_k_tuple_11; -static PyObject *__pyx_k_tuple_12; -static PyObject *__pyx_k_tuple_14; -static PyObject *__pyx_k_tuple_16; -static PyObject *__pyx_k_tuple_18; -static PyObject *__pyx_k_tuple_19; -static PyObject *__pyx_k_tuple_21; -static PyObject *__pyx_k_tuple_24; -static PyObject *__pyx_k_tuple_26; -static PyObject *__pyx_k_tuple_28; -static PyObject *__pyx_k_tuple_30; -static PyObject *__pyx_k_tuple_32; -static PyObject *__pyx_k_tuple_35; -static PyObject *__pyx_k_tuple_36; -static PyObject *__pyx_k_tuple_38; -static PyObject *__pyx_k_tuple_40; -static PyObject *__pyx_k_tuple_48; -static PyObject *__pyx_k_tuple_52; -static PyObject *__pyx_k_tuple_54; -static PyObject *__pyx_k_tuple_58; -static PyObject *__pyx_k_tuple_60; -static PyObject *__pyx_k_tuple_62; -static PyObject *__pyx_k_tuple_64; -static PyObject *__pyx_k_tuple_66; -static PyObject *__pyx_k_codeobj_49; -static PyObject *__pyx_k_codeobj_53; -static PyObject *__pyx_k_codeobj_55; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_tuple__2; +static PyObject *__pyx_tuple__3; +static PyObject *__pyx_tuple__4; +static PyObject *__pyx_tuple__5; +static PyObject *__pyx_tuple__6; +static PyObject *__pyx_tuple__7; +static PyObject *__pyx_tuple__8; +static PyObject *__pyx_tuple__9; +static PyObject *__pyx_tuple__10; +static PyObject *__pyx_tuple__11; +static PyObject *__pyx_tuple__12; +static PyObject *__pyx_tuple__13; +static PyObject *__pyx_tuple__14; +static PyObject *__pyx_tuple__15; +static PyObject *__pyx_tuple__16; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__19; +static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__22; +static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__26; +static PyObject *__pyx_tuple__27; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__29; +static PyObject *__pyx_tuple__30; +static PyObject *__pyx_codeobj__21; +static PyObject *__pyx_codeobj__23; +static PyObject *__pyx_codeobj__25; /* "sklearn/ensemble/_gradient_boosting.pyx":41 * cdef int LEAF = -1 @@ -2382,9 +2415,26 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ (__pyx_v_out[__pyx_t_6]) = ((__pyx_v_out[__pyx_t_6]) + (__pyx_v_scale * (__pyx_v_value[(__pyx_v_node - __pyx_v_root_node)]))); } + /* "sklearn/ensemble/_gradient_boosting.pyx":41 + * cdef int LEAF = -1 + * + * cdef void _predict_regression_tree_inplace_fast(DTYPE_t *X, # <<<<<<<<<<<<<< + * Node* root_node, + * double *value, + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } +/* "sklearn/ensemble/_gradient_boosting.pyx":103 + * + * @cython.nonecheck(False) + * def predict_stages(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< + * np.ndarray[DTYPE_t, ndim=2, mode='c'] X, double scale, + * np.ndarray[float64, ndim=2] out): + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_1predict_stages(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7sklearn_8ensemble_18_gradient_boosting_predict_stages[] = "Add predictions of ``estimators`` to ``out``.\n\n Each estimator is scaled by ``scale`` before its prediction\n is added to ``out``.\n "; @@ -2401,7 +2451,7 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_1predict_stage __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("predict_stages (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__estimators,&__pyx_n_s__X,&__pyx_n_s__scale,&__pyx_n_s__out,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_estimators,&__pyx_n_s_X,&__pyx_n_s_scale,&__pyx_n_s_out,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -2417,20 +2467,20 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_1predict_stage kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__estimators)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_estimators)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("predict_stages", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scale)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("predict_stages", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("predict_stages", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -2463,6 +2513,8 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_1predict_stage if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages(__pyx_self, __pyx_v_estimators, __pyx_v_X, __pyx_v_scale, __pyx_v_out); + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -2471,14 +2523,6 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_1predict_stage return __pyx_r; } -/* "sklearn/ensemble/_gradient_boosting.pyx":103 - * - * @cython.nonecheck(False) - * def predict_stages(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< - * np.ndarray[DTYPE_t, ndim=2, mode='c'] X, double scale, - * np.ndarray[float64, ndim=2] out): - */ - static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_estimators, PyArrayObject *__pyx_v_X, double __pyx_v_scale, PyArrayObject *__pyx_v_out) { Py_ssize_t __pyx_v_i; Py_ssize_t __pyx_v_k; @@ -2584,24 +2628,33 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages __pyx_t_7 = __pyx_v_k; __pyx_t_5 = (PyObject *) *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_estimators.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_estimators.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_estimators.diminfo[1].strides); __Pyx_INCREF((PyObject*)__pyx_t_5); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__tree_); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tree); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7sklearn_4tree_5_tree_Tree))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_tree, ((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_t_8)); __pyx_t_8 = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":128 + /* "sklearn/ensemble/_gradient_boosting.pyx":124 + * # and get data pointer + * # need brackets because of casting operator priority + * _predict_regression_tree_inplace_fast( # <<<<<<<<<<<<<< + * X.data, * tree.nodes, tree.value, - * scale, k, K, X.shape[0], X.shape[1], - * ( out).data) # <<<<<<<<<<<<<< - * ## out += scale * tree.predict(X).reshape((X.shape[0], 1)) - * */ __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_tree_inplace_fast(((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_DTYPE_t *)__pyx_v_X->data), __pyx_v_tree->nodes, __pyx_v_tree->value, __pyx_v_scale, __pyx_v_k, __pyx_v_K, (__pyx_v_X->dimensions[0]), (__pyx_v_X->dimensions[1]), ((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_float64 *)((PyArrayObject *)__pyx_v_out)->data)); } } + /* "sklearn/ensemble/_gradient_boosting.pyx":103 + * + * @cython.nonecheck(False) + * def predict_stages(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< + * np.ndarray[DTYPE_t, ndim=2, mode='c'] X, double scale, + * np.ndarray[float64, ndim=2] out): + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -2627,6 +2680,14 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages return __pyx_r; } +/* "sklearn/ensemble/_gradient_boosting.pyx":133 + * + * @cython.nonecheck(False) + * def predict_stage(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< + * int stage, + * np.ndarray[DTYPE_t, ndim=2] X, double scale, + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_3predict_stage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7sklearn_8ensemble_18_gradient_boosting_2predict_stage[] = "Add predictions of ``estimators[stage]`` to ``out``.\n\n Each estimator in the stage is scaled by ``scale`` before\n its prediction is added to ``out``.\n "; @@ -2644,7 +2705,7 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_3predict_stage __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("predict_stage (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__estimators,&__pyx_n_s__stage,&__pyx_n_s__X,&__pyx_n_s__scale,&__pyx_n_s__out,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_estimators,&__pyx_n_s_stage,&__pyx_n_s_X,&__pyx_n_s_scale,&__pyx_n_s_out,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -2661,25 +2722,25 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_3predict_stage kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__estimators)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_estimators)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stage)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stage)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale)) != 0)) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scale)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -2697,7 +2758,7 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_3predict_stage values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_estimators = ((PyArrayObject *)values[0]); - __pyx_v_stage = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_stage == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_stage = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_stage == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X = ((PyArrayObject *)values[2]); __pyx_v_scale = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_scale == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_out = ((PyArrayObject *)values[4]); @@ -2714,6 +2775,8 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_3predict_stage if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_out), __pyx_ptype_5numpy_ndarray, 1, "out", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage(__pyx_self, __pyx_v_estimators, __pyx_v_stage, __pyx_v_X, __pyx_v_scale, __pyx_v_out); + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -2722,14 +2785,6 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_3predict_stage return __pyx_r; } -/* "sklearn/ensemble/_gradient_boosting.pyx":133 - * - * @cython.nonecheck(False) - * def predict_stage(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< - * int stage, - * np.ndarray[DTYPE_t, ndim=2] X, double scale, - */ - static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_estimators, int __pyx_v_stage, PyArrayObject *__pyx_v_X, double __pyx_v_scale, PyArrayObject *__pyx_v_out) { __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; @@ -2783,7 +2838,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__predict_stages); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_predict_stages); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_estimators), __pyx_v_stage, (__pyx_v_stage + 1), NULL, NULL, NULL, 1, 1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -2803,16 +2858,23 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage __Pyx_GIVEREF(((PyObject *)__pyx_v_out)); __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/ensemble/_gradient_boosting.pyx":133 + * + * @cython.nonecheck(False) + * def predict_stage(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< + * int stage, + * np.ndarray[DTYPE_t, ndim=2] X, double scale, + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -2923,9 +2985,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i * */ goto __pyx_L4_break; - goto __pyx_L5; } - __pyx_L5:; } __pyx_L4_break:; @@ -2939,7 +2999,15 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i __pyx_r = __pyx_v_res; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/ensemble/_gradient_boosting.pyx":145 + * + * + * cdef inline int array_index(int32 val, int32[::1] arr): # <<<<<<<<<<<<<< + * """Find index of ``val`` in array ``arr``. """ + * cdef int32 res = -1 + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -3064,9 +3132,9 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend * cdef SIZE_t stack_size = 1 * cdef double left_sample_frac */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np_ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np_ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_stack_capacity); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_stack_capacity); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); @@ -3075,20 +3143,20 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__np_float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np_float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_7); if (unlikely(!__pyx_t_8.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -3121,9 +3189,9 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend * node_stack = ( underlying_stack).data * */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__np_zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np_zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_stack_capacity); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_stack_capacity); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); @@ -3132,23 +3200,23 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__intp); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intp); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_underlying_stack = __pyx_t_9; __pyx_t_9 = 0; @@ -3365,12 +3433,12 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_19 = __pyx_v_stack_size; __pyx_v_current_weight = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_weight_stack.data) + __pyx_t_19)) ))); - /* "sklearn/ensemble/_gradient_boosting.pyx":248 + /* "sklearn/ensemble/_gradient_boosting.pyx":247 + * node_stack[stack_size] = root_node + current_node.left_child * current_weight = weight_stack[stack_size] - * left_sample_frac = root_node[current_node.left_child].n_samples / \ - * current_node.n_samples # <<<<<<<<<<<<<< + * left_sample_frac = root_node[current_node.left_child].n_samples / \ # <<<<<<<<<<<<<< + * current_node.n_samples * if left_sample_frac <= 0.0 or left_sample_frac >= 1.0: - * raise ValueError("left_sample_frac:%f, " */ __pyx_v_left_sample_frac = ((__pyx_v_root_node[__pyx_v_current_node->left_child]).n_samples / ((double)__pyx_v_current_node->n_samples)); @@ -3407,7 +3475,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend * root_node[current_node.left_child].n_samples)) * weight_stack[stack_size] = current_weight * left_sample_frac */ - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_current_node->n_samples); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_current_node->n_samples); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); /* "sklearn/ensemble/_gradient_boosting.pyx":255 @@ -3417,8 +3485,16 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend * weight_stack[stack_size] = current_weight * left_sample_frac * stack_size +=1 */ - __pyx_t_6 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_root_node[__pyx_v_current_node->left_child]).n_samples); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_root_node[__pyx_v_current_node->left_child]).n_samples); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); + + /* "sklearn/ensemble/_gradient_boosting.pyx":253 + * "n_samples current: %d, " + * "n_samples left: %d" + * % (left_sample_frac, # <<<<<<<<<<<<<< + * current_node.n_samples, + * root_node[current_node.left_child].n_samples)) + */ __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); @@ -3430,23 +3506,29 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_9 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_left_sample_frac_f_n_samples_cur, __pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "sklearn/ensemble/_gradient_boosting.pyx":250 + * current_node.n_samples + * if left_sample_frac <= 0.0 or left_sample_frac >= 1.0: + * raise ValueError("left_sample_frac:%f, " # <<<<<<<<<<<<<< + * "n_samples current: %d, " + * "n_samples left: %d" + */ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; } - __pyx_L10:; /* "sklearn/ensemble/_gradient_boosting.pyx":256 * current_node.n_samples, @@ -3523,25 +3605,40 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_t_6 = PyFloat_FromDouble(__pyx_v_total_weight); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + + /* "sklearn/ensemble/_gradient_boosting.pyx":266 + * + * if not (0.999 < total_weight < 1.001): + * raise ValueError("Total weight should be 1.0 but was %.9f" % # <<<<<<<<<<<<<< + * total_weight) + * + */ + __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Total_weight_should_be_1_0_but_w, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L11; } - __pyx_L11:; } + /* "sklearn/ensemble/_gradient_boosting.pyx":157 + * + * + * cpdef _partial_dependence_tree(Tree tree, DTYPE_t[:, ::1] X, # <<<<<<<<<<<<<< + * int32[::1] target_feature, + * double learn_rate, + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -3577,7 +3674,7 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_5_partial_depe __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_partial_dependence_tree (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,&__pyx_n_s__X,&__pyx_n_s__target_feature,&__pyx_n_s__learn_rate,&__pyx_n_s__out,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree_2,&__pyx_n_s_X,&__pyx_n_s_target_feature,&__pyx_n_s_learn_rate,&__pyx_n_s_out,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -3594,25 +3691,25 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_5_partial_depe kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tree_2)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__target_feature)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_target_feature)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__learn_rate)) != 0)) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_learn_rate)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out)) != 0)) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_out)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -3645,6 +3742,8 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_5_partial_depe __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_7sklearn_4tree_5_tree_Tree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_8ensemble_18_gradient_boosting_4_partial_dependence_tree(__pyx_self, __pyx_v_tree, __pyx_v_X, __pyx_v_target_feature, __pyx_v_learn_rate, __pyx_v_out); + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3653,14 +3752,6 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_5_partial_depe return __pyx_r; } -/* "sklearn/ensemble/_gradient_boosting.pyx":157 - * - * - * cpdef _partial_dependence_tree(Tree tree, DTYPE_t[:, ::1] X, # <<<<<<<<<<<<<< - * int32[::1] target_feature, - * double learn_rate, - */ - static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_4_partial_dependence_tree(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_tree, __Pyx_memviewslice __pyx_v_X, __Pyx_memviewslice __pyx_v_target_feature, double __pyx_v_learn_rate, __Pyx_memviewslice __pyx_v_out) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3679,8 +3770,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_4_partial_depe __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.ensemble._gradient_boosting._partial_dependence_tree", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -3694,6 +3784,14 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_4_partial_depe return __pyx_r; } +/* "sklearn/ensemble/_gradient_boosting.pyx":270 + * + * + * def _random_sample_mask(int n_total_samples, int n_total_in_bag, random_state): # <<<<<<<<<<<<<< + * """Create a random sample mask where ``n_total_in_bag`` elements are set. + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_7_random_sample_mask(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7sklearn_8ensemble_18_gradient_boosting_6_random_sample_mask[] = "Create a random sample mask where ``n_total_in_bag`` elements are set.\n\n Parameters\n ----------\n n_total_samples : int\n The length of the resulting mask.\n\n n_total_in_bag : int\n The number of elements in the sample mask which are set to 1.\n\n random_state : np.RandomState\n A numpy ``RandomState`` object.\n\n Returns\n -------\n sample_mask : np.ndarray, shape=[n_total_samples]\n An ndarray where ``n_total_in_bag`` elements are set to ``True``\n the others are ``False``.\n "; @@ -3709,7 +3807,7 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_7_random_sampl __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_random_sample_mask (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_total_samples,&__pyx_n_s__n_total_in_bag,&__pyx_n_s__random_state,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n_total_samples,&__pyx_n_s_n_total_in_bag,&__pyx_n_s_random_state,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -3724,15 +3822,15 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_7_random_sampl kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_total_samples)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n_total_samples)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_total_in_bag)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n_total_in_bag)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_random_sample_mask", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__random_state)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_random_sample_mask", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -3747,8 +3845,8 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_7_random_sampl values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_n_total_samples = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_total_samples == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_n_total_in_bag = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_total_in_bag == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_total_samples = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_n_total_samples == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_total_in_bag = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_n_total_in_bag == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_random_state = values[2]; } goto __pyx_L4_argument_unpacking_done; @@ -3760,18 +3858,12 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_7_random_sampl return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_8ensemble_18_gradient_boosting_6_random_sample_mask(__pyx_self, __pyx_v_n_total_samples, __pyx_v_n_total_in_bag, __pyx_v_random_state); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/ensemble/_gradient_boosting.pyx":270 - * - * - * def _random_sample_mask(int n_total_samples, int n_total_in_bag, random_state): # <<<<<<<<<<<<<< - * """Create a random sample mask where ``n_total_in_bag`` elements are set. - * - */ - static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_6_random_sample_mask(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_total_samples, int __pyx_v_n_total_in_bag, PyObject *__pyx_v_random_state) { PyArrayObject *__pyx_v_rand = 0; PyArrayObject *__pyx_v_sample_mask = 0; @@ -3813,19 +3905,19 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_6_random_sampl * cdef np.ndarray[int8, ndim=1, mode="c"] sample_mask = \ * np_zeros((n_total_samples,), dtype=np_int8) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s__rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_2); { @@ -3847,9 +3939,9 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_6_random_sampl * * cdef int n_bagged = 0 */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromLong(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -3858,20 +3950,20 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_6_random_sampl __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__np_int8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np_int8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { @@ -3954,25 +4046,32 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_6_random_sampl * return sample_mask.astype(np_bool) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_mask), __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np_bool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np_bool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/ensemble/_gradient_boosting.pyx":270 + * + * + * def _random_sample_mask(int n_total_samples, int n_total_in_bag, random_state): # <<<<<<<<<<<<<< + * """Create a random sample mask where ``n_total_in_bag`` elements are set. + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -3997,6 +4096,14 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_6_random_sampl return __pyx_r; } +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { @@ -4004,18 +4111,12 @@ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numpy.pxd":194 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; @@ -4047,7 +4148,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":200 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -4058,11 +4159,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "numpy.pxd":203 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -4071,7 +4170,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":204 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -4080,7 +4179,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":206 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -4089,7 +4188,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":208 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -4099,7 +4198,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "numpy.pxd":209 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -4111,7 +4210,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":211 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -4122,7 +4221,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L4:; - /* "numpy.pxd":213 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -4132,7 +4231,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { - /* "numpy.pxd":214 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -4146,23 +4245,21 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_3) { - /* "numpy.pxd":215 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; } - __pyx_L5:; - /* "numpy.pxd":217 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -4172,7 +4269,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { - /* "numpy.pxd":218 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -4186,23 +4283,21 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_2) { - /* "numpy.pxd":219 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; } - __pyx_L6:; - /* "numpy.pxd":221 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -4211,7 +4306,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":222 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -4220,7 +4315,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":223 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -4230,7 +4325,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_2 = (__pyx_v_copy_shape != 0); if (__pyx_t_2) { - /* "numpy.pxd":226 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -4239,7 +4334,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":227 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -4248,7 +4343,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":228 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -4259,7 +4354,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":229 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -4268,7 +4363,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":230 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -4281,7 +4376,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":232 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -4290,7 +4385,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":233 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -4301,7 +4396,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L7:; - /* "numpy.pxd":234 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -4310,7 +4405,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":235 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -4319,7 +4414,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":236 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -4328,7 +4423,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - /* "numpy.pxd":239 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -4337,7 +4432,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_f = NULL; - /* "numpy.pxd":240 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -4349,7 +4444,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; - /* "numpy.pxd":244 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -4358,7 +4453,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":246 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -4374,7 +4469,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":248 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -4390,7 +4485,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":251 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -4405,7 +4500,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L10:; - /* "numpy.pxd":253 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -4415,7 +4510,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { - /* "numpy.pxd":254 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -4425,7 +4520,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":255 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -4440,7 +4535,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (!__pyx_t_2) { - /* "numpy.pxd":256 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -4460,23 +4555,21 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":257 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L12; } - __pyx_L12:; - /* "numpy.pxd":274 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -4485,7 +4578,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ switch (__pyx_v_t) { - /* "numpy.pxd":258 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -4493,10 +4586,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_SHORT: f = "h" */ case NPY_BYTE: - __pyx_v_f = __pyx_k__b; + __pyx_v_f = __pyx_k_b; break; - /* "numpy.pxd":259 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -4504,10 +4597,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_USHORT: f = "H" */ case NPY_UBYTE: - __pyx_v_f = __pyx_k__B; + __pyx_v_f = __pyx_k_B; break; - /* "numpy.pxd":260 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -4515,10 +4608,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_INT: f = "i" */ case NPY_SHORT: - __pyx_v_f = __pyx_k__h; + __pyx_v_f = __pyx_k_h; break; - /* "numpy.pxd":261 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -4526,10 +4619,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_UINT: f = "I" */ case NPY_USHORT: - __pyx_v_f = __pyx_k__H; + __pyx_v_f = __pyx_k_H; break; - /* "numpy.pxd":262 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -4537,10 +4630,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_LONG: f = "l" */ case NPY_INT: - __pyx_v_f = __pyx_k__i; + __pyx_v_f = __pyx_k_i; break; - /* "numpy.pxd":263 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -4548,10 +4641,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_ULONG: f = "L" */ case NPY_UINT: - __pyx_v_f = __pyx_k__I; + __pyx_v_f = __pyx_k_I; break; - /* "numpy.pxd":264 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -4559,10 +4652,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_LONGLONG: f = "q" */ case NPY_LONG: - __pyx_v_f = __pyx_k__l; + __pyx_v_f = __pyx_k_l; break; - /* "numpy.pxd":265 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -4570,10 +4663,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_ULONGLONG: f = "Q" */ case NPY_ULONG: - __pyx_v_f = __pyx_k__L; + __pyx_v_f = __pyx_k_L; break; - /* "numpy.pxd":266 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -4581,10 +4674,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_FLOAT: f = "f" */ case NPY_LONGLONG: - __pyx_v_f = __pyx_k__q; + __pyx_v_f = __pyx_k_q; break; - /* "numpy.pxd":267 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -4592,10 +4685,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_DOUBLE: f = "d" */ case NPY_ULONGLONG: - __pyx_v_f = __pyx_k__Q; + __pyx_v_f = __pyx_k_Q; break; - /* "numpy.pxd":268 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -4603,10 +4696,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_LONGDOUBLE: f = "g" */ case NPY_FLOAT: - __pyx_v_f = __pyx_k__f; + __pyx_v_f = __pyx_k_f; break; - /* "numpy.pxd":269 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -4614,10 +4707,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_CFLOAT: f = "Zf" */ case NPY_DOUBLE: - __pyx_v_f = __pyx_k__d; + __pyx_v_f = __pyx_k_d; break; - /* "numpy.pxd":270 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -4625,10 +4718,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_CDOUBLE: f = "Zd" */ case NPY_LONGDOUBLE: - __pyx_v_f = __pyx_k__g; + __pyx_v_f = __pyx_k_g; break; - /* "numpy.pxd":271 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -4636,10 +4729,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_CLONGDOUBLE: f = "Zg" */ case NPY_CFLOAT: - __pyx_v_f = __pyx_k__Zf; + __pyx_v_f = __pyx_k_Zf; break; - /* "numpy.pxd":272 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -4647,10 +4740,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_OBJECT: f = "O" */ case NPY_CDOUBLE: - __pyx_v_f = __pyx_k__Zd; + __pyx_v_f = __pyx_k_Zd; break; - /* "numpy.pxd":273 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -4658,10 +4751,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * else: */ case NPY_CLONGDOUBLE: - __pyx_v_f = __pyx_k__Zg; + __pyx_v_f = __pyx_k_Zg; break; - /* "numpy.pxd":274 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -4669,37 +4762,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ case NPY_OBJECT: - __pyx_v_f = __pyx_k__O; + __pyx_v_f = __pyx_k_O; break; default: - /* "numpy.pxd":276 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - /* "numpy.pxd":277 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -4708,7 +4801,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":278 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -4717,11 +4810,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":280 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -4730,7 +4822,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":281 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -4739,7 +4831,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":282 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -4748,17 +4840,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_offset = 0; - /* "numpy.pxd":285 - * f = _util_dtypestring(descr, info.format + 1, + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":283 + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< * info.format + _buffer_format_string_len, - * &offset) # <<<<<<<<<<<<<< - * f[0] = c'\0' # Terminate format string - * + * &offset) */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "numpy.pxd":286 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< @@ -4767,11 +4859,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_f[0]) = '\x00'; } - __pyx_L11:; - __pyx_r = 0; - goto __pyx_L0; - __pyx_L1_error:; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -4792,29 +4892,31 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P return __pyx_r; } +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":288 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":289 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -4824,7 +4926,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { - /* "numpy.pxd":290 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -4836,7 +4938,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L3:; - /* "numpy.pxd":291 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -4846,7 +4948,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "numpy.pxd":292 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -4858,10 +4960,19 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L4:; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":768 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -4878,7 +4989,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":769 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -4892,8 +5003,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -4904,7 +5022,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":771 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -4921,7 +5039,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":772 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -4935,8 +5053,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -4947,7 +5072,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":774 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -4964,7 +5089,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":775 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -4978,8 +5103,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -4990,7 +5122,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":777 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -5007,7 +5139,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":778 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -5021,8 +5153,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -5033,7 +5172,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":780 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -5050,7 +5189,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":781 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -5064,8 +5203,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -5076,7 +5222,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":783 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -5098,20 +5244,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_5; + int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - int __pyx_t_10; - long __pyx_t_11; - char *__pyx_t_12; + long __pyx_t_10; + char *__pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":790 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -5120,7 +5265,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":791 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -5129,18 +5274,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":794 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + if (unlikely(__pyx_v_descr->names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON @@ -5151,28 +5296,28 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":795 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; - /* "numpy.pxd":796 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * - * if (end - f) - (new_offset - offset[0]) < 15: + * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { - PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (likely(__pyx_v_fields != Py_None)) { + PyObject* sequence = __pyx_v_fields; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else @@ -5194,28 +5339,8 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif - } else if (1) { + } else { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else - { - Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); @@ -5223,98 +5348,87 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; - /* "numpy.pxd":798 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798 * child, new_offset = fields * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); + if (__pyx_t_6) { - /* "numpy.pxd":799 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799 * - * if (end - f) - (new_offset - offset[0]) < 15: + * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; } - __pyx_L7:; - /* "numpy.pxd":801 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_little_endian != 0); + __pyx_t_6 = ((__pyx_v_child->byteorder == '>') != 0); + if (__pyx_t_6) { + __pyx_t_7 = (__pyx_v_little_endian != 0); } else { - __pyx_t_8 = __pyx_t_7; + __pyx_t_7 = __pyx_t_6; } - if (!__pyx_t_8) { + if (!__pyx_t_7) { - /* "numpy.pxd":802 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); - if (__pyx_t_7) { - __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_10 = __pyx_t_9; + __pyx_t_6 = ((__pyx_v_child->byteorder == '<') != 0); + if (__pyx_t_6) { + __pyx_t_8 = ((!(__pyx_v_little_endian != 0)) != 0); + __pyx_t_9 = __pyx_t_8; } else { - __pyx_t_10 = __pyx_t_7; + __pyx_t_9 = __pyx_t_6; } - __pyx_t_7 = __pyx_t_10; + __pyx_t_6 = __pyx_t_9; } else { - __pyx_t_7 = __pyx_t_8; + __pyx_t_6 = __pyx_t_7; } - if (__pyx_t_7) { + if (__pyx_t_6) { - /* "numpy.pxd":803 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; } - __pyx_L8:; - /* "numpy.pxd":813 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -5322,15 +5436,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_7) break; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_6) break; - /* "numpy.pxd":814 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -5339,7 +5453,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":815 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -5348,412 +5462,410 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":816 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_11 = 0; - (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); } - /* "numpy.pxd":818 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_11 = 0; - (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); - /* "numpy.pxd":820 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); - if (__pyx_t_7) { + __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); + if (__pyx_t_6) { - /* "numpy.pxd":821 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":822 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); - if (__pyx_t_7) { + __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); + if (__pyx_t_6) { - /* "numpy.pxd":823 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L12; } - __pyx_L12:; - /* "numpy.pxd":826 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 98; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":827 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 66; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":828 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 104; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":829 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 72; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":830 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 105; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":831 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 73; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":832 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 108; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":833 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 76; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":834 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 113; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":835 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 81; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":836 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 102; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":837 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 100; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":838 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 103; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":839 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":840 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":841 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":842 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 79; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":844 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L13:; + __pyx_L11:; - /* "numpy.pxd":845 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -5761,25 +5873,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L9; } /*else*/ { - /* "numpy.pxd":849 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_12; + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; } - __pyx_L11:; + __pyx_L9:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":850 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -5789,13 +5901,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = __pyx_v_f; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -5808,7 +5926,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":965 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -5823,7 +5941,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":967 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -5834,7 +5952,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "numpy.pxd":968 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":969 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -5846,7 +5964,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":970 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":971 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -5855,7 +5973,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":971 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":972 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -5866,7 +5984,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":972 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":973 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -5875,7 +5993,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":973 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":974 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -5884,11 +6002,20 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_RefNannyFinishContext(); -} - -/* "numpy.pxd":975 - * arr.base = baseptr + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + + /* function exit code */ + __Pyx_RefNannyFinishContext(); +} + +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976 + * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: @@ -5901,7 +6028,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":976 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -5911,7 +6038,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { - /* "numpy.pxd":977 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":978 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -5922,11 +6049,10 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; - goto __pyx_L3; } /*else*/ { - /* "numpy.pxd":979 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":980 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -5936,15 +6062,30 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } - __pyx_L3:; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "View.MemoryView":113 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode=u"c", bint allocate_buffer=True): + * + */ + /* Python wrapper */ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -5960,9 +6101,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shape,&__pyx_n_s__itemsize,&__pyx_n_s__format,&__pyx_n_s__mode,&__pyx_n_s__allocate_buffer,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0}; PyObject* values[5] = {0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_n_u__c); + values[3] = ((PyObject *)__pyx_n_u_c); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); @@ -5978,26 +6119,26 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shape)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__itemsize)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__allocate_buffer); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_allocate_buffer); if (value) { values[4] = value; kw_args--; } } } @@ -6043,18 +6184,11 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument 'format' must not be None"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_r = __pyx_array_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = -1; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -/* "View.MemoryView":113 + /* "View.MemoryView":113 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< @@ -6062,6 +6196,15 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P * */ + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) { int __pyx_v_idx; Py_ssize_t __pyx_v_i; @@ -6096,11 +6239,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * self.itemsize = itemsize * */ - if (unlikely(((PyObject *)__pyx_v_shape) == Py_None)) { + if (unlikely(__pyx_v_shape == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->ndim = ((int)__pyx_t_1); /* "View.MemoryView":121 @@ -6129,14 +6272,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * * if self.itemsize <= 0: */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; } - __pyx_L3:; /* "View.MemoryView":126 * raise ValueError("Empty shape tuple for cython.array") @@ -6155,14 +6296,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * * encode = getattr(format, 'encode', None) */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; } - __pyx_L4:; /* "View.MemoryView":129 * raise ValueError("itemsize <= 0 for cython.array") @@ -6171,7 +6310,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * if encode: * format = encode('ASCII') */ - __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, ((PyObject *)__pyx_n_s__encode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_format, __pyx_n_s_encode, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_encode = __pyx_t_3; __pyx_t_3 = 0; @@ -6193,7 +6332,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * self._format = format * self.format = self._format */ - __pyx_t_3 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_v_encode, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); __pyx_t_3 = 0; @@ -6208,12 +6347,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * self.format = self._format * */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_format)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_format); - __Pyx_GIVEREF(__pyx_v_format); + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_format); - __Pyx_DECREF(((PyObject *)__pyx_v_self->_format)); - __pyx_v_self->_format = ((PyObject*)__pyx_v_format); + __Pyx_DECREF(__pyx_v_self->_format); + __pyx_v_self->_format = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; /* "View.MemoryView":133 * format = encode('ASCII') @@ -6222,7 +6363,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * * self._shape = malloc(sizeof(Py_ssize_t)*self.ndim) */ - __pyx_t_4 = __Pyx_PyObject_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_self->_format); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->format = __pyx_t_4; /* "View.MemoryView":135 @@ -6284,14 +6425,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * * */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; } - __pyx_L6:; /* "View.MemoryView":144 * @@ -6310,7 +6449,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ __pyx_t_7 = 0; - __pyx_t_3 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; for (;;) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON @@ -6342,7 +6481,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * * self._shape[idx] = dim */ - __pyx_t_8 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); @@ -6352,23 +6491,21 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_dim); __Pyx_GIVEREF(__pyx_v_dim); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L9; } - __pyx_L9:; /* "View.MemoryView":149 * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) @@ -6400,11 +6537,11 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx */ __Pyx_INCREF(__pyx_v_mode); __pyx_t_3 = __pyx_v_mode; - __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, __pyx_n_s_fortran, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (((int)__pyx_t_6)) { - __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_3, __pyx_n_s_c, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_5 = ((int)__pyx_t_2); @@ -6422,22 +6559,20 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * * cdef char order */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; } - __pyx_L10:; /* "View.MemoryView":156 * @@ -6446,9 +6581,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * order = 'F' * else: */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { /* "View.MemoryView":157 @@ -6490,7 +6623,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * if decode: * mode = decode('ASCII') */ - __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, ((PyObject *)__pyx_n_s__decode), Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_n_s_decode, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_decode = __pyx_t_3; __pyx_t_3 = 0; @@ -6512,7 +6645,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * self.mode = mode * */ - __pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_v_decode, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_3); __pyx_t_3 = 0; @@ -6527,12 +6660,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * * self.free_data = allocate_buffer */ - if (!(likely(PyUnicode_CheckExact(__pyx_v_mode))||((__pyx_v_mode) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected unicode, got %.200s", Py_TYPE(__pyx_v_mode)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_mode); - __Pyx_GIVEREF(__pyx_v_mode); + if (!(likely(PyUnicode_CheckExact(__pyx_v_mode))||((__pyx_v_mode) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_mode)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_v_mode; + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->mode); - __Pyx_DECREF(((PyObject *)__pyx_v_self->mode)); - __pyx_v_self->mode = ((PyObject*)__pyx_v_mode); + __Pyx_DECREF(__pyx_v_self->mode); + __pyx_v_self->mode = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; /* "View.MemoryView":169 * self.mode = mode @@ -6550,7 +6685,7 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * if allocate_buffer: * self.data = malloc(self.len) */ - __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->dtype_is_object = __pyx_t_6; @@ -6591,14 +6726,12 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx * * if self.dtype_is_object: */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; } - __pyx_L14:; /* "View.MemoryView":176 * raise MemoryError("unable to allocate array data.") @@ -6630,17 +6763,17 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { + else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif @@ -6675,6 +6808,15 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx } __pyx_L13:; + /* "View.MemoryView":113 + * cdef bint dtype_is_object + * + * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< + * mode=u"c", bint allocate_buffer=True): + * + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -6693,6 +6835,14 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx return __pyx_r; } +/* "View.MemoryView":183 + * + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< + * cdef int bufmode = -1 + * if self.mode == b"c": + */ + /* Python wrapper */ static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { @@ -6700,18 +6850,12 @@ static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":183 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * cdef int bufmode = -1 - * if self.mode == b"c": - */ - static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_bufmode; int __pyx_r; @@ -6748,7 +6892,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == b"fortran": */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_b_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { @@ -6770,7 +6914,7 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_b_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { @@ -6803,14 +6947,12 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * info.buf = self.data * info.len = self.len */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; } - __pyx_L4:; /* "View.MemoryView":191 * if not (flags & bufmode): @@ -6937,6 +7079,15 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + /* "View.MemoryView":183 + * + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< + * cdef int bufmode = -1 + * if self.mode == b"c": + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -6958,23 +7109,25 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a return __pyx_r; } +/* "View.MemoryView":209 + * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + */ + /* Python wrapper */ static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_array___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_array_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":209 - * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") - * - * def __dealloc__(array self): # <<<<<<<<<<<<<< - * if self.callback_free_data != NULL: - * self.callback_free_data(self.data) - */ - static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -7021,12 +7174,12 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_ __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":215 + /* "View.MemoryView":214 + * elif self.free_data: * if self.dtype_is_object: - * refcount_objects_in_slice(self.data, self._shape, - * self._strides, self.ndim, False) # <<<<<<<<<<<<<< + * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< + * self._strides, self.ndim, False) * free(self.data) - * */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); goto __pyx_L4; @@ -7063,9 +7216,26 @@ static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *_ */ free(__pyx_v_self->_shape); + /* "View.MemoryView":209 + * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") + * + * def __dealloc__(array self): # <<<<<<<<<<<<<< + * if self.callback_free_data != NULL: + * self.callback_free_data(self.data) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } +/* "View.MemoryView":223 + * property memview: + * @cname('get_memview') + * def __get__(self): # <<<<<<<<<<<<<< + * + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + */ + /* Python wrapper */ static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/ static PyObject *get_memview(PyObject *__pyx_v_self) { @@ -7073,18 +7243,12 @@ static PyObject *get_memview(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = get_memview_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":223 - * property memview: - * @cname('get_memview') - * def __get__(self): # <<<<<<<<<<<<<< - * - * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE - */ - static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) { int __pyx_v_flags; PyObject *__pyx_r = NULL; @@ -7114,7 +7278,7 @@ static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_arr * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -7129,15 +7293,22 @@ static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_arr __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":223 + * property memview: + * @cname('get_memview') + * def __get__(self): # <<<<<<<<<<<<<< + * + * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -7150,6 +7321,14 @@ static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_arr return __pyx_r; } +/* "View.MemoryView":229 + * + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * + */ + /* Python wrapper */ static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/ static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) { @@ -7157,18 +7336,12 @@ static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0); __pyx_r = __pyx_array_MemoryView_5array_6__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":229 - * - * - * def __getattr__(self, attr): # <<<<<<<<<<<<<< - * return getattr(self.memview, attr) - * - */ - static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7187,7 +7360,7 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o * def __getitem__(self, item): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -7196,8 +7369,15 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":229 + * + * + * def __getattr__(self, attr): # <<<<<<<<<<<<<< + * return getattr(self.memview, attr) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -7209,6 +7389,14 @@ static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_o return __pyx_r; } +/* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * + */ + /* Python wrapper */ static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/ static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) { @@ -7216,18 +7404,12 @@ static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); __pyx_r = __pyx_array_MemoryView_5array_8__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":232 - * return getattr(self.memview, attr) - * - * def __getitem__(self, item): # <<<<<<<<<<<<<< - * return self.memview[item] - * - */ - static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7246,17 +7428,24 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o * def __setitem__(self, item, value): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":232 + * return getattr(self.memview, attr) + * + * def __getitem__(self, item): # <<<<<<<<<<<<<< + * return self.memview[item] + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -7268,6 +7457,14 @@ static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_o return __pyx_r; } +/* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * + */ + /* Python wrapper */ static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/ static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { @@ -7275,18 +7472,12 @@ static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_ite __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); __pyx_r = __pyx_array_MemoryView_5array_10__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":235 - * return self.memview[item] - * - * def __setitem__(self, item, value): # <<<<<<<<<<<<<< - * self.memview[item] = value - * - */ - static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -7303,11 +7494,20 @@ static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *_ * * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* "View.MemoryView":235 + * return self.memview[item] + * + * def __setitem__(self, item, value): # <<<<<<<<<<<<<< + * self.memview[item] = value + * + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -7361,26 +7561,26 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_v_shape)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_shape)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_shape)); + __Pyx_INCREF(__pyx_v_shape); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L3; @@ -7397,25 +7597,25 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_v_shape)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_shape)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_shape)); + __Pyx_INCREF(__pyx_v_shape); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape); + __Pyx_GIVEREF(__pyx_v_shape); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); /* "View.MemoryView":248 * else: @@ -7424,14 +7624,19 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize * result.data = buf * */ - __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__allocate_buffer), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "View.MemoryView":247 + * result = array(shape, itemsize, format, mode.decode('ASCII')) + * else: + * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< + * allocate_buffer=False) + * result.data = buf + */ + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); __pyx_t_5 = 0; @@ -7458,10 +7663,17 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_r = __pyx_v_result; goto __pyx_L0; - __pyx_r = ((struct __pyx_array_obj *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + /* "View.MemoryView":240 + * + * @cname("__pyx_array_new") + * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< + * char *mode, char *buf): + * cdef array result + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); @@ -7474,6 +7686,14 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize return __pyx_r; } +/* "View.MemoryView":277 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): + */ + /* Python wrapper */ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -7485,7 +7705,7 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -7498,7 +7718,7 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { @@ -7520,18 +7740,12 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_MemviewEnum_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":277 - * cdef class Enum(object): - * cdef object name - * def __init__(self, name): # <<<<<<<<<<<<<< - * self.name = name - * def __repr__(self): - */ - static int __pyx_MemviewEnum_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -7550,11 +7764,28 @@ static int __pyx_MemviewEnum_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_ __Pyx_DECREF(__pyx_v_self->name); __pyx_v_self->name = __pyx_v_name; + /* "View.MemoryView":277 + * cdef class Enum(object): + * cdef object name + * def __init__(self, name): # <<<<<<<<<<<<<< + * self.name = name + * def __repr__(self): + */ + + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "View.MemoryView":279 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * + */ + /* Python wrapper */ static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { @@ -7562,18 +7793,12 @@ static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_MemviewEnum_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":279 - * def __init__(self, name): - * self.name = name - * def __repr__(self): # <<<<<<<<<<<<<< - * return self.name - * - */ - static PyObject *__pyx_MemviewEnum_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7591,7 +7816,15 @@ static PyObject *__pyx_MemviewEnum_MemoryView_4Enum_2__repr__(struct __pyx_Memvi __pyx_r = __pyx_v_self->name; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "View.MemoryView":279 + * def __init__(self, name): + * self.name = name + * def __repr__(self): # <<<<<<<<<<<<<< + * return self.name + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -7662,11 +7895,27 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) __pyx_r = ((void *)__pyx_v_aligned_p); goto __pyx_L0; - __pyx_r = 0; + /* "View.MemoryView":294 + * + * @cname('__pyx_align_pointer') + * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< + * "Align pointer memory on a given boundary" + * cdef Py_intptr_t aligned_p = memory + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } +/* "View.MemoryView":323 + * cdef __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags + */ + /* Python wrapper */ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -7680,7 +7929,7 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s__flags,&__pyx_n_s__dtype_is_object,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -7695,16 +7944,16 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype_is_object); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dtype_is_object); if (value) { values[2] = value; kw_args--; } } } @@ -7721,18 +7970,10 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar } } __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[2]) { __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - - /* "View.MemoryView":323 - * cdef __Pyx_TypeInfo *typeinfo - * - * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< - * self.obj = obj - * self.flags = flags - */ __pyx_v_dtype_is_object = ((int)0); } } @@ -7745,6 +7986,8 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_memoryview_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -7871,9 +8114,7 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor * if flags & PyBUF_FORMAT: */ PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; } - __pyx_L5:; /* "View.MemoryView":336 * raise MemoryError @@ -7893,9 +8134,9 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor * self.dtype_is_object = dtype_is_object */ __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_5, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_self->dtype_is_object = __pyx_t_3; @@ -7932,6 +8173,15 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor */ __pyx_v_self->typeinfo = NULL; + /* "View.MemoryView":323 + * cdef __Pyx_TypeInfo *typeinfo + * + * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< + * self.obj = obj + * self.flags = flags + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -7944,23 +8194,25 @@ static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memor return __pyx_r; } +/* "View.MemoryView":345 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + */ + /* Python wrapper */ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":345 - * self.typeinfo = NULL - * - * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< - * if self.obj is not None: - * __Pyx_ReleaseBuffer(&self.view) - */ - static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -8012,6 +8264,15 @@ static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_m } __pyx_L4:; + /* "View.MemoryView":345 + * self.typeinfo = NULL + * + * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } @@ -8084,8 +8345,9 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py } else { __pyx_t_5 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_5)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; @@ -8120,8 +8382,15 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py __pyx_r = __pyx_v_itemp; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":352 + * PyThread_free_lock(self.lock) + * + * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< + * cdef Py_ssize_t dim + * cdef char *itemp = self.view.buf + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); @@ -8133,6 +8402,14 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py return __pyx_r; } +/* "View.MemoryView":362 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self + */ + /* Python wrapper */ static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/ static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) { @@ -8140,18 +8417,12 @@ static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":362 - * - * - * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< - * if index is Ellipsis: - * return self - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) { PyObject *__pyx_v_have_slices = NULL; PyObject *__pyx_v_indices = NULL; @@ -8163,9 +8434,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *(*__pyx_t_7)(PyObject *); - char *__pyx_t_8; + char *__pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -8193,9 +8462,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; /* "View.MemoryView":366 * return self @@ -8204,9 +8471,9 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ * * cdef char *itemp */ - __pyx_t_3 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (likely(__pyx_t_3 != Py_None)) { PyObject* sequence = __pyx_t_3; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); @@ -8230,29 +8497,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else if (1) { + } else { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else - { - Py_ssize_t index = -1; - __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; - index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; - __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = NULL; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L5_unpacking_done; - __pyx_L4_unpacking_failed:; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L5_unpacking_done:; } __pyx_v_have_slices = __pyx_t_4; __pyx_t_4 = 0; @@ -8282,7 +8528,6 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - goto __pyx_L6; } /*else*/ { @@ -8293,8 +8538,8 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ * return self.convert_item_to_object(itemp) * */ - __pyx_t_8 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_itemp = __pyx_t_8; + __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_itemp = __pyx_t_6; /* "View.MemoryView":373 * else: @@ -8310,15 +8555,20 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ __pyx_t_3 = 0; goto __pyx_L0; } - __pyx_L6:; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":362 + * + * + * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< + * if index is Ellipsis: + * return self + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -8329,6 +8579,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __ return __pyx_r; } +/* "View.MemoryView":375 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * have_slices, index = _unellipsify(index, self.view.ndim) + * + */ + /* Python wrapper */ static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/ static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { @@ -8336,18 +8594,12 @@ static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":375 - * return self.convert_item_to_object(itemp) - * - * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< - * have_slices, index = _unellipsify(index, self.view.ndim) - * - */ - static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) { PyObject *__pyx_v_have_slices = NULL; PyObject *__pyx_v_obj = NULL; @@ -8356,9 +8608,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -8372,9 +8622,9 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me * * if have_slices: */ - __pyx_t_1 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (likely(__pyx_t_1 != Py_None)) { PyObject* sequence = __pyx_t_1; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); @@ -8398,29 +8648,8 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else if (1) { + } else { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else - { - Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L4_unpacking_done:; } __pyx_v_have_slices = __pyx_t_2; __pyx_t_2 = 0; @@ -8434,8 +8663,8 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me * obj = self.is_slice(value) * if obj: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { /* "View.MemoryView":379 * @@ -8456,8 +8685,8 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me * self.setitem_slice_assignment(self[index], obj) * else: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { /* "View.MemoryView":381 * obj = self.is_slice(value) @@ -8466,13 +8695,13 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me * else: * self.setitem_slice_assign_scalar(self[index], value) */ - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { @@ -8483,7 +8712,7 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me * else: * self.setitem_indexed(index, value) */ - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_3); if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8491,8 +8720,8 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __pyx_L6:; - goto __pyx_L5; + __pyx_L4:; + goto __pyx_L3; } /*else*/ { @@ -8507,15 +8736,23 @@ static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_me __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __pyx_L5:; + __pyx_L3:; + + /* "View.MemoryView":375 + * return self.convert_item_to_object(itemp) + * + * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< + * have_slices, index = _unellipsify(index, self.view.ndim) + * + */ + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -8584,7 +8821,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ * self.dtype_is_object) * except TypeError: */ - __pyx_t_6 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_6); /* "View.MemoryView":391 @@ -8596,6 +8833,14 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ */ __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_7); + + /* "View.MemoryView":390 + * if not isinstance(obj, memoryview): + * try: + * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * self.dtype_is_object) + * except TypeError: + */ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_obj); @@ -8607,9 +8852,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_GIVEREF(__pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); __pyx_t_7 = 0; } @@ -8656,6 +8901,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L5_exception_handled; } + goto __pyx_L6_except_error; __pyx_L6_except_error:; __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); @@ -8691,8 +8937,15 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_r = __pyx_v_obj; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":387 + * self.setitem_indexed(index, value) + * + * cdef is_slice(self, obj): # <<<<<<<<<<<<<< + * if not isinstance(obj, memoryview): + * try: + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); @@ -8753,16 +9006,33 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "View.MemoryView":401 + * cdef __Pyx_memviewslice src_slice + * + * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< + * get_slice_from_memview(dst, &dst_slice)[0], + * src.ndim, dst.ndim, self.dtype_is_object) + */ __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /* "View.MemoryView":397 + * return obj + * + * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice dst_slice + * cdef __Pyx_memviewslice src_slice + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -8787,8 +9057,8 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor int __pyx_v_array[128]; void *__pyx_v_tmp; void *__pyx_v_item; - __Pyx_memviewslice __pyx_v_tmp_slice; __Pyx_memviewslice *__pyx_v_dst_slice; + __Pyx_memviewslice __pyx_v_tmp_slice; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -8812,16 +9082,16 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_tmp = NULL; - /* "View.MemoryView":411 - * - * cdef __Pyx_memviewslice tmp_slice, *dst_slice + /* "View.MemoryView":412 + * cdef __Pyx_memviewslice *dst_slice + * cdef __Pyx_memviewslice tmp_slice * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< * * if self.view.itemsize > sizeof(array): */ __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); - /* "View.MemoryView":413 + /* "View.MemoryView":414 * dst_slice = get_slice_from_memview(dst, &tmp_slice) * * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< @@ -8831,7 +9101,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); if (__pyx_t_1) { - /* "View.MemoryView":414 + /* "View.MemoryView":415 * * if self.view.itemsize > sizeof(array): * tmp = malloc(self.view.itemsize) # <<<<<<<<<<<<<< @@ -8840,7 +9110,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_tmp = malloc(__pyx_v_self->view.itemsize); - /* "View.MemoryView":415 + /* "View.MemoryView":416 * if self.view.itemsize > sizeof(array): * tmp = malloc(self.view.itemsize) * if tmp == NULL: # <<<<<<<<<<<<<< @@ -8850,19 +9120,17 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":416 + /* "View.MemoryView":417 * tmp = malloc(self.view.itemsize) * if tmp == NULL: * raise MemoryError # <<<<<<<<<<<<<< * item = tmp * else: */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L4:; - /* "View.MemoryView":417 + /* "View.MemoryView":418 * if tmp == NULL: * raise MemoryError * item = tmp # <<<<<<<<<<<<<< @@ -8874,7 +9142,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor } /*else*/ { - /* "View.MemoryView":419 + /* "View.MemoryView":420 * item = tmp * else: * item = array # <<<<<<<<<<<<<< @@ -8885,7 +9153,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor } __pyx_L3:; - /* "View.MemoryView":421 + /* "View.MemoryView":422 * item = array * * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -8895,7 +9163,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":422 + /* "View.MemoryView":423 * * if self.dtype_is_object: * ( item)[0] = value # <<<<<<<<<<<<<< @@ -8907,7 +9175,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor } /*else*/ { - /* "View.MemoryView":424 + /* "View.MemoryView":425 * ( item)[0] = value * else: * try: # <<<<<<<<<<<<<< @@ -8921,14 +9189,14 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __Pyx_XGOTREF(__pyx_t_4); /*try:*/ { - /* "View.MemoryView":425 + /* "View.MemoryView":426 * else: * try: * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< * except: * free(tmp) */ - __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L6_error;} + __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L6_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -8939,7 +9207,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":426 + /* "View.MemoryView":427 * try: * self.assign_item_from_object( item, value) * except: # <<<<<<<<<<<<<< @@ -8948,12 +9216,12 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ /*except:*/ { __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "View.MemoryView":427 + /* "View.MemoryView":428 * self.assign_item_from_object( item, value) * except: * free(tmp) # <<<<<<<<<<<<<< @@ -8962,7 +9230,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ free(__pyx_v_tmp); - /* "View.MemoryView":428 + /* "View.MemoryView":429 * except: * free(tmp) * raise # <<<<<<<<<<<<<< @@ -8971,10 +9239,10 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __Pyx_GIVEREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7); __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -8996,7 +9264,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor } __pyx_L5:; - /* "View.MemoryView":432 + /* "View.MemoryView":433 * * * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -9006,14 +9274,14 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":433 + /* "View.MemoryView":434 * * if self.view.suboffsets != NULL: * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, * item, self.dtype_is_object) */ - __pyx_t_7 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L16; @@ -9021,15 +9289,15 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_L16:; /* "View.MemoryView":435 + * if self.view.suboffsets != NULL: * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) - * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, - * item, self.dtype_is_object) # <<<<<<<<<<<<<< + * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< + * item, self.dtype_is_object) * free(tmp) - * */ __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); - /* "View.MemoryView":436 + /* "View.MemoryView":437 * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, * item, self.dtype_is_object) * free(tmp) # <<<<<<<<<<<<<< @@ -9038,6 +9306,15 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ free(__pyx_v_tmp); + /* "View.MemoryView":405 + * src.ndim, dst.ndim, self.dtype_is_object) + * + * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< + * cdef int array[128] + * cdef void *tmp = NULL + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -9052,7 +9329,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor return __pyx_r; } -/* "View.MemoryView":438 +/* "View.MemoryView":439 * free(tmp) * * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< @@ -9071,27 +9348,36 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_indexed", 0); - /* "View.MemoryView":439 + /* "View.MemoryView":440 * * cdef setitem_indexed(self, index, value): * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< * self.assign_item_from_object(itemp, value) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_itemp = __pyx_t_1; - /* "View.MemoryView":440 + /* "View.MemoryView":441 * cdef setitem_indexed(self, index, value): * cdef char *itemp = self.get_item_pointer(index) * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< * * cdef convert_item_to_object(self, char *itemp): */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "View.MemoryView":439 + * free(tmp) + * + * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< + * cdef char *itemp = self.get_item_pointer(index) + * self.assign_item_from_object(itemp, value) + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -9104,7 +9390,7 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ return __pyx_r; } -/* "View.MemoryView":442 +/* "View.MemoryView":443 * self.assign_item_from_object(itemp, value) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -9133,31 +9419,31 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "View.MemoryView":445 + /* "View.MemoryView":446 * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" * import struct # <<<<<<<<<<<<<< * cdef bytes bytesitem * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":448 + /* "View.MemoryView":449 * cdef bytes bytesitem * * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< * try: * result = struct.unpack(self.view.format, bytesitem) */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":449 + /* "View.MemoryView":450 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< @@ -9171,35 +9457,35 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __Pyx_XGOTREF(__pyx_t_4); /*try:*/ { - /* "View.MemoryView":450 + /* "View.MemoryView":451 * bytesitem = itemp[:self.view.itemsize] * try: * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< * except struct.error: * raise ValueError("Unable to convert item to object") */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(((PyObject *)__pyx_v_bytesitem)); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_bytesitem)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_bytesitem)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_bytesitem); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_bytesitem); + __Pyx_GIVEREF(__pyx_v_bytesitem); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_result = __pyx_t_5; __pyx_t_5 = 0; } /*else:*/ { - /* "View.MemoryView":454 + /* "View.MemoryView":455 * raise ValueError("Unable to convert item to object") * else: * if len(self.view.format) == 1: # <<<<<<<<<<<<<< @@ -9210,7 +9496,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __pyx_t_8 = ((__pyx_t_7 == 1) != 0); if (__pyx_t_8) { - /* "View.MemoryView":455 + /* "View.MemoryView":456 * else: * if len(self.view.format) == 1: * return result[0] # <<<<<<<<<<<<<< @@ -9218,16 +9504,14 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}; __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L6_except_return; - goto __pyx_L11; } - __pyx_L11:; - /* "View.MemoryView":456 + /* "View.MemoryView":457 * if len(self.view.format) == 1: * return result[0] * return result # <<<<<<<<<<<<<< @@ -9248,41 +9532,42 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":451 + /* "View.MemoryView":452 * try: * result = struct.unpack(self.view.format, bytesitem) * except struct.error: # <<<<<<<<<<<<<< * raise ValueError("Unable to convert item to object") * else: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_9) { __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_1); - /* "View.MemoryView":452 + /* "View.MemoryView":453 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< * else: * if len(self.view.format) == 1: */ - __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L4_exception_handled; } + goto __pyx_L5_except_error; __pyx_L5_except_error:; __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); @@ -9303,8 +9588,15 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __pyx_L10_try_end:; } - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":443 + * self.assign_item_from_object(itemp, value) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); @@ -9321,7 +9613,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview return __pyx_r; } -/* "View.MemoryView":458 +/* "View.MemoryView":459 * return result * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -9353,19 +9645,19 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":461 + /* "View.MemoryView":462 * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" * import struct # <<<<<<<<<<<<<< * cdef char c * cdef bytes bytesvalue */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":466 + /* "View.MemoryView":467 * cdef Py_ssize_t i * * if isinstance(value, tuple): # <<<<<<<<<<<<<< @@ -9376,69 +9668,69 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "View.MemoryView":467 + /* "View.MemoryView":468 * * if isinstance(value, tuple): * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< * else: * bytesvalue = struct.pack(self.view.format, value) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_6 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":469 + /* "View.MemoryView":470 * bytesvalue = struct.pack(self.view.format, *value) * else: * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< * * for i, c in enumerate(bytesvalue): */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_bytesvalue = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; } __pyx_L3:; - /* "View.MemoryView":471 + /* "View.MemoryView":472 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< @@ -9446,11 +9738,11 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie * */ __pyx_t_7 = 0; - if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) { + if (unlikely(__pyx_v_bytesvalue == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue)); + __Pyx_INCREF(__pyx_v_bytesvalue); __pyx_t_8 = __pyx_v_bytesvalue; __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8); __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8)); @@ -9458,7 +9750,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __pyx_t_9 = __pyx_t_12; __pyx_v_c = (__pyx_t_9[0]); - /* "View.MemoryView":472 + /* "View.MemoryView":473 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< @@ -9467,7 +9759,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ __pyx_v_i = __pyx_t_7; - /* "View.MemoryView":471 + /* "View.MemoryView":472 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< @@ -9476,7 +9768,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ __pyx_t_7 = (__pyx_t_7 + 1); - /* "View.MemoryView":472 + /* "View.MemoryView":473 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< @@ -9485,8 +9777,17 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c; } - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "View.MemoryView":459 + * return result + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * """Only used if instantiated manually by the user, or if Cython doesn't + * know how to convert the type""" + */ + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -9494,7 +9795,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(((PyObject *)__pyx_t_8)); + __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -9505,6 +9806,14 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie return __pyx_r; } +/* "View.MemoryView":476 + * + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< + * if flags & PyBUF_STRIDES: + * info.shape = self.view.shape + */ + /* Python wrapper */ static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { @@ -9512,18 +9821,12 @@ static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_b __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":475 - * - * @cname('getbuffer') - * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< - * if flags & PyBUF_STRIDES: - * info.shape = self.view.shape - */ - static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -9539,7 +9842,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "View.MemoryView":476 + /* "View.MemoryView":477 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< @@ -9549,7 +9852,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); if (__pyx_t_1) { - /* "View.MemoryView":477 + /* "View.MemoryView":478 * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_STRIDES: * info.shape = self.view.shape # <<<<<<<<<<<<<< @@ -9562,7 +9865,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } /*else*/ { - /* "View.MemoryView":479 + /* "View.MemoryView":480 * info.shape = self.view.shape * else: * info.shape = NULL # <<<<<<<<<<<<<< @@ -9573,7 +9876,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } __pyx_L3:; - /* "View.MemoryView":481 + /* "View.MemoryView":482 * info.shape = NULL * * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< @@ -9583,7 +9886,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); if (__pyx_t_1) { - /* "View.MemoryView":482 + /* "View.MemoryView":483 * * if flags & PyBUF_STRIDES: * info.strides = self.view.strides # <<<<<<<<<<<<<< @@ -9596,7 +9899,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } /*else*/ { - /* "View.MemoryView":484 + /* "View.MemoryView":485 * info.strides = self.view.strides * else: * info.strides = NULL # <<<<<<<<<<<<<< @@ -9607,7 +9910,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } __pyx_L4:; - /* "View.MemoryView":486 + /* "View.MemoryView":487 * info.strides = NULL * * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< @@ -9617,7 +9920,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":487 + /* "View.MemoryView":488 * * if flags & PyBUF_INDIRECT: * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< @@ -9630,7 +9933,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } /*else*/ { - /* "View.MemoryView":489 + /* "View.MemoryView":490 * info.suboffsets = self.view.suboffsets * else: * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -9641,7 +9944,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } __pyx_L5:; - /* "View.MemoryView":491 + /* "View.MemoryView":492 * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -9651,7 +9954,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":492 + /* "View.MemoryView":493 * * if flags & PyBUF_FORMAT: * info.format = self.view.format # <<<<<<<<<<<<<< @@ -9664,7 +9967,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } /*else*/ { - /* "View.MemoryView":494 + /* "View.MemoryView":495 * info.format = self.view.format * else: * info.format = NULL # <<<<<<<<<<<<<< @@ -9675,7 +9978,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str } __pyx_L6:; - /* "View.MemoryView":496 + /* "View.MemoryView":497 * info.format = NULL * * info.buf = self.view.buf # <<<<<<<<<<<<<< @@ -9685,7 +9988,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_4 = __pyx_v_self->view.buf; __pyx_v_info->buf = __pyx_t_4; - /* "View.MemoryView":497 + /* "View.MemoryView":498 * * info.buf = self.view.buf * info.ndim = self.view.ndim # <<<<<<<<<<<<<< @@ -9695,7 +9998,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_5 = __pyx_v_self->view.ndim; __pyx_v_info->ndim = __pyx_t_5; - /* "View.MemoryView":498 + /* "View.MemoryView":499 * info.buf = self.view.buf * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< @@ -9705,7 +10008,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_6 = __pyx_v_self->view.itemsize; __pyx_v_info->itemsize = __pyx_t_6; - /* "View.MemoryView":499 + /* "View.MemoryView":500 * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize * info.len = self.view.len # <<<<<<<<<<<<<< @@ -9715,7 +10018,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __pyx_t_6 = __pyx_v_self->view.len; __pyx_v_info->len = __pyx_t_6; - /* "View.MemoryView":500 + /* "View.MemoryView":501 * info.itemsize = self.view.itemsize * info.len = self.view.len * info.readonly = 0 # <<<<<<<<<<<<<< @@ -9724,7 +10027,7 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str */ __pyx_v_info->readonly = 0; - /* "View.MemoryView":501 + /* "View.MemoryView":502 * info.len = self.view.len * info.readonly = 0 * info.obj = self # <<<<<<<<<<<<<< @@ -9737,6 +10040,15 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + /* "View.MemoryView":476 + * + * @cname('getbuffer') + * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< + * if flags & PyBUF_STRIDES: + * info.shape = self.view.shape + */ + + /* function exit code */ __pyx_r = 0; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); @@ -9746,6 +10058,14 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str return __pyx_r; } +/* "View.MemoryView":509 + * property T: + * @cname('__pyx_memoryview_transpose') + * def __get__(self): # <<<<<<<<<<<<<< + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self) { @@ -9753,18 +10073,12 @@ static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":508 - * property T: - * @cname('__pyx_memoryview_transpose') - * def __get__(self): # <<<<<<<<<<<<<< - * cdef _memoryviewslice result = memoryview_copy(self) - * transpose_memslice(&result.from_slice) - */ - static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) { struct __pyx_memoryviewslice_obj *__pyx_v_result = 0; PyObject *__pyx_r = NULL; @@ -9776,29 +10090,29 @@ static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":509 + /* "View.MemoryView":510 * @cname('__pyx_memoryview_transpose') * def __get__(self): * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< * transpose_memslice(&result.from_slice) * return result */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":510 + /* "View.MemoryView":511 * def __get__(self): * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":511 + /* "View.MemoryView":512 * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) * return result # <<<<<<<<<<<<<< @@ -9810,8 +10124,15 @@ static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(s __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":509 + * property T: + * @cname('__pyx_memoryview_transpose') + * def __get__(self): # <<<<<<<<<<<<<< + * cdef _memoryviewslice result = memoryview_copy(self) + * transpose_memslice(&result.from_slice) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -9823,6 +10144,14 @@ static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(s return __pyx_r; } +/* "View.MemoryView":516 + * property base: + * @cname('__pyx_memoryview__get__base') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.obj + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self) { @@ -9830,24 +10159,18 @@ static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":515 - * property base: - * @cname('__pyx_memoryview__get__base') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.obj - * - */ - static PyObject *__pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":516 + /* "View.MemoryView":517 * @cname('__pyx_memoryview__get__base') * def __get__(self): * return self.obj # <<<<<<<<<<<<<< @@ -9859,13 +10182,29 @@ static PyObject *__pyx_memoryview__get__base_MemoryView_10memoryview_4base___get __pyx_r = __pyx_v_self->obj; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "View.MemoryView":516 + * property base: + * @cname('__pyx_memoryview__get__base') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.obj + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "View.MemoryView":521 + * property shape: + * @cname('__pyx_memoryview_get_shape') + * def __get__(self): # <<<<<<<<<<<<<< + * return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self) { @@ -9873,18 +10212,12 @@ static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":520 - * property shape: - * @cname('__pyx_memoryview_get_shape') - * def __get__(self): # <<<<<<<<<<<<<< - * return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) - * - */ - static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) { int __pyx_v_i; PyObject *__pyx_r = NULL; @@ -9898,7 +10231,7 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":521 + /* "View.MemoryView":522 * @cname('__pyx_memoryview_get_shape') * def __get__(self): * return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<< @@ -9906,25 +10239,32 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get * property strides: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_v_self->view.ndim; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_t_4 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_1))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":521 + * property shape: + * @cname('__pyx_memoryview_get_shape') + * def __get__(self): # <<<<<<<<<<<<<< + * return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); @@ -9936,6 +10276,14 @@ static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get return __pyx_r; } +/* "View.MemoryView":526 + * property strides: + * @cname('__pyx_memoryview_get_strides') + * def __get__(self): # <<<<<<<<<<<<<< + * if self.view.strides == NULL: + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self) { @@ -9943,18 +10291,12 @@ static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":525 - * property strides: - * @cname('__pyx_memoryview_get_strides') - * def __get__(self): # <<<<<<<<<<<<<< - * if self.view.strides == NULL: - * - */ - static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) { int __pyx_v_i; PyObject *__pyx_r = NULL; @@ -9969,7 +10311,7 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":526 + /* "View.MemoryView":527 * @cname('__pyx_memoryview_get_strides') * def __get__(self): * if self.view.strides == NULL: # <<<<<<<<<<<<<< @@ -9979,23 +10321,21 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__ __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":528 + /* "View.MemoryView":529 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([self.view.strides[i] for i in xrange(self.view.ndim)]) */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "View.MemoryView":530 + /* "View.MemoryView":531 * raise ValueError("Buffer view does not expose strides") * * return tuple([self.view.strides[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<< @@ -10003,25 +10343,32 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__ * property suboffsets: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_v_self->view.ndim; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":526 + * property strides: + * @cname('__pyx_memoryview_get_strides') + * def __get__(self): # <<<<<<<<<<<<<< + * if self.view.strides == NULL: + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); @@ -10033,6 +10380,14 @@ static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides__ return __pyx_r; } +/* "View.MemoryView":535 + * property suboffsets: + * @cname('__pyx_memoryview_get_suboffsets') + * def __get__(self): # <<<<<<<<<<<<<< + * if self.view.suboffsets == NULL: + * return [-1] * self.view.ndim + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self) { @@ -10040,18 +10395,12 @@ static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":534 - * property suboffsets: - * @cname('__pyx_memoryview_get_suboffsets') - * def __get__(self): # <<<<<<<<<<<<<< - * if self.view.suboffsets == NULL: - * return [-1] * self.view.ndim - */ - static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) { int __pyx_v_i; PyObject *__pyx_r = NULL; @@ -10066,7 +10415,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":535 + /* "View.MemoryView":536 * @cname('__pyx_memoryview_get_suboffsets') * def __get__(self): * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< @@ -10076,7 +10425,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":536 + /* "View.MemoryView":537 * def __get__(self): * if self.view.suboffsets == NULL: * return [-1] * self.view.ndim # <<<<<<<<<<<<<< @@ -10084,7 +10433,7 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof * return tuple([self.view.suboffsets[i] for i in xrange(self.view.ndim)]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(1 * ((__pyx_v_self->view.ndim<0) ? 0:__pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1 * ((__pyx_v_self->view.ndim<0) ? 0:__pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_self->view.ndim; __pyx_temp++) { @@ -10093,14 +10442,12 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof __Pyx_GIVEREF(__pyx_int_neg_1); } } - __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "View.MemoryView":538 + /* "View.MemoryView":539 * return [-1] * self.view.ndim * * return tuple([self.view.suboffsets[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<< @@ -10108,25 +10455,32 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof * property ndim: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_v_self->view.ndim; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_t_5 = ((PyObject *)PyList_AsTuple(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":535 + * property suboffsets: + * @cname('__pyx_memoryview_get_suboffsets') + * def __get__(self): # <<<<<<<<<<<<<< + * if self.view.suboffsets == NULL: + * return [-1] * self.view.ndim + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); @@ -10138,6 +10492,14 @@ static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10subof return __pyx_r; } +/* "View.MemoryView":543 + * property ndim: + * @cname('__pyx_memoryview_get_ndim') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.view.ndim + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self) { @@ -10145,18 +10507,12 @@ static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":542 - * property ndim: - * @cname('__pyx_memoryview_get_ndim') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.view.ndim - * - */ - static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10166,7 +10522,7 @@ static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":543 + /* "View.MemoryView":544 * @cname('__pyx_memoryview_get_ndim') * def __get__(self): * return self.view.ndim # <<<<<<<<<<<<<< @@ -10174,14 +10530,21 @@ static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__ * property itemsize: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":543 + * property ndim: + * @cname('__pyx_memoryview_get_ndim') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.view.ndim + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10192,6 +10555,14 @@ static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__ return __pyx_r; } +/* "View.MemoryView":548 + * property itemsize: + * @cname('__pyx_memoryview_get_itemsize') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.view.itemsize + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self) { @@ -10199,18 +10570,12 @@ static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":547 - * property itemsize: - * @cname('__pyx_memoryview_get_itemsize') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.view.itemsize - * - */ - static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10220,7 +10585,7 @@ static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":548 + /* "View.MemoryView":549 * @cname('__pyx_memoryview_get_itemsize') * def __get__(self): * return self.view.itemsize # <<<<<<<<<<<<<< @@ -10228,14 +10593,21 @@ static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize * property nbytes: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":548 + * property itemsize: + * @cname('__pyx_memoryview_get_itemsize') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.view.itemsize + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10246,6 +10618,14 @@ static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize return __pyx_r; } +/* "View.MemoryView":553 + * property nbytes: + * @cname('__pyx_memoryview_get_nbytes') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.size * self.view.itemsize + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self) { @@ -10253,18 +10633,12 @@ static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":552 - * property nbytes: - * @cname('__pyx_memoryview_get_nbytes') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.size * self.view.itemsize - * - */ - static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10276,7 +10650,7 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":553 + /* "View.MemoryView":554 * @cname('__pyx_memoryview_get_nbytes') * def __get__(self): * return self.size * self.view.itemsize # <<<<<<<<<<<<<< @@ -10284,11 +10658,11 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g * property size: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -10296,8 +10670,15 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g __pyx_t_3 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":553 + * property nbytes: + * @cname('__pyx_memoryview_get_nbytes') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.size * self.view.itemsize + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -10310,6 +10691,14 @@ static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___g return __pyx_r; } +/* "View.MemoryView":558 + * property size: + * @cname('__pyx_memoryview_get_size') + * def __get__(self): # <<<<<<<<<<<<<< + * if self._size is None: + * result = 1 + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self) { @@ -10317,18 +10706,12 @@ static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":557 - * property size: - * @cname('__pyx_memoryview_get_size') - * def __get__(self): # <<<<<<<<<<<<<< - * if self._size is None: - * result = 1 - */ - static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_length = NULL; @@ -10345,7 +10728,7 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":558 + /* "View.MemoryView":559 * @cname('__pyx_memoryview_get_size') * def __get__(self): * if self._size is None: # <<<<<<<<<<<<<< @@ -10356,7 +10739,7 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":559 + /* "View.MemoryView":560 * def __get__(self): * if self._size is None: * result = 1 # <<<<<<<<<<<<<< @@ -10366,20 +10749,20 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ __Pyx_INCREF(__pyx_int_1); __pyx_v_result = __pyx_int_1; - /* "View.MemoryView":561 + /* "View.MemoryView":562 * result = 1 * * for length in self.shape: # <<<<<<<<<<<<<< * result *= length * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; } @@ -10388,23 +10771,24 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_3)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -10413,21 +10797,21 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":562 + /* "View.MemoryView":563 * * for length in self.shape: * result *= length # <<<<<<<<<<<<<< * * self._size = result */ - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":564 + /* "View.MemoryView":565 * result *= length * * self._size = result # <<<<<<<<<<<<<< @@ -10443,7 +10827,7 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ } __pyx_L3:; - /* "View.MemoryView":566 + /* "View.MemoryView":567 * self._size = result * * return self._size # <<<<<<<<<<<<<< @@ -10455,8 +10839,15 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ __pyx_r = __pyx_v_self->_size; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":558 + * property size: + * @cname('__pyx_memoryview_get_size') + * def __get__(self): # <<<<<<<<<<<<<< + * if self._size is None: + * result = 1 + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -10470,6 +10861,14 @@ static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__ return __pyx_r; } +/* "View.MemoryView":569 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] + */ + /* Python wrapper */ static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { @@ -10477,25 +10876,19 @@ static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":568 - * return self._size - * - * def __len__(self): # <<<<<<<<<<<<<< - * if self.view.ndim >= 1: - * return self.view.shape[0] - */ - static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__len__", 0); - /* "View.MemoryView":569 + /* "View.MemoryView":570 * * def __len__(self): * if self.view.ndim >= 1: # <<<<<<<<<<<<<< @@ -10505,7 +10898,7 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":570 + /* "View.MemoryView":571 * def __len__(self): * if self.view.ndim >= 1: * return self.view.shape[0] # <<<<<<<<<<<<<< @@ -10514,11 +10907,9 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py */ __pyx_r = (__pyx_v_self->view.shape[0]); goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "View.MemoryView":572 + /* "View.MemoryView":573 * return self.view.shape[0] * * return 0 # <<<<<<<<<<<<<< @@ -10528,12 +10919,28 @@ static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __py __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; + /* "View.MemoryView":569 + * return self._size + * + * def __len__(self): # <<<<<<<<<<<<<< + * if self.view.ndim >= 1: + * return self.view.shape[0] + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "View.MemoryView":575 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) + */ + /* Python wrapper */ static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { @@ -10541,18 +10948,12 @@ static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":574 - * return 0 - * - * def __repr__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__, - * id(self)) - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10564,7 +10965,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); - /* "View.MemoryView":575 + /* "View.MemoryView":576 * * def __repr__(self): * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< @@ -10572,31 +10973,39 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":576 + /* "View.MemoryView":577 * def __repr__(self): * return "" % (self.base.__class__.__name__, * id(self)) # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_id, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "View.MemoryView":576 + * + * def __repr__(self): + * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< + * id(self)) + * + */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -10604,15 +11013,22 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":575 + * return 0 + * + * def __repr__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__, + * id(self)) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -10625,6 +11041,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __py return __pyx_r; } +/* "View.MemoryView":579 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { @@ -10632,18 +11056,12 @@ static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":578 - * id(self)) - * - * def __str__(self): # <<<<<<<<<<<<<< - * return "" % (self.base.__class__.__name__,) - * - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10654,7 +11072,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "View.MemoryView":579 + /* "View.MemoryView":580 * * def __str__(self): * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< @@ -10662,28 +11080,35 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":579 + * id(self)) + * + * def __str__(self): # <<<<<<<<<<<<<< + * return "" % (self.base.__class__.__name__,) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -10695,6 +11120,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx return __pyx_r; } +/* "View.MemoryView":583 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -10702,18 +11135,12 @@ static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNU __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":582 - * - * - * def is_c_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice, tmp - * mslice = get_slice_from_memview(self, &tmp) - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice *__pyx_v_mslice; __Pyx_memviewslice __pyx_v_tmp; @@ -10725,31 +11152,38 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_c_contig", 0); - /* "View.MemoryView":584 - * def is_c_contig(self): - * cdef __Pyx_memviewslice *mslice, tmp + /* "View.MemoryView":586 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< * return slice_is_contig(mslice, 'C', self.view.ndim) * */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); - /* "View.MemoryView":585 - * cdef __Pyx_memviewslice *mslice, tmp + /* "View.MemoryView":587 + * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice, 'C', self.view.ndim) # <<<<<<<<<<<<<< * * def is_f_contig(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":583 + * + * + * def is_c_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10760,6 +11194,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct _ return __pyx_r; } +/* "View.MemoryView":589 + * return slice_is_contig(mslice, 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -10767,18 +11209,12 @@ static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNU __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":587 - * return slice_is_contig(mslice, 'C', self.view.ndim) - * - * def is_f_contig(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice *mslice, tmp - * mslice = get_slice_from_memview(self, &tmp) - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice *__pyx_v_mslice; __Pyx_memviewslice __pyx_v_tmp; @@ -10790,31 +11226,38 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_f_contig", 0); - /* "View.MemoryView":589 - * def is_f_contig(self): - * cdef __Pyx_memviewslice *mslice, tmp + /* "View.MemoryView":592 + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< * return slice_is_contig(mslice, 'F', self.view.ndim) * */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); - /* "View.MemoryView":590 - * cdef __Pyx_memviewslice *mslice, tmp + /* "View.MemoryView":593 + * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice, 'F', self.view.ndim) # <<<<<<<<<<<<<< * * def copy(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":589 + * return slice_is_contig(mslice, 'C', self.view.ndim) + * + * def is_f_contig(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice *mslice + * cdef __Pyx_memviewslice tmp + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10825,6 +11268,14 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct _ return __pyx_r; } +/* "View.MemoryView":595 + * return slice_is_contig(mslice, 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + */ + /* Python wrapper */ static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -10832,18 +11283,12 @@ static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("copy (wrapper)", 0); __pyx_r = __pyx_memoryview_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":592 - * return slice_is_contig(mslice, 'F', self.view.ndim) - * - * def copy(self): # <<<<<<<<<<<<<< - * cdef __Pyx_memviewslice mslice - * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS - */ - static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice __pyx_v_mslice; int __pyx_v_flags; @@ -10856,7 +11301,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy", 0); - /* "View.MemoryView":594 + /* "View.MemoryView":597 * def copy(self): * cdef __Pyx_memviewslice mslice * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< @@ -10865,7 +11310,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "View.MemoryView":596 + /* "View.MemoryView":599 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS * * slice_copy(self, &mslice) # <<<<<<<<<<<<<< @@ -10875,16 +11320,16 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); /* "View.MemoryView":600 + * + * slice_copy(self, &mslice) + * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_C_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * - * return memoryview_copy_from_slice(self, &mslice) */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), __pyx_k__c, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), __pyx_k_c, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_mslice = __pyx_t_1; - /* "View.MemoryView":602 + /* "View.MemoryView":605 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< @@ -10892,14 +11337,21 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me * def copy_fortran(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":595 + * return slice_is_contig(mslice, 'F', self.view.ndim) + * + * def copy(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice mslice + * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10910,18 +11362,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_me return __pyx_r; } -/* Python wrapper */ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); - __pyx_r = __pyx_memoryview_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "View.MemoryView":604 +/* "View.MemoryView":607 * return memoryview_copy_from_slice(self, &mslice) * * def copy_fortran(self): # <<<<<<<<<<<<<< @@ -10929,6 +11370,19 @@ static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UN * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS */ +/* Python wrapper */ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0); + __pyx_r = __pyx_memoryview_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) { __Pyx_memviewslice __pyx_v_src; __Pyx_memviewslice __pyx_v_dst; @@ -10942,7 +11396,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy_fortran", 0); - /* "View.MemoryView":606 + /* "View.MemoryView":609 * def copy_fortran(self): * cdef __Pyx_memviewslice src, dst * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< @@ -10951,7 +11405,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - /* "View.MemoryView":608 + /* "View.MemoryView":611 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS * * slice_copy(self, &src) # <<<<<<<<<<<<<< @@ -10961,16 +11415,16 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); /* "View.MemoryView":612 + * + * slice_copy(self, &src) + * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_F_CONTIGUOUS, - * self.dtype_is_object) # <<<<<<<<<<<<<< - * - * return memoryview_copy_from_slice(self, &dst) */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), __pyx_k__fortran, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), __pyx_k_fortran, __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_dst = __pyx_t_1; - /* "View.MemoryView":614 + /* "View.MemoryView":617 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< @@ -10978,14 +11432,21 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":607 + * return memoryview_copy_from_slice(self, &mslice) + * + * def copy_fortran(self): # <<<<<<<<<<<<<< + * cdef __Pyx_memviewslice src, dst + * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -10996,7 +11457,7 @@ static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct return __pyx_r; } -/* "View.MemoryView":618 +/* "View.MemoryView":621 * * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< @@ -11016,18 +11477,18 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - /* "View.MemoryView":619 + /* "View.MemoryView":622 * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< * result.typeinfo = typeinfo * return result */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_o); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); @@ -11038,13 +11499,13 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":620 + /* "View.MemoryView":623 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo # <<<<<<<<<<<<<< @@ -11053,7 +11514,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in */ __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "View.MemoryView":621 + /* "View.MemoryView":624 * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo * return result # <<<<<<<<<<<<<< @@ -11065,8 +11526,15 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":621 + * + * @cname('__pyx_memoryview_new') + * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< + * cdef memoryview result = memoryview(o, flags, dtype_is_object) + * result.typeinfo = typeinfo + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -11080,7 +11548,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in return __pyx_r; } -/* "View.MemoryView":624 +/* "View.MemoryView":627 * * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< @@ -11094,7 +11562,7 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { int __pyx_t_1; __Pyx_RefNannySetupContext("memoryview_check", 0); - /* "View.MemoryView":625 + /* "View.MemoryView":628 * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): * return isinstance(o, memoryview) # <<<<<<<<<<<<<< @@ -11105,13 +11573,21 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { __pyx_r = __pyx_t_1; goto __pyx_L0; - __pyx_r = 0; + /* "View.MemoryView":627 + * + * @cname('__pyx_memoryview_check') + * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< + * return isinstance(o, memoryview) + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":627 +/* "View.MemoryView":630 * return isinstance(o, memoryview) * * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< @@ -11122,11 +11598,11 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { PyObject *__pyx_v_tup = NULL; PyObject *__pyx_v_result = NULL; - PyObject *__pyx_v_have_slices = NULL; + int __pyx_v_have_slices; int __pyx_v_seen_ellipsis; CYTHON_UNUSED PyObject *__pyx_v_idx = NULL; PyObject *__pyx_v_item = NULL; - PyObject *__pyx_v_nslices = NULL; + Py_ssize_t __pyx_v_nslices; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -11136,17 +11612,16 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { Py_ssize_t __pyx_t_5; PyObject *(*__pyx_t_6)(PyObject *); PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; int __pyx_t_11; - int __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_unellipsify", 0); - /* "View.MemoryView":632 + /* "View.MemoryView":635 * full slices. * """ * if not isinstance(index, tuple): # <<<<<<<<<<<<<< @@ -11157,25 +11632,25 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":633 + /* "View.MemoryView":636 * """ * if not isinstance(index, tuple): * tup = (index,) # <<<<<<<<<<<<<< * else: * tup = index */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_index); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index); __Pyx_GIVEREF(__pyx_v_index); - __pyx_v_tup = ((PyObject *)__pyx_t_3); + __pyx_v_tup = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":635 + /* "View.MemoryView":638 * tup = (index,) * else: * tup = index # <<<<<<<<<<<<<< @@ -11187,31 +11662,28 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { } __pyx_L3:; - /* "View.MemoryView":637 + /* "View.MemoryView":640 * tup = index * * result = [] # <<<<<<<<<<<<<< * have_slices = False * seen_ellipsis = False */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_result = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":638 + /* "View.MemoryView":641 * * result = [] * have_slices = False # <<<<<<<<<<<<<< * seen_ellipsis = False * for idx, item in enumerate(tup): */ - __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_have_slices = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_have_slices = 0; - /* "View.MemoryView":639 + /* "View.MemoryView":642 * result = [] * have_slices = False * seen_ellipsis = False # <<<<<<<<<<<<<< @@ -11220,7 +11692,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_seen_ellipsis = 0; - /* "View.MemoryView":640 + /* "View.MemoryView":643 * have_slices = False * seen_ellipsis = False * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< @@ -11233,7 +11705,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; } @@ -11241,23 +11713,24 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_7 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_7)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -11267,13 +11740,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_7; __pyx_t_7 = 0; - /* "View.MemoryView":641 + /* "View.MemoryView":644 * seen_ellipsis = False * for idx, item in enumerate(tup): * if item is Ellipsis: # <<<<<<<<<<<<<< @@ -11284,7 +11757,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":642 + /* "View.MemoryView":645 * for idx, item in enumerate(tup): * if item is Ellipsis: * if not seen_ellipsis: # <<<<<<<<<<<<<< @@ -11294,40 +11767,30 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); if (__pyx_t_1) { - /* "View.MemoryView":643 + /* "View.MemoryView":646 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_9) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_9) + 1))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); { Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_9) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_t_8); - PyList_SET_ITEM(__pyx_t_10, __pyx_temp, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); + for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { + __Pyx_INCREF(__pyx_t_7); + PyList_SET_ITEM(__pyx_t_9, __pyx_temp, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); } } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "View.MemoryView":644 + /* "View.MemoryView":647 * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) * seen_ellipsis = True # <<<<<<<<<<<<<< @@ -11339,36 +11802,33 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { } /*else*/ { - /* "View.MemoryView":646 + /* "View.MemoryView":649 * seen_ellipsis = True * else: * result.append(slice(None)) # <<<<<<<<<<<<<< * have_slices = True * else: */ - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __pyx_L7:; - /* "View.MemoryView":647 + /* "View.MemoryView":650 * else: * result.append(slice(None)) * have_slices = True # <<<<<<<<<<<<<< * else: * if not isinstance(item, slice) and not PyIndex_Check(item): */ - __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_10); - __pyx_t_10 = 0; + __pyx_v_have_slices = 1; goto __pyx_L6; } /*else*/ { - /* "View.MemoryView":649 + /* "View.MemoryView":652 * have_slices = True * else: * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< @@ -11379,182 +11839,170 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { __pyx_t_1 = ((!(__Pyx_PyIndex_Check(__pyx_v_item) != 0)) != 0); - __pyx_t_12 = __pyx_t_1; + __pyx_t_11 = __pyx_t_1; } else { - __pyx_t_12 = __pyx_t_2; + __pyx_t_11 = __pyx_t_2; } - if (__pyx_t_12) { + if (__pyx_t_11) { - /* "View.MemoryView":650 + /* "View.MemoryView":653 * else: * if not isinstance(item, slice) and not PyIndex_Check(item): * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< * * have_slices = have_slices or isinstance(item, slice) */ - __pyx_t_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_10)); - __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L8:; - /* "View.MemoryView":652 + /* "View.MemoryView":655 * raise TypeError("Cannot index with type '%s'" % type(item)) * * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< * result.append(item) * */ - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_12) { - __pyx_t_12 = PySlice_Check(__pyx_v_item); - __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __pyx_t_10; - __pyx_t_10 = 0; + if (!__pyx_v_have_slices) { + __pyx_t_11 = PySlice_Check(__pyx_v_item); + __pyx_t_2 = __pyx_t_11; } else { - __Pyx_INCREF(__pyx_v_have_slices); - __pyx_t_8 = __pyx_v_have_slices; + __pyx_t_2 = __pyx_v_have_slices; } - __Pyx_DECREF_SET(__pyx_v_have_slices, __pyx_t_8); - __pyx_t_8 = 0; + __pyx_v_have_slices = __pyx_t_2; - /* "View.MemoryView":653 + /* "View.MemoryView":656 * * have_slices = have_slices or isinstance(item, slice) * result.append(item) # <<<<<<<<<<<<<< * * nslices = ndim - len(result) */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L6:; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":655 + /* "View.MemoryView":658 * result.append(item) * * nslices = ndim - len(result) # <<<<<<<<<<<<<< * if nslices: * result.extend([slice(None)] * nslices) */ - __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_nslices = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); - /* "View.MemoryView":656 + /* "View.MemoryView":659 * * nslices = ndim - len(result) * if nslices: # <<<<<<<<<<<<<< * result.extend([slice(None)] * nslices) * */ - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_nslices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_12) { + __pyx_t_2 = (__pyx_v_nslices != 0); + if (__pyx_t_2) { - /* "View.MemoryView":657 + /* "View.MemoryView":660 * nslices = ndim - len(result) * if nslices: * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< * * return have_slices or nslices, tuple(result) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_v_nslices); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_temp); - __Pyx_DECREF(__pyx_t_8); - __pyx_t_8 = __pyx_temp; + { Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { + __Pyx_INCREF(__pyx_t_3); + PyList_SET_ITEM(__pyx_t_4, __pyx_temp, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + } } - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_4); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L9; } __pyx_L9:; - /* "View.MemoryView":659 + /* "View.MemoryView":662 * result.extend([slice(None)] * nslices) * * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): */ - __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_12) { - __Pyx_INCREF(__pyx_v_nslices); - __pyx_t_8 = __pyx_v_nslices; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_2) { + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __pyx_t_3; + __pyx_t_3 = 0; } else { - __Pyx_INCREF(__pyx_v_have_slices); - __pyx_t_8 = __pyx_v_have_slices; + __pyx_t_9 = __pyx_t_4; + __pyx_t_4 = 0; } - __pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_8 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_9 = 0; __pyx_t_4 = 0; __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":630 + * return isinstance(o, memoryview) + * + * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< + * """ + * Replace all ellipses with full slices and fill incomplete indices with + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tup); __Pyx_XDECREF(__pyx_v_result); - __Pyx_XDECREF(__pyx_v_have_slices); __Pyx_XDECREF(__pyx_v_idx); __Pyx_XDECREF(__pyx_v_item); - __Pyx_XDECREF(__pyx_v_nslices); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":661 +/* "View.MemoryView":664 * return have_slices or nslices, tuple(result) * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< @@ -11575,7 +12023,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - /* "View.MemoryView":663 + /* "View.MemoryView":666 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * cdef int i * for i in range(ndim): # <<<<<<<<<<<<<< @@ -11586,7 +12034,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":664 + /* "View.MemoryView":667 * cdef int i * for i in range(ndim): * if suboffsets[i] >= 0: # <<<<<<<<<<<<<< @@ -11596,23 +12044,30 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ __pyx_t_3 = (((__pyx_v_suboffsets[__pyx_v_i]) >= 0) != 0); if (__pyx_t_3) { - /* "View.MemoryView":665 + /* "View.MemoryView":668 * for i in range(ndim): * if suboffsets[i] >= 0: * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L5:; } + /* "View.MemoryView":664 + * return have_slices or nslices, tuple(result) + * + * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< + * cdef int i + * for i in range(ndim): + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -11625,7 +12080,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ return __pyx_r; } -/* "View.MemoryView":672 +/* "View.MemoryView":675 * * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< @@ -11654,10 +12109,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - struct __pyx_memoryview_obj *__pyx_t_3; - char *__pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_3 = NULL; + struct __pyx_memoryview_obj *__pyx_t_4; + char *__pyx_t_5; + int __pyx_t_6; Py_ssize_t __pyx_t_7; PyObject *(*__pyx_t_8)(PyObject *); PyObject *__pyx_t_9 = NULL; @@ -11669,7 +12124,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memview_slice", 0); - /* "View.MemoryView":673 + /* "View.MemoryView":676 * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< @@ -11679,7 +12134,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_v_new_ndim = 0; __pyx_v_suboffset_dim = -1; - /* "View.MemoryView":680 + /* "View.MemoryView":683 * * * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< @@ -11688,7 +12143,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))); - /* "View.MemoryView":684 + /* "View.MemoryView":687 * cdef _memoryviewslice memviewsliceobj * * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< @@ -11696,13 +12151,15 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * if isinstance(memview, _memoryviewslice): */ #ifndef CYTHON_WITHOUT_ASSERTIONS - if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { - PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!Py_OptimizeFlag)) { + if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { + PyErr_SetNone(PyExc_AssertionError); + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } #endif - /* "View.MemoryView":686 + /* "View.MemoryView":689 * assert memview.view.ndim > 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -11713,18 +12170,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":687 + /* "View.MemoryView":690 * * if isinstance(memview, _memoryviewslice): * memviewsliceobj = memview # <<<<<<<<<<<<<< * p_src = &memviewsliceobj.from_slice * else: */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(((PyObject *)__pyx_v_memview)); - __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview); + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":688 + /* "View.MemoryView":691 * if isinstance(memview, _memoryviewslice): * memviewsliceobj = memview * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< @@ -11736,7 +12195,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } /*else*/ { - /* "View.MemoryView":690 + /* "View.MemoryView":693 * p_src = &memviewsliceobj.from_slice * else: * slice_copy(memview, &src) # <<<<<<<<<<<<<< @@ -11745,7 +12204,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* "View.MemoryView":691 + /* "View.MemoryView":694 * else: * slice_copy(memview, &src) * p_src = &src # <<<<<<<<<<<<<< @@ -11756,27 +12215,27 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __pyx_L3:; - /* "View.MemoryView":697 + /* "View.MemoryView":700 * * * dst.memview = p_src.memview # <<<<<<<<<<<<<< * dst.data = p_src.data * */ - __pyx_t_3 = __pyx_v_p_src->memview; - __pyx_v_dst.memview = __pyx_t_3; + __pyx_t_4 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_4; - /* "View.MemoryView":698 + /* "View.MemoryView":701 * * dst.memview = p_src.memview * dst.data = p_src.data # <<<<<<<<<<<<<< * * */ - __pyx_t_4 = __pyx_v_p_src->data; - __pyx_v_dst.data = __pyx_t_4; + __pyx_t_5 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_5; - /* "View.MemoryView":703 + /* "View.MemoryView":706 * * * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< @@ -11785,7 +12244,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_dst = (&__pyx_v_dst); - /* "View.MemoryView":704 + /* "View.MemoryView":707 * * cdef __Pyx_memviewslice *p_dst = &dst * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< @@ -11794,43 +12253,44 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "View.MemoryView":708 + /* "View.MemoryView":711 * cdef bint have_start, have_stop, have_step * * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< * if PyIndex_Check(index): * slice_memviewslice( */ - __pyx_t_5 = 0; + __pyx_t_6 = 0; if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_6 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; + __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; } for (;;) { - if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_6)) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; + if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_6)) { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { - __pyx_t_9 = __pyx_t_8(__pyx_t_6); + __pyx_t_9 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_9)) { - if (PyErr_Occurred()) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -11838,10 +12298,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9); __pyx_t_9 = 0; - __pyx_v_dim = __pyx_t_5; - __pyx_t_5 = (__pyx_t_5 + 1); + __pyx_v_dim = __pyx_t_6; + __pyx_t_6 = (__pyx_t_6 + 1); - /* "View.MemoryView":709 + /* "View.MemoryView":712 * * for dim, index in enumerate(indices): * if PyIndex_Check(index): # <<<<<<<<<<<<<< @@ -11851,27 +12311,27 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_2 = (__Pyx_PyIndex_Check(__pyx_v_index) != 0); if (__pyx_t_2) { - /* "View.MemoryView":713 + /* "View.MemoryView":716 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], * dim, new_ndim, p_suboffset_dim, * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< * 0, 0, 0, # have_{start,stop,step} * False) */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":715 - * index, 0, 0, # start, stop, step - * 0, 0, 0, # have_{start,stop,step} - * False) # <<<<<<<<<<<<<< - * elif index is None: - * p_dst.shape[new_ndim] = 1 + /* "View.MemoryView":713 + * for dim, index in enumerate(indices): + * if PyIndex_Check(index): + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } - /* "View.MemoryView":716 + /* "View.MemoryView":719 * 0, 0, 0, # have_{start,stop,step} * False) * elif index is None: # <<<<<<<<<<<<<< @@ -11882,7 +12342,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":717 + /* "View.MemoryView":720 * False) * elif index is None: * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< @@ -11891,7 +12351,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - /* "View.MemoryView":718 + /* "View.MemoryView":721 * elif index is None: * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< @@ -11900,7 +12360,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "View.MemoryView":719 + /* "View.MemoryView":722 * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< @@ -11909,7 +12369,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1; - /* "View.MemoryView":720 + /* "View.MemoryView":723 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 * new_ndim += 1 # <<<<<<<<<<<<<< @@ -11921,16 +12381,16 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } /*else*/ { - /* "View.MemoryView":722 + /* "View.MemoryView":725 * new_ndim += 1 * else: * start = index.start or 0 # <<<<<<<<<<<<<< * stop = index.stop or 0 * step = index.step or 0 */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_INCREF(__pyx_int_0); @@ -11939,20 +12399,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_12 = __pyx_t_9; __pyx_t_9 = 0; } - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_v_start = __pyx_t_10; - /* "View.MemoryView":723 + /* "View.MemoryView":726 * else: * start = index.start or 0 * stop = index.stop or 0 # <<<<<<<<<<<<<< * step = index.step or 0 * */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_INCREF(__pyx_int_0); @@ -11961,20 +12421,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_9 = __pyx_t_12; __pyx_t_12 = 0; } - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_stop = __pyx_t_10; - /* "View.MemoryView":724 + /* "View.MemoryView":727 * start = index.start or 0 * stop = index.stop or 0 * step = index.step or 0 # <<<<<<<<<<<<<< * * have_start = index.start is not None */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_INCREF(__pyx_int_0); @@ -11983,59 +12443,59 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_12 = __pyx_t_9; __pyx_t_9 = 0; } - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_12); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_v_step = __pyx_t_10; - /* "View.MemoryView":726 + /* "View.MemoryView":729 * step = index.step or 0 * * have_start = index.start is not None # <<<<<<<<<<<<<< * have_stop = index.stop is not None * have_step = index.step is not None */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_1 = (__pyx_t_12 != Py_None); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_v_have_start = __pyx_t_1; - /* "View.MemoryView":727 + /* "View.MemoryView":730 * * have_start = index.start is not None * have_stop = index.stop is not None # <<<<<<<<<<<<<< * have_step = index.step is not None * */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_1 = (__pyx_t_12 != Py_None); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_v_have_stop = __pyx_t_1; - /* "View.MemoryView":728 + /* "View.MemoryView":731 * have_start = index.start is not None * have_stop = index.stop is not None * have_step = index.step is not None # <<<<<<<<<<<<<< * * slice_memviewslice( */ - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_1 = (__pyx_t_12 != Py_None); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_v_have_step = __pyx_t_1; - /* "View.MemoryView":735 - * start, stop, step, - * have_start, have_stop, have_step, - * True) # <<<<<<<<<<<<<< - * new_ndim += 1 + /* "View.MemoryView":733 + * have_step = index.step is not None * + * slice_memviewslice( # <<<<<<<<<<<<<< + * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], + * dim, new_ndim, p_suboffset_dim, */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":736 + /* "View.MemoryView":739 * have_start, have_stop, have_step, * True) * new_ndim += 1 # <<<<<<<<<<<<<< @@ -12046,9 +12506,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __pyx_L6:; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":738 + /* "View.MemoryView":741 * new_ndim += 1 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -12059,7 +12519,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":739 + /* "View.MemoryView":742 * * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< @@ -12068,33 +12528,32 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - /* "View.MemoryView":740 + /* "View.MemoryView":743 * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< * memviewsliceobj.to_dtype_func, * memview.dtype_is_object) */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } /* "View.MemoryView":742 + * + * if isinstance(memview, _memoryviewslice): + * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< * memviewsliceobj.to_object_func, * memviewsliceobj.to_dtype_func, - * memview.dtype_is_object) # <<<<<<<<<<<<<< - * else: - * return memoryview_fromslice(dst, new_ndim, NULL, NULL, */ - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; - goto __pyx_L7; } /*else*/ { - /* "View.MemoryView":744 + /* "View.MemoryView":747 * memview.dtype_is_object) * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< @@ -12103,26 +12562,40 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - /* "View.MemoryView":745 + /* "View.MemoryView":748 * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "View.MemoryView":747 + * memview.dtype_is_object) + * else: + * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< + * memview.dtype_is_object) + * + */ + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; } - __pyx_L7:; - __pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":675 + * + * @cname('__pyx_memview_slice') + * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< + * cdef int new_ndim = 0, suboffset_dim = -1, dim + * cdef bint negative_step + */ + + /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -12135,7 +12608,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ return __pyx_r; } -/* "View.MemoryView":769 +/* "View.MemoryView":772 * * @cname('__pyx_memoryview_slice_memviewslice') * cdef int slice_memviewslice( # <<<<<<<<<<<<<< @@ -12155,7 +12628,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, const char *__pyx_filename = NULL; int __pyx_clineno = 0; - /* "View.MemoryView":789 + /* "View.MemoryView":792 * cdef bint negative_step * * if not is_slice: # <<<<<<<<<<<<<< @@ -12165,7 +12638,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); if (__pyx_t_1) { - /* "View.MemoryView":791 + /* "View.MemoryView":794 * if not is_slice: * * if start < 0: # <<<<<<<<<<<<<< @@ -12175,7 +12648,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_1 = ((__pyx_v_start < 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":792 + /* "View.MemoryView":795 * * if start < 0: * start += shape # <<<<<<<<<<<<<< @@ -12187,7 +12660,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L4:; - /* "View.MemoryView":793 + /* "View.MemoryView":796 * if start < 0: * start += shape * if not 0 <= start < shape: # <<<<<<<<<<<<<< @@ -12201,14 +12674,14 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":794 + /* "View.MemoryView":797 * start += shape * if not 0 <= start < shape: * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< * else: * */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_41, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; @@ -12216,7 +12689,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } /*else*/ { - /* "View.MemoryView":797 + /* "View.MemoryView":800 * else: * * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< @@ -12232,7 +12705,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_v_negative_step = __pyx_t_4; - /* "View.MemoryView":799 + /* "View.MemoryView":802 * negative_step = have_step != 0 and step < 0 * * if have_step and step == 0: # <<<<<<<<<<<<<< @@ -12247,19 +12720,19 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } if (__pyx_t_2) { - /* "View.MemoryView":800 + /* "View.MemoryView":803 * * if have_step and step == 0: * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_42, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "View.MemoryView":803 + /* "View.MemoryView":806 * * * if have_start: # <<<<<<<<<<<<<< @@ -12269,7 +12742,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_have_start != 0); if (__pyx_t_2) { - /* "View.MemoryView":804 + /* "View.MemoryView":807 * * if have_start: * if start < 0: # <<<<<<<<<<<<<< @@ -12279,7 +12752,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_start < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":805 + /* "View.MemoryView":808 * if have_start: * if start < 0: * start += shape # <<<<<<<<<<<<<< @@ -12288,7 +12761,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "View.MemoryView":806 + /* "View.MemoryView":809 * if start < 0: * start += shape * if start < 0: # <<<<<<<<<<<<<< @@ -12298,7 +12771,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_start < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":807 + /* "View.MemoryView":810 * start += shape * if start < 0: * start = 0 # <<<<<<<<<<<<<< @@ -12312,7 +12785,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L8; } - /* "View.MemoryView":808 + /* "View.MemoryView":811 * if start < 0: * start = 0 * elif start >= shape: # <<<<<<<<<<<<<< @@ -12322,7 +12795,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); if (__pyx_t_2) { - /* "View.MemoryView":809 + /* "View.MemoryView":812 * start = 0 * elif start >= shape: * if negative_step: # <<<<<<<<<<<<<< @@ -12332,7 +12805,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { - /* "View.MemoryView":810 + /* "View.MemoryView":813 * elif start >= shape: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< @@ -12344,7 +12817,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } /*else*/ { - /* "View.MemoryView":812 + /* "View.MemoryView":815 * start = shape - 1 * else: * start = shape # <<<<<<<<<<<<<< @@ -12361,7 +12834,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } /*else*/ { - /* "View.MemoryView":814 + /* "View.MemoryView":817 * start = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -12371,7 +12844,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { - /* "View.MemoryView":815 + /* "View.MemoryView":818 * else: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< @@ -12383,7 +12856,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } /*else*/ { - /* "View.MemoryView":817 + /* "View.MemoryView":820 * start = shape - 1 * else: * start = 0 # <<<<<<<<<<<<<< @@ -12396,7 +12869,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L7:; - /* "View.MemoryView":819 + /* "View.MemoryView":822 * start = 0 * * if have_stop: # <<<<<<<<<<<<<< @@ -12406,7 +12879,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_have_stop != 0); if (__pyx_t_2) { - /* "View.MemoryView":820 + /* "View.MemoryView":823 * * if have_stop: * if stop < 0: # <<<<<<<<<<<<<< @@ -12416,7 +12889,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_stop < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":821 + /* "View.MemoryView":824 * if have_stop: * if stop < 0: * stop += shape # <<<<<<<<<<<<<< @@ -12425,7 +12898,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* "View.MemoryView":822 + /* "View.MemoryView":825 * if stop < 0: * stop += shape * if stop < 0: # <<<<<<<<<<<<<< @@ -12435,7 +12908,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_stop < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":823 + /* "View.MemoryView":826 * stop += shape * if stop < 0: * stop = 0 # <<<<<<<<<<<<<< @@ -12449,7 +12922,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L13; } - /* "View.MemoryView":824 + /* "View.MemoryView":827 * if stop < 0: * stop = 0 * elif stop > shape: # <<<<<<<<<<<<<< @@ -12459,7 +12932,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); if (__pyx_t_2) { - /* "View.MemoryView":825 + /* "View.MemoryView":828 * stop = 0 * elif stop > shape: * stop = shape # <<<<<<<<<<<<<< @@ -12474,7 +12947,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } /*else*/ { - /* "View.MemoryView":827 + /* "View.MemoryView":830 * stop = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -12484,7 +12957,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { - /* "View.MemoryView":828 + /* "View.MemoryView":831 * else: * if negative_step: * stop = -1 # <<<<<<<<<<<<<< @@ -12496,7 +12969,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } /*else*/ { - /* "View.MemoryView":830 + /* "View.MemoryView":833 * stop = -1 * else: * stop = shape # <<<<<<<<<<<<<< @@ -12509,7 +12982,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L12:; - /* "View.MemoryView":832 + /* "View.MemoryView":835 * stop = shape * * if not have_step: # <<<<<<<<<<<<<< @@ -12519,7 +12992,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":833 + /* "View.MemoryView":836 * * if not have_step: * step = 1 # <<<<<<<<<<<<<< @@ -12531,7 +13004,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L16:; - /* "View.MemoryView":837 + /* "View.MemoryView":840 * * with cython.cdivision(True): * new_shape = (stop - start) // step # <<<<<<<<<<<<<< @@ -12540,7 +13013,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - /* "View.MemoryView":839 + /* "View.MemoryView":842 * new_shape = (stop - start) // step * * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< @@ -12550,7 +13023,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":840 + /* "View.MemoryView":843 * * if (stop - start) - step * new_shape: * new_shape += 1 # <<<<<<<<<<<<<< @@ -12562,7 +13035,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L17:; - /* "View.MemoryView":842 + /* "View.MemoryView":845 * new_shape += 1 * * if new_shape < 0: # <<<<<<<<<<<<<< @@ -12572,7 +13045,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":843 + /* "View.MemoryView":846 * * if new_shape < 0: * new_shape = 0 # <<<<<<<<<<<<<< @@ -12584,7 +13057,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L18:; - /* "View.MemoryView":846 + /* "View.MemoryView":849 * * * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< @@ -12593,7 +13066,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "View.MemoryView":847 + /* "View.MemoryView":850 * * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< @@ -12602,7 +13075,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - /* "View.MemoryView":848 + /* "View.MemoryView":851 * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< @@ -12613,7 +13086,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L3:; - /* "View.MemoryView":851 + /* "View.MemoryView":854 * * * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< @@ -12623,7 +13096,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":852 + /* "View.MemoryView":855 * * if suboffset_dim[0] < 0: * dst.data += start * stride # <<<<<<<<<<<<<< @@ -12635,7 +13108,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } /*else*/ { - /* "View.MemoryView":854 + /* "View.MemoryView":857 * dst.data += start * stride * else: * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< @@ -12647,7 +13120,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L19:; - /* "View.MemoryView":856 + /* "View.MemoryView":859 * dst.suboffsets[suboffset_dim[0]] += start * stride * * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -12657,7 +13130,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":857 + /* "View.MemoryView":860 * * if suboffset >= 0: * if not is_slice: # <<<<<<<<<<<<<< @@ -12667,7 +13140,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":858 + /* "View.MemoryView":861 * if suboffset >= 0: * if not is_slice: * if new_ndim == 0: # <<<<<<<<<<<<<< @@ -12677,7 +13150,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":859 + /* "View.MemoryView":862 * if not is_slice: * if new_ndim == 0: * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< @@ -12689,21 +13162,21 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } /*else*/ { - /* "View.MemoryView":862 + /* "View.MemoryView":864 + * dst.data = ( dst.data)[0] + suboffset * else: - * _err_dim(IndexError, "All dimensions preceding dimension %d " - * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< + * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< + * "must be indexed and not sliced", dim) * else: - * suboffset_dim[0] = new_ndim */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_43, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, __pyx_k_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L22:; goto __pyx_L21; } /*else*/ { - /* "View.MemoryView":864 + /* "View.MemoryView":867 * "must be indexed and not sliced", dim) * else: * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< @@ -12717,7 +13190,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L20:; - /* "View.MemoryView":866 + /* "View.MemoryView":869 * suboffset_dim[0] = new_ndim * * return 0 # <<<<<<<<<<<<<< @@ -12727,8 +13200,15 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":772 + * + * @cname('__pyx_memoryview_slice_memviewslice') + * cdef int slice_memviewslice( # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset, + */ + + /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD @@ -12744,7 +13224,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, return __pyx_r; } -/* "View.MemoryView":872 +/* "View.MemoryView":875 * * @cname('__pyx_pybuffer_index') * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< @@ -12769,7 +13249,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pybuffer_index", 0); - /* "View.MemoryView":874 + /* "View.MemoryView":877 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< @@ -12778,7 +13258,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_suboffset = -1; - /* "View.MemoryView":875 + /* "View.MemoryView":878 * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< @@ -12788,7 +13268,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_1 = __pyx_v_view->itemsize; __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":878 + /* "View.MemoryView":881 * cdef char *resultp * * if view.ndim == 0: # <<<<<<<<<<<<<< @@ -12798,7 +13278,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":879 + /* "View.MemoryView":882 * * if view.ndim == 0: * shape = view.len / itemsize # <<<<<<<<<<<<<< @@ -12809,25 +13289,25 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { + else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif - PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize); - /* "View.MemoryView":880 + /* "View.MemoryView":883 * if view.ndim == 0: * shape = view.len / itemsize * stride = itemsize # <<<<<<<<<<<<<< @@ -12839,7 +13319,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P } /*else*/ { - /* "View.MemoryView":882 + /* "View.MemoryView":885 * stride = itemsize * else: * shape = view.shape[dim] # <<<<<<<<<<<<<< @@ -12848,7 +13328,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "View.MemoryView":883 + /* "View.MemoryView":886 * else: * shape = view.shape[dim] * stride = view.strides[dim] # <<<<<<<<<<<<<< @@ -12857,7 +13337,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - /* "View.MemoryView":884 + /* "View.MemoryView":887 * shape = view.shape[dim] * stride = view.strides[dim] * if view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -12867,7 +13347,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); if (__pyx_t_2) { - /* "View.MemoryView":885 + /* "View.MemoryView":888 * stride = view.strides[dim] * if view.suboffsets != NULL: * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< @@ -12881,7 +13361,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P } __pyx_L3:; - /* "View.MemoryView":887 + /* "View.MemoryView":890 * suboffset = view.suboffsets[dim] * * if index < 0: # <<<<<<<<<<<<<< @@ -12891,7 +13371,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":888 + /* "View.MemoryView":891 * * if index < 0: * index += view.shape[dim] # <<<<<<<<<<<<<< @@ -12900,7 +13380,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - /* "View.MemoryView":889 + /* "View.MemoryView":892 * if index < 0: * index += view.shape[dim] * if index < 0: # <<<<<<<<<<<<<< @@ -12910,37 +13390,35 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":890 + /* "View.MemoryView":893 * index += view.shape[dim] * if index < 0: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * if index >= shape: */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_IndexError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L6:; goto __pyx_L5; } __pyx_L5:; - /* "View.MemoryView":892 + /* "View.MemoryView":895 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * if index >= shape: # <<<<<<<<<<<<<< @@ -12950,34 +13428,32 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); if (__pyx_t_2) { - /* "View.MemoryView":893 + /* "View.MemoryView":896 * * if index >= shape: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * resultp = bufp + index * stride */ - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L7:; - /* "View.MemoryView":895 + /* "View.MemoryView":898 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * resultp = bufp + index * stride # <<<<<<<<<<<<<< @@ -12986,7 +13462,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - /* "View.MemoryView":896 + /* "View.MemoryView":899 * * resultp = bufp + index * stride * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -12996,7 +13472,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":897 + /* "View.MemoryView":900 * resultp = bufp + index * stride * if suboffset >= 0: * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< @@ -13008,7 +13484,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P } __pyx_L8:; - /* "View.MemoryView":899 + /* "View.MemoryView":902 * resultp = ( resultp)[0] + suboffset * * return resultp # <<<<<<<<<<<<<< @@ -13018,8 +13494,15 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_r = __pyx_v_resultp; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":875 + * + * @cname('__pyx_pybuffer_index') + * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< + * Py_ssize_t dim) except NULL: + * cdef Py_ssize_t shape, stride, suboffset = -1 + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -13030,7 +13513,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P return __pyx_r; } -/* "View.MemoryView":905 +/* "View.MemoryView":908 * * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< @@ -13058,7 +13541,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { const char *__pyx_filename = NULL; int __pyx_clineno = 0; - /* "View.MemoryView":906 + /* "View.MemoryView":909 * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< @@ -13068,7 +13551,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; __pyx_v_ndim = __pyx_t_1; - /* "View.MemoryView":908 + /* "View.MemoryView":911 * cdef int ndim = memslice.memview.view.ndim * * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< @@ -13078,7 +13561,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_t_2 = __pyx_v_memslice->shape; __pyx_v_shape = __pyx_t_2; - /* "View.MemoryView":909 + /* "View.MemoryView":912 * * cdef Py_ssize_t *shape = memslice.shape * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< @@ -13088,7 +13571,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_t_2 = __pyx_v_memslice->strides; __pyx_v_strides = __pyx_t_2; - /* "View.MemoryView":913 + /* "View.MemoryView":916 * * cdef int i, j * for i in range(ndim / 2): # <<<<<<<<<<<<<< @@ -13099,7 +13582,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":914 + /* "View.MemoryView":917 * cdef int i, j * for i in range(ndim / 2): * j = ndim - 1 - i # <<<<<<<<<<<<<< @@ -13108,7 +13591,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { */ __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - /* "View.MemoryView":915 + /* "View.MemoryView":918 * for i in range(ndim / 2): * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< @@ -13120,7 +13603,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4; (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5; - /* "View.MemoryView":916 + /* "View.MemoryView":919 * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< @@ -13132,7 +13615,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5; (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4; - /* "View.MemoryView":918 + /* "View.MemoryView":921 * shape[i], shape[j] = shape[j], shape[i] * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< @@ -13148,20 +13631,20 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { } if (__pyx_t_8) { - /* "View.MemoryView":919 + /* "View.MemoryView":922 * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< * * return 1 */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_45); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 922; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; } - /* "View.MemoryView":921 + /* "View.MemoryView":924 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * * return 1 # <<<<<<<<<<<<<< @@ -13171,8 +13654,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_r = 1; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":908 + * + * @cname('__pyx_memslice_transpose') + * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< + * cdef int ndim = memslice.memview.view.ndim + * + */ + + /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD @@ -13188,28 +13678,30 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { return __pyx_r; } +/* "View.MemoryView":941 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + * + */ + /* Python wrapper */ static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":938 - * cdef int (*to_dtype_func)(char *, object) except 0 - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) - * - */ - static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":939 + /* "View.MemoryView":942 * * def __dealloc__(self): * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< @@ -13218,10 +13710,19 @@ static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(stru */ __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); + /* "View.MemoryView":941 + * cdef int (*to_dtype_func)(char *, object) except 0 + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + * + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":941 +/* "View.MemoryView":944 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -13239,7 +13740,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "View.MemoryView":942 + /* "View.MemoryView":945 * * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: # <<<<<<<<<<<<<< @@ -13249,7 +13750,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":943 + /* "View.MemoryView":946 * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: * return self.to_object_func(itemp) # <<<<<<<<<<<<<< @@ -13257,16 +13758,15 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor * return memoryview.convert_item_to_object(self, itemp) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":945 + /* "View.MemoryView":948 * return self.to_object_func(itemp) * else: * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< @@ -13274,16 +13774,22 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor * cdef assign_item_from_object(self, char *itemp, object value): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_vtabptr_memoryview->convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_vtabptr_memoryview->convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; } - __pyx_L3:; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":944 + * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) + * + * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< + * if self.to_object_func != NULL: + * return self.to_object_func(itemp) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -13294,7 +13800,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor return __pyx_r; } -/* "View.MemoryView":947 +/* "View.MemoryView":950 * return memoryview.convert_item_to_object(self, itemp) * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -13313,7 +13819,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":948 + /* "View.MemoryView":951 * * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< @@ -13323,31 +13829,40 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":949 + /* "View.MemoryView":952 * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< * else: * memoryview.assign_item_from_object(self, itemp, value) */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":951 + /* "View.MemoryView":954 * self.to_dtype_func(itemp, value) * else: * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< * * property base: */ - __pyx_t_3 = __pyx_vtabptr_memoryview->assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_vtabptr_memoryview->assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_L3:; + /* "View.MemoryView":950 + * return memoryview.convert_item_to_object(self, itemp) + * + * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< + * if self.to_dtype_func != NULL: + * self.to_dtype_func(itemp, value) + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -13360,6 +13875,14 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo return __pyx_r; } +/* "View.MemoryView":958 + * property base: + * @cname('__pyx_memoryviewslice__get__base') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.from_object + * + */ + /* Python wrapper */ static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self) { @@ -13367,24 +13890,18 @@ static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":955 - * property base: - * @cname('__pyx_memoryviewslice__get__base') - * def __get__(self): # <<<<<<<<<<<<<< - * return self.from_object - * - */ - static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":956 + /* "View.MemoryView":959 * @cname('__pyx_memoryviewslice__get__base') * def __get__(self): * return self.from_object # <<<<<<<<<<<<<< @@ -13396,14 +13913,22 @@ static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_ __pyx_r = __pyx_v_self->from_object; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "View.MemoryView":958 + * property base: + * @cname('__pyx_memoryviewslice__get__base') + * def __get__(self): # <<<<<<<<<<<<<< + * return self.from_object + * + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "View.MemoryView":962 +/* "View.MemoryView":965 * * @cname('__pyx_memoryview_fromslice') * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< @@ -13429,7 +13954,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - /* "View.MemoryView":971 + /* "View.MemoryView":974 * cdef int i * * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< @@ -13439,7 +13964,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); if (__pyx_t_1) { - /* "View.MemoryView":972 + /* "View.MemoryView":975 * * if memviewslice.memview == Py_None: * return None # <<<<<<<<<<<<<< @@ -13450,20 +13975,18 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "View.MemoryView":977 + /* "View.MemoryView":980 * * * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< * * result.from_slice = memviewslice */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); @@ -13474,13 +13997,13 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryviewslice_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryviewslice_type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":979 + /* "View.MemoryView":982 * result = _memoryviewslice(None, 0, dtype_is_object) * * result.from_slice = memviewslice # <<<<<<<<<<<<<< @@ -13489,7 +14012,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "View.MemoryView":980 + /* "View.MemoryView":983 * * result.from_slice = memviewslice * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< @@ -13498,14 +14021,14 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "View.MemoryView":982 + /* "View.MemoryView":985 * __PYX_INC_MEMVIEW(&memviewslice, 1) * * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< * result.typeinfo = memviewslice.memview.typeinfo * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_result->from_object); @@ -13513,7 +14036,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_v_result->from_object = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":983 + /* "View.MemoryView":986 * * result.from_object = ( memviewslice.memview).base * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< @@ -13523,7 +14046,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* "View.MemoryView":985 + /* "View.MemoryView":988 * result.typeinfo = memviewslice.memview.typeinfo * * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< @@ -13533,7 +14056,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_5 = __pyx_v_memviewslice.memview->view; __pyx_v_result->__pyx_base.view = __pyx_t_5; - /* "View.MemoryView":986 + /* "View.MemoryView":989 * * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< @@ -13542,7 +14065,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* "View.MemoryView":987 + /* "View.MemoryView":990 * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data * result.view.ndim = ndim # <<<<<<<<<<<<<< @@ -13551,7 +14074,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* "View.MemoryView":988 + /* "View.MemoryView":991 * result.view.buf = memviewslice.data * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< @@ -13560,7 +14083,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - /* "View.MemoryView":989 + /* "View.MemoryView":992 * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -13569,7 +14092,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ Py_INCREF(Py_None); - /* "View.MemoryView":991 + /* "View.MemoryView":994 * Py_INCREF(Py_None) * * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< @@ -13578,7 +14101,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - /* "View.MemoryView":993 + /* "View.MemoryView":996 * result.flags = PyBUF_RECORDS * * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< @@ -13587,7 +14110,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - /* "View.MemoryView":994 + /* "View.MemoryView":997 * * result.view.shape = result.from_slice.shape * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< @@ -13596,7 +14119,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - /* "View.MemoryView":995 + /* "View.MemoryView":998 * result.view.shape = result.from_slice.shape * result.view.strides = result.from_slice.strides * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< @@ -13605,7 +14128,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* "View.MemoryView":997 + /* "View.MemoryView":1000 * result.view.suboffsets = result.from_slice.suboffsets * * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< @@ -13615,7 +14138,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize; __pyx_v_result->__pyx_base.view.len = __pyx_t_6; - /* "View.MemoryView":998 + /* "View.MemoryView":1001 * * result.view.len = result.view.itemsize * for i in range(ndim): # <<<<<<<<<<<<<< @@ -13626,7 +14149,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "View.MemoryView":999 + /* "View.MemoryView":1002 * result.view.len = result.view.itemsize * for i in range(ndim): * result.view.len *= result.view.shape[i] # <<<<<<<<<<<<<< @@ -13636,7 +14159,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_v_result->__pyx_base.view.len = (__pyx_v_result->__pyx_base.view.len * (__pyx_v_result->__pyx_base.view.shape[__pyx_v_i])); } - /* "View.MemoryView":1001 + /* "View.MemoryView":1004 * result.view.len *= result.view.shape[i] * * result.to_object_func = to_object_func # <<<<<<<<<<<<<< @@ -13645,7 +14168,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->to_object_func = __pyx_v_to_object_func; - /* "View.MemoryView":1002 + /* "View.MemoryView":1005 * * result.to_object_func = to_object_func * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< @@ -13654,7 +14177,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - /* "View.MemoryView":1004 + /* "View.MemoryView":1007 * result.to_dtype_func = to_dtype_func * * return result # <<<<<<<<<<<<<< @@ -13666,8 +14189,15 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":965 + * + * @cname('__pyx_memoryview_fromslice') + * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< + * int ndim, + * object (*to_object_func)(char *), + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); @@ -13680,7 +14210,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl return __pyx_r; } -/* "View.MemoryView":1007 +/* "View.MemoryView":1010 * * @cname('__pyx_memoryview_get_slice_from_memoryview') * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< @@ -13694,12 +14224,13 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - /* "View.MemoryView":1010 + /* "View.MemoryView":1013 * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -13710,18 +14241,20 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":1011 + /* "View.MemoryView":1014 * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): * obj = memview # <<<<<<<<<<<<<< * return &obj.from_slice * else: */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(((PyObject *)__pyx_v_memview)); - __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview); + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)__pyx_v_memview); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":1012 + /* "View.MemoryView":1015 * if isinstance(memview, _memoryviewslice): * obj = memview * return &obj.from_slice # <<<<<<<<<<<<<< @@ -13730,11 +14263,10 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p */ __pyx_r = (&__pyx_v_obj->from_slice); goto __pyx_L0; - goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":1014 + /* "View.MemoryView":1017 * return &obj.from_slice * else: * slice_copy(memview, mslice) # <<<<<<<<<<<<<< @@ -13743,7 +14275,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p */ __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - /* "View.MemoryView":1015 + /* "View.MemoryView":1018 * else: * slice_copy(memview, mslice) * return mslice # <<<<<<<<<<<<<< @@ -13753,12 +14285,19 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p __pyx_r = __pyx_v_mslice; goto __pyx_L0; } - __pyx_L3:; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1010 + * + * @cname('__pyx_memoryview_get_slice_from_memoryview') + * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *mslice): + * cdef _memoryviewslice obj + */ + + /* function exit code */ __pyx_L1_error:; - __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_obj); @@ -13766,12 +14305,12 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p return __pyx_r; } -/* "View.MemoryView":1018 +/* "View.MemoryView":1021 * * @cname('__pyx_memoryview_slice_copy') * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< * cdef int dim - * cdef Py_ssize_t *shape, *strides, *suboffsets + * cdef (Py_ssize_t*) shape, strides, suboffsets */ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) { @@ -13786,8 +14325,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem int __pyx_t_4; __Pyx_RefNannySetupContext("slice_copy", 0); - /* "View.MemoryView":1022 - * cdef Py_ssize_t *shape, *strides, *suboffsets + /* "View.MemoryView":1025 + * cdef (Py_ssize_t*) shape, strides, suboffsets * * shape = memview.view.shape # <<<<<<<<<<<<<< * strides = memview.view.strides @@ -13796,7 +14335,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_1 = __pyx_v_memview->view.shape; __pyx_v_shape = __pyx_t_1; - /* "View.MemoryView":1023 + /* "View.MemoryView":1026 * * shape = memview.view.shape * strides = memview.view.strides # <<<<<<<<<<<<<< @@ -13806,7 +14345,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_1 = __pyx_v_memview->view.strides; __pyx_v_strides = __pyx_t_1; - /* "View.MemoryView":1024 + /* "View.MemoryView":1027 * shape = memview.view.shape * strides = memview.view.strides * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< @@ -13816,7 +14355,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_1 = __pyx_v_memview->view.suboffsets; __pyx_v_suboffsets = __pyx_t_1; - /* "View.MemoryView":1026 + /* "View.MemoryView":1029 * suboffsets = memview.view.suboffsets * * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< @@ -13825,7 +14364,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - /* "View.MemoryView":1027 + /* "View.MemoryView":1030 * * dst.memview = <__pyx_memoryview *> memview * dst.data = memview.view.buf # <<<<<<<<<<<<<< @@ -13834,7 +14373,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* "View.MemoryView":1029 + /* "View.MemoryView":1032 * dst.data = memview.view.buf * * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< @@ -13845,7 +14384,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_dim = __pyx_t_3; - /* "View.MemoryView":1030 + /* "View.MemoryView":1033 * * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< @@ -13854,7 +14393,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - /* "View.MemoryView":1031 + /* "View.MemoryView":1034 * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< @@ -13863,7 +14402,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - /* "View.MemoryView":1032 + /* "View.MemoryView":1035 * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] * if suboffsets == NULL: # <<<<<<<<<<<<<< @@ -13873,7 +14412,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_4 = ((__pyx_v_suboffsets == NULL) != 0); if (__pyx_t_4) { - /* "View.MemoryView":1033 + /* "View.MemoryView":1036 * dst.strides[dim] = strides[dim] * if suboffsets == NULL: * dst.suboffsets[dim] = -1 # <<<<<<<<<<<<<< @@ -13885,7 +14424,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem } /*else*/ { - /* "View.MemoryView":1035 + /* "View.MemoryView":1038 * dst.suboffsets[dim] = -1 * else: * dst.suboffsets[dim] = suboffsets[dim] # <<<<<<<<<<<<<< @@ -13897,10 +14436,19 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_L5:; } + /* "View.MemoryView":1021 + * + * @cname('__pyx_memoryview_slice_copy') + * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< + * cdef int dim + * cdef (Py_ssize_t*) shape, strides, suboffsets + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":1038 +/* "View.MemoryView":1041 * * @cname('__pyx_memoryview_copy_object') * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< @@ -13918,7 +14466,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* "View.MemoryView":1041 + /* "View.MemoryView":1044 * "Create a new memoryview object" * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< @@ -13927,7 +14475,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx */ __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - /* "View.MemoryView":1042 + /* "View.MemoryView":1045 * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< @@ -13935,14 +14483,21 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx * @cname('__pyx_memoryview_copy_object_from_slice') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":1041 + * + * @cname('__pyx_memoryview_copy_object') + * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< + * "Create a new memoryview object" + * cdef __Pyx_memviewslice memviewslice + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -13953,7 +14508,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx return __pyx_r; } -/* "View.MemoryView":1045 +/* "View.MemoryView":1048 * * @cname('__pyx_memoryview_copy_object_from_slice') * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< @@ -13976,7 +14531,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "View.MemoryView":1052 + /* "View.MemoryView":1055 * cdef int (*to_dtype_func)(char *, object) except 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -13987,7 +14542,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":1053 + /* "View.MemoryView":1056 * * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< @@ -13997,7 +14552,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; __pyx_v_to_object_func = __pyx_t_3; - /* "View.MemoryView":1054 + /* "View.MemoryView":1057 * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< @@ -14010,7 +14565,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview } /*else*/ { - /* "View.MemoryView":1056 + /* "View.MemoryView":1059 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func * else: * to_object_func = NULL # <<<<<<<<<<<<<< @@ -14019,7 +14574,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview */ __pyx_v_to_object_func = NULL; - /* "View.MemoryView":1057 + /* "View.MemoryView":1060 * else: * to_object_func = NULL * to_dtype_func = NULL # <<<<<<<<<<<<<< @@ -14030,7 +14585,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview } __pyx_L3:; - /* "View.MemoryView":1059 + /* "View.MemoryView":1062 * to_dtype_func = NULL * * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< @@ -14039,21 +14594,28 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview */ __Pyx_XDECREF(__pyx_r); - /* "View.MemoryView":1061 + /* "View.MemoryView":1064 * return memoryview_fromslice(memviewslice[0], memview.view.ndim, * to_object_func, to_dtype_func, * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "View.MemoryView":1048 + * + * @cname('__pyx_memoryview_copy_object_from_slice') + * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< + * """ + * Create a new memoryview object from a given memoryview object and slice. + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -14064,7 +14626,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview return __pyx_r; } -/* "View.MemoryView":1067 +/* "View.MemoryView":1070 * * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< @@ -14076,7 +14638,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { Py_ssize_t __pyx_r; int __pyx_t_1; - /* "View.MemoryView":1068 + /* "View.MemoryView":1071 * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: # <<<<<<<<<<<<<< @@ -14086,7 +14648,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { __pyx_t_1 = ((__pyx_v_arg < 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1069 + /* "View.MemoryView":1072 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: * return -arg # <<<<<<<<<<<<<< @@ -14095,11 +14657,10 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { */ __pyx_r = (-__pyx_v_arg); goto __pyx_L0; - goto __pyx_L3; } /*else*/ { - /* "View.MemoryView":1071 + /* "View.MemoryView":1074 * return -arg * else: * return arg # <<<<<<<<<<<<<< @@ -14109,14 +14670,21 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { __pyx_r = __pyx_v_arg; goto __pyx_L0; } - __pyx_L3:; - __pyx_r = 0; + /* "View.MemoryView":1070 + * + * + * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< + * if arg < 0: + * return -arg + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "View.MemoryView":1074 +/* "View.MemoryView":1077 * * @cname('__pyx_get_best_slice_order') * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< @@ -14133,7 +14701,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":1079 + /* "View.MemoryView":1082 * """ * cdef int i * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< @@ -14142,7 +14710,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_c_stride = 0; - /* "View.MemoryView":1080 + /* "View.MemoryView":1083 * cdef int i * cdef Py_ssize_t c_stride = 0 * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< @@ -14151,7 +14719,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_f_stride = 0; - /* "View.MemoryView":1082 + /* "View.MemoryView":1085 * cdef Py_ssize_t f_stride = 0 * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -14161,7 +14729,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":1083 + /* "View.MemoryView":1086 * * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -14171,7 +14739,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1084 + /* "View.MemoryView":1087 * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< @@ -14180,7 +14748,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":1085 + /* "View.MemoryView":1088 * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< @@ -14188,13 +14756,11 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ * for i in range(ndim): */ goto __pyx_L4_break; - goto __pyx_L5; } - __pyx_L5:; } __pyx_L4_break:; - /* "View.MemoryView":1087 + /* "View.MemoryView":1090 * break * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -14205,7 +14771,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1088 + /* "View.MemoryView":1091 * * for i in range(ndim): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -14215,7 +14781,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1089 + /* "View.MemoryView":1092 * for i in range(ndim): * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< @@ -14224,7 +14790,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":1090 + /* "View.MemoryView":1093 * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< @@ -14232,13 +14798,11 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): */ goto __pyx_L7_break; - goto __pyx_L8; } - __pyx_L8:; } __pyx_L7_break:; - /* "View.MemoryView":1092 + /* "View.MemoryView":1095 * break * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< @@ -14248,7 +14812,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1093 + /* "View.MemoryView":1096 * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): * return 'C' # <<<<<<<<<<<<<< @@ -14257,11 +14821,10 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_r = 'C'; goto __pyx_L0; - goto __pyx_L9; } /*else*/ { - /* "View.MemoryView":1095 + /* "View.MemoryView":1098 * return 'C' * else: * return 'F' # <<<<<<<<<<<<<< @@ -14271,14 +14834,21 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_r = 'F'; goto __pyx_L0; } - __pyx_L9:; - __pyx_r = 0; + /* "View.MemoryView":1077 + * + * @cname('__pyx_get_best_slice_order') + * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< + * """ + * Figure out the best memory access order for a given slice. + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "View.MemoryView":1098 +/* "View.MemoryView":1101 * * @cython.cdivision(True) * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< @@ -14299,7 +14869,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; - /* "View.MemoryView":1105 + /* "View.MemoryView":1108 * * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< @@ -14308,7 +14878,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_extent = (__pyx_v_src_shape[0]); - /* "View.MemoryView":1106 + /* "View.MemoryView":1109 * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< @@ -14317,7 +14887,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - /* "View.MemoryView":1107 + /* "View.MemoryView":1110 * cdef Py_ssize_t src_extent = src_shape[0] * cdef Py_ssize_t dst_extent = dst_shape[0] * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< @@ -14326,7 +14896,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_stride = (__pyx_v_src_strides[0]); - /* "View.MemoryView":1108 + /* "View.MemoryView":1111 * cdef Py_ssize_t dst_extent = dst_shape[0] * cdef Py_ssize_t src_stride = src_strides[0] * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< @@ -14335,7 +14905,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - /* "View.MemoryView":1110 + /* "View.MemoryView":1113 * cdef Py_ssize_t dst_stride = dst_strides[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -14345,7 +14915,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1111 + /* "View.MemoryView":1114 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< @@ -14357,7 +14927,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1112 + /* "View.MemoryView":1115 * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< @@ -14378,7 +14948,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } if (__pyx_t_2) { - /* "View.MemoryView":1113 + /* "View.MemoryView":1116 * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< @@ -14390,7 +14960,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } /*else*/ { - /* "View.MemoryView":1115 + /* "View.MemoryView":1118 * memcpy(dst_data, src_data, itemsize * dst_extent) * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< @@ -14401,7 +14971,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1116 + /* "View.MemoryView":1119 * else: * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< @@ -14410,7 +14980,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize); - /* "View.MemoryView":1117 + /* "View.MemoryView":1120 * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< @@ -14419,7 +14989,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":1118 + /* "View.MemoryView":1121 * memcpy(dst_data, src_data, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< @@ -14434,7 +15004,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } /*else*/ { - /* "View.MemoryView":1120 + /* "View.MemoryView":1123 * dst_data += dst_stride * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< @@ -14446,15 +15016,15 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v __pyx_v_i = __pyx_t_6; /* "View.MemoryView":1124 + * else: + * for i in range(dst_extent): + * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< * dst_data, dst_strides + 1, * src_shape + 1, dst_shape + 1, - * ndim - 1, itemsize) # <<<<<<<<<<<<<< - * src_data += src_stride - * dst_data += dst_stride */ _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - /* "View.MemoryView":1125 + /* "View.MemoryView":1128 * src_shape + 1, dst_shape + 1, * ndim - 1, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< @@ -14463,7 +15033,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":1126 + /* "View.MemoryView":1129 * ndim - 1, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< @@ -14475,9 +15045,18 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } __pyx_L3:; + /* "View.MemoryView":1101 + * + * @cython.cdivision(True) + * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< + * char *dst_data, Py_ssize_t *dst_strides, + * Py_ssize_t *src_shape, Py_ssize_t *dst_shape, + */ + + /* function exit code */ } -/* "View.MemoryView":1128 +/* "View.MemoryView":1131 * dst_data += dst_stride * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -14487,18 +15066,27 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - /* "View.MemoryView":1132 + /* "View.MemoryView":1134 + * __Pyx_memviewslice *dst, * int ndim, size_t itemsize) nogil: - * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, - * src.shape, dst.shape, ndim, itemsize) # <<<<<<<<<<<<<< + * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< + * src.shape, dst.shape, ndim, itemsize) * - * @cname('__pyx_memoryview_slice_get_size') */ _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); + /* "View.MemoryView":1131 + * dst_data += dst_stride + * + * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *dst, + * int ndim, size_t itemsize) nogil: + */ + + /* function exit code */ } -/* "View.MemoryView":1135 +/* "View.MemoryView":1138 * * @cname('__pyx_memoryview_slice_get_size') * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< @@ -14514,7 +15102,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":1138 + /* "View.MemoryView":1141 * "Return the size of the memory occupied by the slice in number of bytes" * cdef int i * cdef Py_ssize_t size = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -14524,7 +15112,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_t_1 = __pyx_v_src->memview->view.itemsize; __pyx_v_size = __pyx_t_1; - /* "View.MemoryView":1140 + /* "View.MemoryView":1143 * cdef Py_ssize_t size = src.memview.view.itemsize * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -14535,7 +15123,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1141 + /* "View.MemoryView":1144 * * for i in range(ndim): * size *= src.shape[i] # <<<<<<<<<<<<<< @@ -14545,7 +15133,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i])); } - /* "View.MemoryView":1143 + /* "View.MemoryView":1146 * size *= src.shape[i] * * return size # <<<<<<<<<<<<<< @@ -14555,12 +15143,20 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_r = __pyx_v_size; goto __pyx_L0; - __pyx_r = 0; + /* "View.MemoryView":1138 + * + * @cname('__pyx_memoryview_slice_get_size') + * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< + * "Return the size of the memory occupied by the slice in number of bytes" + * cdef int i + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "View.MemoryView":1146 +/* "View.MemoryView":1149 * * @cname('__pyx_fill_contig_strides_array') * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< @@ -14575,7 +15171,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":1155 + /* "View.MemoryView":1158 * cdef int idx * * if order == 'F': # <<<<<<<<<<<<<< @@ -14585,7 +15181,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ __pyx_t_1 = ((__pyx_v_order == 'F') != 0); if (__pyx_t_1) { - /* "View.MemoryView":1156 + /* "View.MemoryView":1159 * * if order == 'F': * for idx in range(ndim): # <<<<<<<<<<<<<< @@ -14596,7 +15192,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_idx = __pyx_t_3; - /* "View.MemoryView":1157 + /* "View.MemoryView":1160 * if order == 'F': * for idx in range(ndim): * strides[idx] = stride # <<<<<<<<<<<<<< @@ -14605,7 +15201,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ */ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":1158 + /* "View.MemoryView":1161 * for idx in range(ndim): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< @@ -14618,7 +15214,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ } /*else*/ { - /* "View.MemoryView":1160 + /* "View.MemoryView":1163 * stride = stride * shape[idx] * else: * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -14628,7 +15224,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { __pyx_v_idx = __pyx_t_2; - /* "View.MemoryView":1161 + /* "View.MemoryView":1164 * else: * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride # <<<<<<<<<<<<<< @@ -14637,7 +15233,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ */ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":1162 + /* "View.MemoryView":1165 * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< @@ -14649,7 +15245,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ } __pyx_L3:; - /* "View.MemoryView":1164 + /* "View.MemoryView":1167 * stride = stride * shape[idx] * * return stride # <<<<<<<<<<<<<< @@ -14659,14 +15255,22 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ __pyx_r = __pyx_v_stride; goto __pyx_L0; - __pyx_r = 0; - __pyx_L0:; - return __pyx_r; -} - -/* "View.MemoryView":1167 + /* "View.MemoryView":1149 * - * @cname('__pyx_memoryview_copy_data_to_temp') + * @cname('__pyx_fill_contig_strides_array') + * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< + * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride, + * int ndim, char order) nogil: + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "View.MemoryView":1170 + * + * @cname('__pyx_memoryview_copy_data_to_temp') * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< * __Pyx_memviewslice *tmpslice, * char order, @@ -14687,7 +15291,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, const char *__pyx_filename = NULL; int __pyx_clineno = 0; - /* "View.MemoryView":1178 + /* "View.MemoryView":1181 * cdef void *result * * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -14697,7 +15301,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_1 = __pyx_v_src->memview->view.itemsize; __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":1179 + /* "View.MemoryView":1182 * * cdef size_t itemsize = src.memview.view.itemsize * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< @@ -14706,7 +15310,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* "View.MemoryView":1181 + /* "View.MemoryView":1184 * cdef size_t size = slice_get_size(src, ndim) * * result = malloc(size) # <<<<<<<<<<<<<< @@ -14715,7 +15319,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_result = malloc(__pyx_v_size); - /* "View.MemoryView":1182 + /* "View.MemoryView":1185 * * result = malloc(size) * if not result: # <<<<<<<<<<<<<< @@ -14725,19 +15329,19 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1183 + /* "View.MemoryView":1186 * result = malloc(size) * if not result: * _err(MemoryError, NULL) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "View.MemoryView":1186 + /* "View.MemoryView":1189 * * * tmpslice.data = result # <<<<<<<<<<<<<< @@ -14746,7 +15350,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "View.MemoryView":1187 + /* "View.MemoryView":1190 * * tmpslice.data = result * tmpslice.memview = src.memview # <<<<<<<<<<<<<< @@ -14756,7 +15360,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_4 = __pyx_v_src->memview; __pyx_v_tmpslice->memview = __pyx_t_4; - /* "View.MemoryView":1188 + /* "View.MemoryView":1191 * tmpslice.data = result * tmpslice.memview = src.memview * for i in range(ndim): # <<<<<<<<<<<<<< @@ -14767,7 +15371,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":1189 + /* "View.MemoryView":1192 * tmpslice.memview = src.memview * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< @@ -14776,7 +15380,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - /* "View.MemoryView":1190 + /* "View.MemoryView":1193 * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< @@ -14786,16 +15390,16 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1; } - /* "View.MemoryView":1193 - * - * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, - * ndim, order) # <<<<<<<<<<<<<< + /* "View.MemoryView":1195 + * tmpslice.suboffsets[i] = -1 * + * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< + * ndim, order) * */ __pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order); - /* "View.MemoryView":1196 + /* "View.MemoryView":1199 * * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -14806,7 +15410,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":1197 + /* "View.MemoryView":1200 * * for i in range(ndim): * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< @@ -14816,7 +15420,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1198 + /* "View.MemoryView":1201 * for i in range(ndim): * if tmpslice.shape[i] == 1: * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< @@ -14829,7 +15433,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_L8:; } - /* "View.MemoryView":1200 + /* "View.MemoryView":1203 * tmpslice.strides[i] = 0 * * if slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< @@ -14839,7 +15443,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1201 + /* "View.MemoryView":1204 * * if slice_is_contig(src, order, ndim): * memcpy(result, src.data, size) # <<<<<<<<<<<<<< @@ -14851,7 +15455,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, } /*else*/ { - /* "View.MemoryView":1203 + /* "View.MemoryView":1206 * memcpy(result, src.data, size) * else: * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< @@ -14862,7 +15466,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, } __pyx_L9:; - /* "View.MemoryView":1205 + /* "View.MemoryView":1208 * copy_strided_to_strided(src, tmpslice, ndim, itemsize) * * return result # <<<<<<<<<<<<<< @@ -14872,8 +15476,15 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_r = __pyx_v_result; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1170 + * + * @cname('__pyx_memoryview_copy_data_to_temp') + * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice *tmpslice, + * char order, + */ + + /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD @@ -14889,7 +15500,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, return __pyx_r; } -/* "View.MemoryView":1210 +/* "View.MemoryView":1213 * * @cname('__pyx_memoryview_err_extents') * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< @@ -14912,20 +15523,20 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent #endif __Pyx_RefNannySetupContext("_err_extents", 0); - /* "View.MemoryView":1213 + /* "View.MemoryView":1216 * Py_ssize_t extent2) except -1 with gil: * raise ValueError("got differing extents in dimension %d (got %d and %d)" % * (i, extent1, extent2)) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_err_dim') */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -14936,23 +15547,38 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "View.MemoryView":1215 + * cdef int _err_extents(int i, Py_ssize_t extent1, + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< + * (i, extent1, extent2)) + * + */ + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1213 + * + * @cname('__pyx_memoryview_err_extents') + * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< + * Py_ssize_t extent2) except -1 with gil: + * raise ValueError("got differing extents in dimension %d (got %d and %d)" % + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -14960,7 +15586,6 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __pyx_L0:; __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); @@ -14968,7 +15593,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent return __pyx_r; } -/* "View.MemoryView":1216 +/* "View.MemoryView":1219 * * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< @@ -14991,42 +15616,48 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, __Pyx_RefNannySetupContext("_err_dim", 0); __Pyx_INCREF(__pyx_v_error); - /* "View.MemoryView":1217 + /* "View.MemoryView":1220 * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_err') */ - __pyx_t_1 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_t_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyUnicode_Format(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_v_error, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_v_error, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1219 + * + * @cname('__pyx_memoryview_err_dim') + * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< + * raise error(msg.decode('ascii') % dim) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __pyx_L0:; __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD @@ -15035,7 +15666,7 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, return __pyx_r; } -/* "View.MemoryView":1220 +/* "View.MemoryView":1223 * * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< @@ -15058,7 +15689,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __Pyx_RefNannySetupContext("_err", 0); __Pyx_INCREF(__pyx_v_error); - /* "View.MemoryView":1221 + /* "View.MemoryView":1224 * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: # <<<<<<<<<<<<<< @@ -15068,31 +15699,30 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1222 + /* "View.MemoryView":1225 * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< * else: * raise error */ - __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_v_error, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_v_error, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } /*else*/ { - /* "View.MemoryView":1224 + /* "View.MemoryView":1227 * raise error(msg.decode('ascii')) * else: * raise error # <<<<<<<<<<<<<< @@ -15100,18 +15730,23 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { * @cname('__pyx_memoryview_copy_contents') */ __Pyx_Raise(__pyx_v_error, 0, 0, 0); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1223 + * + * @cname('__pyx_memoryview_err') + * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< + * if msg != NULL: + * raise error(msg.decode('ascii')) + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __pyx_L0:; __Pyx_XDECREF(__pyx_v_error); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD @@ -15120,7 +15755,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { return __pyx_r; } -/* "View.MemoryView":1227 +/* "View.MemoryView":1230 * * @cname('__pyx_memoryview_copy_contents') * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< @@ -15149,7 +15784,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ const char *__pyx_filename = NULL; int __pyx_clineno = 0; - /* "View.MemoryView":1235 + /* "View.MemoryView":1238 * Check for overlapping memory and verify the shapes. * """ * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< @@ -15158,7 +15793,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_tmpdata = NULL; - /* "View.MemoryView":1236 + /* "View.MemoryView":1239 * """ * cdef void *tmpdata = NULL * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -15168,7 +15803,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_1 = __pyx_v_src.memview->view.itemsize; __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":1238 + /* "View.MemoryView":1241 * cdef size_t itemsize = src.memview.view.itemsize * cdef int i * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< @@ -15177,7 +15812,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - /* "View.MemoryView":1239 + /* "View.MemoryView":1242 * cdef int i * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False # <<<<<<<<<<<<<< @@ -15186,7 +15821,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_broadcasting = 0; - /* "View.MemoryView":1240 + /* "View.MemoryView":1243 * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False * cdef bint direct_copy = False # <<<<<<<<<<<<<< @@ -15195,7 +15830,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_direct_copy = 0; - /* "View.MemoryView":1243 + /* "View.MemoryView":1246 * cdef __Pyx_memviewslice tmp * * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< @@ -15205,7 +15840,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1244 + /* "View.MemoryView":1247 * * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< @@ -15216,7 +15851,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L3; } - /* "View.MemoryView":1245 + /* "View.MemoryView":1248 * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< @@ -15226,7 +15861,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1246 + /* "View.MemoryView":1249 * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< @@ -15238,7 +15873,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L3:; - /* "View.MemoryView":1248 + /* "View.MemoryView":1251 * broadcast_leading(&dst, dst_ndim, src_ndim) * * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< @@ -15254,7 +15889,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_v_ndim = __pyx_t_5; - /* "View.MemoryView":1250 + /* "View.MemoryView":1253 * cdef int ndim = max(src_ndim, dst_ndim) * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -15265,7 +15900,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1251 + /* "View.MemoryView":1254 * * for i in range(ndim): * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< @@ -15275,7 +15910,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1252 + /* "View.MemoryView":1255 * for i in range(ndim): * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: # <<<<<<<<<<<<<< @@ -15285,7 +15920,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1253 + /* "View.MemoryView":1256 * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: * broadcasting = True # <<<<<<<<<<<<<< @@ -15294,7 +15929,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_broadcasting = 1; - /* "View.MemoryView":1254 + /* "View.MemoryView":1257 * if src.shape[i] == 1: * broadcasting = True * src.strides[i] = 0 # <<<<<<<<<<<<<< @@ -15306,21 +15941,21 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } /*else*/ { - /* "View.MemoryView":1256 + /* "View.MemoryView":1259 * src.strides[i] = 0 * else: * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< * * if src.suboffsets[i] >= 0: */ - __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L7:; goto __pyx_L6; } __pyx_L6:; - /* "View.MemoryView":1258 + /* "View.MemoryView":1261 * _err_extents(i, dst.shape[i], src.shape[i]) * * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< @@ -15330,20 +15965,20 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1259 + /* "View.MemoryView":1262 * * if src.suboffsets[i] >= 0: * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< * * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_47, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_Dimension_d_is_not_direct, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; } - /* "View.MemoryView":1261 + /* "View.MemoryView":1264 * _err_dim(ValueError, "Dimension %d is not direct", i) * * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< @@ -15353,7 +15988,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1263 + /* "View.MemoryView":1266 * if slices_overlap(&src, &dst, ndim, itemsize): * * if not slice_is_contig(&src, order, ndim): # <<<<<<<<<<<<<< @@ -15363,7 +15998,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((!(__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim) != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1264 + /* "View.MemoryView":1267 * * if not slice_is_contig(&src, order, ndim): * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< @@ -15375,17 +16010,17 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L10:; - /* "View.MemoryView":1266 + /* "View.MemoryView":1269 * order = get_best_order(&dst, ndim) * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< * src = tmp * */ - __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_tmpdata = __pyx_t_6; - /* "View.MemoryView":1267 + /* "View.MemoryView":1270 * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) * src = tmp # <<<<<<<<<<<<<< @@ -15397,7 +16032,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L9:; - /* "View.MemoryView":1269 + /* "View.MemoryView":1272 * src = tmp * * if not broadcasting: # <<<<<<<<<<<<<< @@ -15407,7 +16042,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1272 + /* "View.MemoryView":1275 * * * if slice_is_contig(&src, 'C', ndim): # <<<<<<<<<<<<<< @@ -15417,7 +16052,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1273 + /* "View.MemoryView":1276 * * if slice_is_contig(&src, 'C', ndim): * direct_copy = slice_is_contig(&dst, 'C', ndim) # <<<<<<<<<<<<<< @@ -15428,7 +16063,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L12; } - /* "View.MemoryView":1274 + /* "View.MemoryView":1277 * if slice_is_contig(&src, 'C', ndim): * direct_copy = slice_is_contig(&dst, 'C', ndim) * elif slice_is_contig(&src, 'F', ndim): # <<<<<<<<<<<<<< @@ -15438,7 +16073,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1275 + /* "View.MemoryView":1278 * direct_copy = slice_is_contig(&dst, 'C', ndim) * elif slice_is_contig(&src, 'F', ndim): * direct_copy = slice_is_contig(&dst, 'F', ndim) # <<<<<<<<<<<<<< @@ -15450,7 +16085,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L12:; - /* "View.MemoryView":1277 + /* "View.MemoryView":1280 * direct_copy = slice_is_contig(&dst, 'F', ndim) * * if direct_copy: # <<<<<<<<<<<<<< @@ -15460,7 +16095,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_v_direct_copy != 0); if (__pyx_t_2) { - /* "View.MemoryView":1279 + /* "View.MemoryView":1282 * if direct_copy: * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -15469,7 +16104,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1280 + /* "View.MemoryView":1283 * * refcount_copying(&dst, dtype_is_object, ndim, False) * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< @@ -15478,7 +16113,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)); - /* "View.MemoryView":1281 + /* "View.MemoryView":1284 * refcount_copying(&dst, dtype_is_object, ndim, False) * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -15487,7 +16122,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":1282 + /* "View.MemoryView":1285 * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) * return 0 # <<<<<<<<<<<<<< @@ -15496,14 +16131,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; } - __pyx_L13:; goto __pyx_L11; } __pyx_L11:; - /* "View.MemoryView":1284 + /* "View.MemoryView":1287 * return 0 * * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< @@ -15517,28 +16150,28 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_7 = (__pyx_t_2 != 0); if (__pyx_t_7) { - /* "View.MemoryView":1287 + /* "View.MemoryView":1290 * * * transpose_memslice(&src) # <<<<<<<<<<<<<< * transpose_memslice(&dst) * */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "View.MemoryView":1288 + /* "View.MemoryView":1291 * * transpose_memslice(&src) * transpose_memslice(&dst) # <<<<<<<<<<<<<< * * refcount_copying(&dst, dtype_is_object, ndim, False) */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; - /* "View.MemoryView":1290 + /* "View.MemoryView":1293 * transpose_memslice(&dst) * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -15547,7 +16180,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1291 + /* "View.MemoryView":1294 * * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< @@ -15556,7 +16189,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":1292 + /* "View.MemoryView":1295 * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -15565,7 +16198,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":1294 + /* "View.MemoryView":1297 * refcount_copying(&dst, dtype_is_object, ndim, True) * * free(tmpdata) # <<<<<<<<<<<<<< @@ -15574,7 +16207,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ free(__pyx_v_tmpdata); - /* "View.MemoryView":1295 + /* "View.MemoryView":1298 * * free(tmpdata) * return 0 # <<<<<<<<<<<<<< @@ -15584,8 +16217,15 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "View.MemoryView":1230 + * + * @cname('__pyx_memoryview_copy_contents') + * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< + * __Pyx_memviewslice dst, + * int src_ndim, int dst_ndim, + */ + + /* function exit code */ __pyx_L1_error:; { #ifdef WITH_THREAD @@ -15601,7 +16241,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ return __pyx_r; } -/* "View.MemoryView":1298 +/* "View.MemoryView":1301 * * @cname('__pyx_memoryview_broadcast_leading') * cdef void broadcast_leading(__Pyx_memviewslice *slice, # <<<<<<<<<<<<<< @@ -15615,7 +16255,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice int __pyx_t_1; int __pyx_t_2; - /* "View.MemoryView":1302 + /* "View.MemoryView":1305 * int ndim_other) nogil: * cdef int i * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< @@ -15624,7 +16264,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "View.MemoryView":1304 + /* "View.MemoryView":1307 * cdef int offset = ndim_other - ndim * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -15634,7 +16274,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":1305 + /* "View.MemoryView":1308 * * for i in range(ndim - 1, -1, -1): * slice.shape[i + offset] = slice.shape[i] # <<<<<<<<<<<<<< @@ -15643,7 +16283,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ (__pyx_v_slice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_slice->shape[__pyx_v_i]); - /* "View.MemoryView":1306 + /* "View.MemoryView":1309 * for i in range(ndim - 1, -1, -1): * slice.shape[i + offset] = slice.shape[i] * slice.strides[i + offset] = slice.strides[i] # <<<<<<<<<<<<<< @@ -15652,7 +16292,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ (__pyx_v_slice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_slice->strides[__pyx_v_i]); - /* "View.MemoryView":1307 + /* "View.MemoryView":1310 * slice.shape[i + offset] = slice.shape[i] * slice.strides[i + offset] = slice.strides[i] * slice.suboffsets[i + offset] = slice.suboffsets[i] # <<<<<<<<<<<<<< @@ -15662,7 +16302,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice (__pyx_v_slice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_slice->suboffsets[__pyx_v_i]); } - /* "View.MemoryView":1309 + /* "View.MemoryView":1312 * slice.suboffsets[i + offset] = slice.suboffsets[i] * * for i in range(offset): # <<<<<<<<<<<<<< @@ -15673,7 +16313,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":1310 + /* "View.MemoryView":1313 * * for i in range(offset): * slice.shape[i] = 1 # <<<<<<<<<<<<<< @@ -15682,7 +16322,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ (__pyx_v_slice->shape[__pyx_v_i]) = 1; - /* "View.MemoryView":1311 + /* "View.MemoryView":1314 * for i in range(offset): * slice.shape[i] = 1 * slice.strides[i] = slice.strides[0] # <<<<<<<<<<<<<< @@ -15691,7 +16331,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice */ (__pyx_v_slice->strides[__pyx_v_i]) = (__pyx_v_slice->strides[0]); - /* "View.MemoryView":1312 + /* "View.MemoryView":1315 * slice.shape[i] = 1 * slice.strides[i] = slice.strides[0] * slice.suboffsets[i] = -1 # <<<<<<<<<<<<<< @@ -15701,9 +16341,18 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice (__pyx_v_slice->suboffsets[__pyx_v_i]) = -1; } + /* "View.MemoryView":1301 + * + * @cname('__pyx_memoryview_broadcast_leading') + * cdef void broadcast_leading(__Pyx_memviewslice *slice, # <<<<<<<<<<<<<< + * int ndim, + * int ndim_other) nogil: + */ + + /* function exit code */ } -/* "View.MemoryView":1320 +/* "View.MemoryView":1323 * * @cname('__pyx_memoryview_refcount_copying') * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< @@ -15714,7 +16363,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { int __pyx_t_1; - /* "View.MemoryView":1324 + /* "View.MemoryView":1327 * * * if dtype_is_object: # <<<<<<<<<<<<<< @@ -15724,21 +16373,30 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i __pyx_t_1 = (__pyx_v_dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":1326 + /* "View.MemoryView":1328 + * * if dtype_is_object: - * refcount_objects_in_slice_with_gil(dst.data, dst.shape, - * dst.strides, ndim, inc) # <<<<<<<<<<<<<< + * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< + * dst.strides, ndim, inc) * - * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') */ __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); goto __pyx_L3; } __pyx_L3:; + /* "View.MemoryView":1323 + * + * @cname('__pyx_memoryview_refcount_copying') + * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< + * int ndim, bint inc) nogil: + * + */ + + /* function exit code */ } -/* "View.MemoryView":1329 +/* "View.MemoryView":1332 * * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -15753,7 +16411,7 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da #endif __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - /* "View.MemoryView":1332 + /* "View.MemoryView":1335 * Py_ssize_t *strides, int ndim, * bint inc) with gil: * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< @@ -15762,13 +16420,22 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); + /* "View.MemoryView":1332 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') + * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * bint inc) with gil: + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif } -/* "View.MemoryView":1335 +/* "View.MemoryView":1338 * * @cname('__pyx_memoryview_refcount_objects_in_slice') * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -15784,7 +16451,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss int __pyx_t_3; __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - /* "View.MemoryView":1339 + /* "View.MemoryView":1342 * cdef Py_ssize_t i * * for i in range(shape[0]): # <<<<<<<<<<<<<< @@ -15795,7 +16462,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "View.MemoryView":1340 + /* "View.MemoryView":1343 * * for i in range(shape[0]): * if ndim == 1: # <<<<<<<<<<<<<< @@ -15805,7 +16472,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_t_3 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_3) { - /* "View.MemoryView":1341 + /* "View.MemoryView":1344 * for i in range(shape[0]): * if ndim == 1: * if inc: # <<<<<<<<<<<<<< @@ -15815,7 +16482,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_t_3 = (__pyx_v_inc != 0); if (__pyx_t_3) { - /* "View.MemoryView":1342 + /* "View.MemoryView":1345 * if ndim == 1: * if inc: * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< @@ -15827,7 +16494,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss } /*else*/ { - /* "View.MemoryView":1344 + /* "View.MemoryView":1347 * Py_INCREF(( data)[0]) * else: * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< @@ -15841,18 +16508,18 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss } /*else*/ { - /* "View.MemoryView":1347 + /* "View.MemoryView":1349 + * Py_DECREF(( data)[0]) * else: - * refcount_objects_in_slice(data, shape + 1, strides + 1, - * ndim - 1, inc) # <<<<<<<<<<<<<< + * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< + * ndim - 1, inc) * - * data += strides[0] */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc); } __pyx_L5:; - /* "View.MemoryView":1349 + /* "View.MemoryView":1352 * ndim - 1, inc) * * data += strides[0] # <<<<<<<<<<<<<< @@ -15862,10 +16529,19 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); } + /* "View.MemoryView":1338 + * + * @cname('__pyx_memoryview_refcount_objects_in_slice') + * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, bint inc): + * cdef Py_ssize_t i + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":1355 +/* "View.MemoryView":1358 * * @cname('__pyx_memoryview_slice_assign_scalar') * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< @@ -15875,7 +16551,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - /* "View.MemoryView":1358 + /* "View.MemoryView":1361 * size_t itemsize, void *item, * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -15884,16 +16560,16 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst */ __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1360 + /* "View.MemoryView":1362 + * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) - * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, - * itemsize, item) # <<<<<<<<<<<<<< + * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< + * itemsize, item) * refcount_copying(dst, dtype_is_object, ndim, True) - * */ __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":1361 + /* "View.MemoryView":1364 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, * itemsize, item) * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -15902,9 +16578,18 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst */ __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); + /* "View.MemoryView":1358 + * + * @cname('__pyx_memoryview_slice_assign_scalar') + * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< + * size_t itemsize, void *item, + * bint dtype_is_object) nogil: + */ + + /* function exit code */ } -/* "View.MemoryView":1365 +/* "View.MemoryView":1368 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -15920,7 +16605,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t Py_ssize_t __pyx_t_2; Py_ssize_t __pyx_t_3; - /* "View.MemoryView":1369 + /* "View.MemoryView":1372 * size_t itemsize, void *item) nogil: * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< @@ -15929,7 +16614,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":1370 + /* "View.MemoryView":1373 * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< @@ -15938,7 +16623,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __pyx_v_extent = (__pyx_v_shape[0]); - /* "View.MemoryView":1372 + /* "View.MemoryView":1375 * cdef Py_ssize_t extent = shape[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -15948,7 +16633,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1373 + /* "View.MemoryView":1376 * * if ndim == 1: * for i in range(extent): # <<<<<<<<<<<<<< @@ -15959,7 +16644,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1374 + /* "View.MemoryView":1377 * if ndim == 1: * for i in range(extent): * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< @@ -15968,7 +16653,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize); - /* "View.MemoryView":1375 + /* "View.MemoryView":1378 * for i in range(extent): * memcpy(data, item, itemsize) * data += stride # <<<<<<<<<<<<<< @@ -15981,7 +16666,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t } /*else*/ { - /* "View.MemoryView":1377 + /* "View.MemoryView":1380 * data += stride * else: * for i in range(extent): # <<<<<<<<<<<<<< @@ -15992,16 +16677,16 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1379 + /* "View.MemoryView":1381 + * else: * for i in range(extent): - * _slice_assign_scalar(data, shape + 1, strides + 1, - * ndim - 1, itemsize, item) # <<<<<<<<<<<<<< + * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< + * ndim - 1, itemsize, item) * data += stride - * */ __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":1380 + /* "View.MemoryView":1383 * _slice_assign_scalar(data, shape + 1, strides + 1, * ndim - 1, itemsize, item) * data += stride # <<<<<<<<<<<<<< @@ -16013,13 +16698,26 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t } __pyx_L3:; + /* "View.MemoryView":1368 + * + * @cname('__pyx_memoryview__slice_assign_scalar') + * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< + * Py_ssize_t *strides, int ndim, + * size_t itemsize, void *item) nogil: + */ + + /* function exit code */ } static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_memoryview_obj *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; p = ((struct __pyx_memoryview_obj *)o); p->__pyx_vtab = __pyx_vtabptr_memoryview; @@ -16035,13 +16733,17 @@ static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject static void __pyx_tp_dealloc_memoryview(PyObject *o) { struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_memoryview___dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -16070,8 +16772,8 @@ static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) { } static int __pyx_tp_clear_memoryview(PyObject *o) { - struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; PyObject* tmp; + struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o; tmp = ((PyObject*)p->obj); p->obj = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -16098,7 +16800,7 @@ static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject } else { PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); return -1; } } @@ -16254,7 +16956,7 @@ static PyTypeObject __pyx_type___pyx_memoryview = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -16262,7 +16964,11 @@ static PyTypeObject __pyx_type___pyx_memoryview = { static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_array_obj *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; p = ((struct __pyx_array_obj *)o); p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); @@ -16275,13 +16981,16 @@ static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) { static void __pyx_tp_dealloc_array(PyObject *o) { struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - PyObject_GC_UnTrack(o); + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_array___dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -16289,30 +16998,6 @@ static void __pyx_tp_dealloc_array(PyObject *o) { Py_CLEAR(p->_format); (*Py_TYPE(o)->tp_free)(o); } - -static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - if (p->mode) { - e = (*v)(p->mode, a); if (e) return e; - } - if (p->_format) { - e = (*v)(p->_format, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_array(PyObject *o) { - struct __pyx_array_obj *p = (struct __pyx_array_obj *)o; - PyObject* tmp; - tmp = ((PyObject*)p->mode); - p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->_format); - p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) { PyObject *r; PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; @@ -16327,7 +17012,7 @@ static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) { } else { PyErr_Format(PyExc_NotImplementedError, - "Subscript deletion not supported by %s", Py_TYPE(o)->tp_name); + "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name); return -1; } } @@ -16419,10 +17104,10 @@ static PyTypeObject __pyx_type___pyx_array = { __pyx_tp_getattro_array, /*tp_getattro*/ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_array, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_array, /*tp_traverse*/ - __pyx_tp_clear_array, /*tp_clear*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ @@ -16449,7 +17134,7 @@ static PyTypeObject __pyx_type___pyx_array = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -16457,7 +17142,11 @@ static PyTypeObject __pyx_type___pyx_array = { static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_MemviewEnum_obj *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; p = ((struct __pyx_MemviewEnum_obj *)o); p->name = Py_None; Py_INCREF(Py_None); @@ -16466,6 +17155,11 @@ static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, C static void __pyx_tp_dealloc_Enum(PyObject *o) { struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->name); (*Py_TYPE(o)->tp_free)(o); @@ -16481,8 +17175,8 @@ static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) { } static int __pyx_tp_clear_Enum(PyObject *o) { - struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; PyObject* tmp; + struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o; tmp = ((PyObject*)p->name); p->name = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -16547,7 +17241,7 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -16566,13 +17260,17 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_memoryviewslice___dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -16592,8 +17290,8 @@ static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) } static int __pyx_tp_clear__memoryviewslice(PyObject *o) { - struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; PyObject* tmp; + struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o; __pyx_tp_clear_memoryview(o); tmp = ((PyObject*)p->from_object); p->from_object = Py_None; Py_INCREF(Py_None); @@ -16677,7 +17375,7 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -16706,142 +17404,141 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, - {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, - {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, - {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, - {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, - {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, - {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, - {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0}, - {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, - {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, - {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, - {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0}, - {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, - {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0}, - {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0}, - {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0}, - {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0}, - {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0}, - {&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0}, - {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 0}, - {&__pyx_n_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 1}, - {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0}, - {&__pyx_kp_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 0}, - {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0}, - {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0}, - {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0}, - {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, - {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, - {&__pyx_n_s__ASCII, __pyx_k__ASCII, sizeof(__pyx_k__ASCII), 0, 0, 1, 1}, - {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, - {&__pyx_n_s__Ellipsis, __pyx_k__Ellipsis, sizeof(__pyx_k__Ellipsis), 0, 0, 1, 1}, - {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, - {&__pyx_n_s__K, __pyx_k__K, sizeof(__pyx_k__K), 0, 0, 1, 1}, - {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1}, - {&__pyx_n_b__O, __pyx_k__O, sizeof(__pyx_k__O), 0, 0, 0, 1}, - {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, - {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, - {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, - {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, - {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, - {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, - {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1}, - {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, - {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, - {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s___random_sample_mask, __pyx_k___random_sample_mask, sizeof(__pyx_k___random_sample_mask), 0, 0, 1, 1}, - {&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1}, - {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__bool, __pyx_k__bool, sizeof(__pyx_k__bool), 0, 0, 1, 1}, - {&__pyx_n_b__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 0, 1}, - {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, - {&__pyx_n_u__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 1, 0, 1}, - {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1}, - {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, - {&__pyx_n_s__dtype_is_object, __pyx_k__dtype_is_object, sizeof(__pyx_k__dtype_is_object), 0, 0, 1, 1}, - {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1}, - {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, - {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1}, - {&__pyx_n_s__estimators, __pyx_k__estimators, sizeof(__pyx_k__estimators), 0, 0, 1, 1}, - {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1}, - {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1}, - {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1}, - {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_b__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 0, 1}, - {&__pyx_n_s__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 1, 1}, - {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, - {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, - {&__pyx_n_s__int8, __pyx_k__int8, sizeof(__pyx_k__int8), 0, 0, 1, 1}, - {&__pyx_n_s__intp, __pyx_k__intp, sizeof(__pyx_k__intp), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, - {&__pyx_n_s__learn_rate, __pyx_k__learn_rate, sizeof(__pyx_k__learn_rate), 0, 0, 1, 1}, - {&__pyx_n_s__memview, __pyx_k__memview, sizeof(__pyx_k__memview), 0, 0, 1, 1}, - {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, - {&__pyx_n_s__n_bagged, __pyx_k__n_bagged, sizeof(__pyx_k__n_bagged), 0, 0, 1, 1}, - {&__pyx_n_s__n_estimators, __pyx_k__n_estimators, sizeof(__pyx_k__n_estimators), 0, 0, 1, 1}, - {&__pyx_n_s__n_total_in_bag, __pyx_k__n_total_in_bag, sizeof(__pyx_k__n_total_in_bag), 0, 0, 1, 1}, - {&__pyx_n_s__n_total_samples, __pyx_k__n_total_samples, sizeof(__pyx_k__n_total_samples), 0, 0, 1, 1}, - {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, - {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, - {&__pyx_n_s__np_bool, __pyx_k__np_bool, sizeof(__pyx_k__np_bool), 0, 0, 1, 1}, - {&__pyx_n_s__np_float32, __pyx_k__np_float32, sizeof(__pyx_k__np_float32), 0, 0, 1, 1}, - {&__pyx_n_s__np_float64, __pyx_k__np_float64, sizeof(__pyx_k__np_float64), 0, 0, 1, 1}, - {&__pyx_n_s__np_int8, __pyx_k__np_int8, sizeof(__pyx_k__np_int8), 0, 0, 1, 1}, - {&__pyx_n_s__np_intp, __pyx_k__np_intp, sizeof(__pyx_k__np_intp), 0, 0, 1, 1}, - {&__pyx_n_s__np_ones, __pyx_k__np_ones, sizeof(__pyx_k__np_ones), 0, 0, 1, 1}, - {&__pyx_n_s__np_zeros, __pyx_k__np_zeros, sizeof(__pyx_k__np_zeros), 0, 0, 1, 1}, - {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, - {&__pyx_n_s__ones, __pyx_k__ones, sizeof(__pyx_k__ones), 0, 0, 1, 1}, - {&__pyx_n_s__out, __pyx_k__out, sizeof(__pyx_k__out), 0, 0, 1, 1}, - {&__pyx_n_s__pack, __pyx_k__pack, sizeof(__pyx_k__pack), 0, 0, 1, 1}, - {&__pyx_n_s__predict_stage, __pyx_k__predict_stage, sizeof(__pyx_k__predict_stage), 0, 0, 1, 1}, - {&__pyx_n_s__predict_stages, __pyx_k__predict_stages, sizeof(__pyx_k__predict_stages), 0, 0, 1, 1}, - {&__pyx_n_s__rand, __pyx_k__rand, sizeof(__pyx_k__rand), 0, 0, 1, 1}, - {&__pyx_n_s__random_state, __pyx_k__random_state, sizeof(__pyx_k__random_state), 0, 0, 1, 1}, - {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__sample_mask, __pyx_k__sample_mask, sizeof(__pyx_k__sample_mask), 0, 0, 1, 1}, - {&__pyx_n_s__scale, __pyx_k__scale, sizeof(__pyx_k__scale), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__stage, __pyx_k__stage, sizeof(__pyx_k__stage), 0, 0, 1, 1}, - {&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1}, - {&__pyx_n_s__step, __pyx_k__step, sizeof(__pyx_k__step), 0, 0, 1, 1}, - {&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1}, - {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1}, - {&__pyx_n_s__target_feature, __pyx_k__target_feature, sizeof(__pyx_k__target_feature), 0, 0, 1, 1}, - {&__pyx_n_s__tree, __pyx_k__tree, sizeof(__pyx_k__tree), 0, 0, 1, 1}, - {&__pyx_n_s__tree_, __pyx_k__tree_, sizeof(__pyx_k__tree_), 0, 0, 1, 1}, - {&__pyx_n_s__unpack, __pyx_k__unpack, sizeof(__pyx_k__unpack), 0, 0, 1, 1}, - {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1}, - {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, + {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0}, + {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0}, + {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0}, + {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1}, + {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1}, + {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, + {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, + {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, + {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, + {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, + {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, + {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0}, + {&__pyx_n_s_K, __pyx_k_K, sizeof(__pyx_k_K), 0, 0, 1, 1}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0}, + {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0}, + {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, + {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1}, + {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0}, + {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Total_weight_should_be_1_0_but_w, __pyx_k_Total_weight_should_be_1_0_but_w, sizeof(__pyx_k_Total_weight_should_be_1_0_but_w), 0, 0, 1, 0}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1}, + {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 0, 1, 1}, + {&__pyx_n_b_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 0, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, + {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1}, + {&__pyx_n_s_estimators, __pyx_k_estimators, sizeof(__pyx_k_estimators), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_b_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 0, 1}, + {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1}, + {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0}, + {&__pyx_kp_s_home_larsb_src_scikit_learn_skl, __pyx_k_home_larsb_src_scikit_learn_skl, sizeof(__pyx_k_home_larsb_src_scikit_learn_skl), 0, 0, 1, 0}, + {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, + {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1}, + {&__pyx_n_s_intp, __pyx_k_intp, sizeof(__pyx_k_intp), 0, 0, 1, 1}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0}, + {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1}, + {&__pyx_n_s_learn_rate, __pyx_k_learn_rate, sizeof(__pyx_k_learn_rate), 0, 0, 1, 1}, + {&__pyx_kp_s_left_sample_frac_f_n_samples_cur, __pyx_k_left_sample_frac_f_n_samples_cur, sizeof(__pyx_k_left_sample_frac_f_n_samples_cur), 0, 0, 1, 0}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_n_bagged, __pyx_k_n_bagged, sizeof(__pyx_k_n_bagged), 0, 0, 1, 1}, + {&__pyx_n_s_n_estimators, __pyx_k_n_estimators, sizeof(__pyx_k_n_estimators), 0, 0, 1, 1}, + {&__pyx_n_s_n_total_in_bag, __pyx_k_n_total_in_bag, sizeof(__pyx_k_n_total_in_bag), 0, 0, 1, 1}, + {&__pyx_n_s_n_total_samples, __pyx_k_n_total_samples, sizeof(__pyx_k_n_total_samples), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, + {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_np_bool, __pyx_k_np_bool, sizeof(__pyx_k_np_bool), 0, 0, 1, 1}, + {&__pyx_n_s_np_float32, __pyx_k_np_float32, sizeof(__pyx_k_np_float32), 0, 0, 1, 1}, + {&__pyx_n_s_np_float64, __pyx_k_np_float64, sizeof(__pyx_k_np_float64), 0, 0, 1, 1}, + {&__pyx_n_s_np_int8, __pyx_k_np_int8, sizeof(__pyx_k_np_int8), 0, 0, 1, 1}, + {&__pyx_n_s_np_intp, __pyx_k_np_intp, sizeof(__pyx_k_np_intp), 0, 0, 1, 1}, + {&__pyx_n_s_np_ones, __pyx_k_np_ones, sizeof(__pyx_k_np_ones), 0, 0, 1, 1}, + {&__pyx_n_s_np_zeros, __pyx_k_np_zeros, sizeof(__pyx_k_np_zeros), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, + {&__pyx_n_s_ones, __pyx_k_ones, sizeof(__pyx_k_ones), 0, 0, 1, 1}, + {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_predict_stage, __pyx_k_predict_stage, sizeof(__pyx_k_predict_stage), 0, 0, 1, 1}, + {&__pyx_n_s_predict_stages, __pyx_k_predict_stages, sizeof(__pyx_k_predict_stages), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_releasebuffer, __pyx_k_pyx_releasebuffer, sizeof(__pyx_k_pyx_releasebuffer), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_rand, __pyx_k_rand, sizeof(__pyx_k_rand), 0, 0, 1, 1}, + {&__pyx_n_s_random_sample_mask, __pyx_k_random_sample_mask, sizeof(__pyx_k_random_sample_mask), 0, 0, 1, 1}, + {&__pyx_n_s_random_state, __pyx_k_random_state, sizeof(__pyx_k_random_state), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_sample_mask, __pyx_k_sample_mask, sizeof(__pyx_k_sample_mask), 0, 0, 1, 1}, + {&__pyx_n_s_scale, __pyx_k_scale, sizeof(__pyx_k_scale), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, + {&__pyx_n_s_sklearn_ensemble__gradient_boost, __pyx_k_sklearn_ensemble__gradient_boost, sizeof(__pyx_k_sklearn_ensemble__gradient_boost), 0, 0, 1, 1}, + {&__pyx_n_s_stage, __pyx_k_stage, sizeof(__pyx_k_stage), 0, 0, 1, 1}, + {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, + {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1}, + {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, + {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0}, + {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_target_feature, __pyx_k_target_feature, sizeof(__pyx_k_target_feature), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_tree, __pyx_k_tree, sizeof(__pyx_k_tree), 0, 0, 1, 1}, + {&__pyx_n_s_tree_2, __pyx_k_tree_2, sizeof(__pyx_k_tree_2), 0, 0, 1, 1}, + {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0}, + {&__pyx_kp_s_unable_to_allocate_shape_or_stri, __pyx_k_unable_to_allocate_shape_or_stri, sizeof(__pyx_k_unable_to_allocate_shape_or_stri), 0, 0, 1, 0}, + {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, + {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1}, + {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 - __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -16851,71 +17548,71 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numpy.pxd":215 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_4); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); - /* "numpy.pxd":219 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_6); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); - /* "numpy.pxd":257 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_8); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); - /* "numpy.pxd":799 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799 * - * if (end - f) - (new_offset - offset[0]) < 15: + * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_10)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_11); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); - /* "numpy.pxd":803 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_12); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); - /* "numpy.pxd":823 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_14); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); /* "View.MemoryView":124 * @@ -16924,9 +17621,9 @@ static int __Pyx_InitCachedConstants(void) { * * if self.itemsize <= 0: */ - __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_16); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); /* "View.MemoryView":127 * @@ -16935,9 +17632,9 @@ static int __Pyx_InitCachedConstants(void) { * * encode = getattr(format, 'encode', None) */ - __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_18); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); /* "View.MemoryView":131 * encode = getattr(format, 'encode', None) @@ -16946,9 +17643,9 @@ static int __Pyx_InitCachedConstants(void) { * self._format = format * self.format = self._format */ - __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_19); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_ASCII); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); /* "View.MemoryView":141 * free(self._shape) @@ -16957,9 +17654,9 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_21); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_or_stri); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); /* "View.MemoryView":166 * decode = getattr(mode, 'decode', None) @@ -16968,9 +17665,9 @@ static int __Pyx_InitCachedConstants(void) { * self.mode = mode * */ - __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__ASCII)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_24); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_ASCII); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); /* "View.MemoryView":174 * self.data = malloc(self.len) @@ -16979,9 +17676,9 @@ static int __Pyx_InitCachedConstants(void) { * * if self.dtype_is_object: */ - __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_25)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_26); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); /* "View.MemoryView":190 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS @@ -16990,75 +17687,75 @@ static int __Pyx_InitCachedConstants(void) { * info.buf = self.data * info.len = self.len */ - __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_27)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_28); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); - /* "View.MemoryView":452 + /* "View.MemoryView":453 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< * else: * if len(self.view.format) == 1: */ - __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_29)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_30); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); - /* "View.MemoryView":528 + /* "View.MemoryView":529 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([self.view.strides[i] for i in xrange(self.view.ndim)]) */ - __pyx_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_31)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_32); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); - /* "View.MemoryView":643 + /* "View.MemoryView":646 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ - __pyx_k_tuple_35 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_35); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); + __pyx_tuple__16 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); - /* "View.MemoryView":646 + /* "View.MemoryView":649 * seen_ellipsis = True * else: * result.append(slice(None)) # <<<<<<<<<<<<<< * have_slices = True * else: */ - __pyx_k_tuple_36 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_36); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); + __pyx_tuple__17 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); - /* "View.MemoryView":657 + /* "View.MemoryView":660 * nslices = ndim - len(result) * if nslices: * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< * * return have_slices or nslices, tuple(result) */ - __pyx_k_tuple_38 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_38); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); + __pyx_tuple__18 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); - /* "View.MemoryView":665 + /* "View.MemoryView":668 * for i in range(ndim): * if suboffsets[i] >= 0: * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< * * */ - __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_39)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_40); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); /* "sklearn/ensemble/_gradient_boosting.pyx":103 * @@ -17067,10 +17764,10 @@ static int __Pyx_InitCachedConstants(void) { * np.ndarray[DTYPE_t, ndim=2, mode='c'] X, double scale, * np.ndarray[float64, ndim=2] out): */ - __pyx_k_tuple_48 = PyTuple_Pack(9, ((PyObject *)__pyx_n_s__estimators), ((PyObject *)__pyx_n_s__X), ((PyObject *)__pyx_n_s__scale), ((PyObject *)__pyx_n_s__out), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__k), ((PyObject *)__pyx_n_s__n_estimators), ((PyObject *)__pyx_n_s__K), ((PyObject *)__pyx_n_s__tree)); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_48); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48)); - __pyx_k_codeobj_49 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_50, __pyx_n_s__predict_stages, 103, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__20 = PyTuple_Pack(9, __pyx_n_s_estimators, __pyx_n_s_X, __pyx_n_s_scale, __pyx_n_s_out, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_n_estimators, __pyx_n_s_K, __pyx_n_s_tree_2); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_larsb_src_scikit_learn_skl, __pyx_n_s_predict_stages, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/ensemble/_gradient_boosting.pyx":133 * @@ -17079,10 +17776,10 @@ static int __Pyx_InitCachedConstants(void) { * int stage, * np.ndarray[DTYPE_t, ndim=2] X, double scale, */ - __pyx_k_tuple_52 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__estimators), ((PyObject *)__pyx_n_s__stage), ((PyObject *)__pyx_n_s__X), ((PyObject *)__pyx_n_s__scale), ((PyObject *)__pyx_n_s__out)); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_52); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52)); - __pyx_k_codeobj_53 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_50, __pyx_n_s__predict_stage, 133, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__22 = PyTuple_Pack(5, __pyx_n_s_estimators, __pyx_n_s_stage, __pyx_n_s_X, __pyx_n_s_scale, __pyx_n_s_out); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_larsb_src_scikit_learn_skl, __pyx_n_s_predict_stage, 133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/ensemble/_gradient_boosting.pyx":270 * @@ -17091,10 +17788,10 @@ static int __Pyx_InitCachedConstants(void) { * """Create a random sample mask where ``n_total_in_bag`` elements are set. * */ - __pyx_k_tuple_54 = PyTuple_Pack(7, ((PyObject *)__pyx_n_s__n_total_samples), ((PyObject *)__pyx_n_s__n_total_in_bag), ((PyObject *)__pyx_n_s__random_state), ((PyObject *)__pyx_n_s__rand), ((PyObject *)__pyx_n_s__sample_mask), ((PyObject *)__pyx_n_s__n_bagged), ((PyObject *)__pyx_n_s__i)); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_54); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54)); - __pyx_k_codeobj_55 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_50, __pyx_n_s___random_sample_mask, 270, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__24 = PyTuple_Pack(7, __pyx_n_s_n_total_samples, __pyx_n_s_n_total_in_bag, __pyx_n_s_random_state, __pyx_n_s_rand, __pyx_n_s_sample_mask, __pyx_n_s_n_bagged, __pyx_n_s_i); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_larsb_src_scikit_learn_skl, __pyx_n_s_random_sample_mask, 270, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "View.MemoryView":282 * return self.name @@ -17103,9 +17800,9 @@ static int __Pyx_InitCachedConstants(void) { * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_58); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58)); + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); /* "View.MemoryView":283 * @@ -17114,9 +17811,9 @@ static int __Pyx_InitCachedConstants(void) { * cdef indirect = Enum("") * */ - __pyx_k_tuple_60 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_59)); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_60); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60)); + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); /* "View.MemoryView":284 * cdef generic = Enum("") @@ -17125,9 +17822,9 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_62); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); /* "View.MemoryView":287 * @@ -17136,9 +17833,9 @@ static int __Pyx_InitCachedConstants(void) { * cdef indirect_contiguous = Enum("") * */ - __pyx_k_tuple_64 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_64); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64)); + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); /* "View.MemoryView":288 * @@ -17147,9 +17844,9 @@ static int __Pyx_InitCachedConstants(void) { * * */ - __pyx_k_tuple_66 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_65)); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_66); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66)); + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -17159,10 +17856,9 @@ static int __Pyx_InitCachedConstants(void) { static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -17220,14 +17916,6 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_d); - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!PyDict_GetItemString(modules, "sklearn.ensemble._gradient_boosting")) { - if (unlikely(PyDict_SetItemString(modules, "sklearn.ensemble._gradient_boosting", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); @@ -17239,8 +17927,16 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__pyx_module_is_main_sklearn__ensemble___gradient_boosting) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.ensemble._gradient_boosting")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.ensemble._gradient_boosting", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } + #endif /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ @@ -17263,19 +17959,23 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type___pyx_memoryview.tp_print = 0; if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_memoryview_type = &__pyx_type___pyx_memoryview; if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type___pyx_array.tp_print = 0; __pyx_array_type = &__pyx_type___pyx_array; if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type___pyx_MemviewEnum.tp_print = 0; __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type___pyx_memoryviewslice.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -17294,14 +17994,14 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) __pyx_vtabptr_7sklearn_4tree_5_tree_Criterion = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_Criterion->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_Criterion)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_Splitter = __Pyx_ImportType("sklearn.tree._tree", "Splitter", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_Splitter)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_7sklearn_4tree_5_tree_Splitter = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_Splitter->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_Splitter)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_4tree_5_tree_Tree = __Pyx_ImportType("sklearn.tree._tree", "Tree", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_Tree), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_Tree)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_4tree_5_tree_Tree = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_Tree->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_Tree)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_4tree_5_tree_TreeBuilder = __Pyx_ImportType("sklearn.tree._tree", "TreeBuilder", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_TreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_TreeBuilder*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_TreeBuilder->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_4tree_5_tree_DepthFirstTreeBuilder = __Pyx_ImportType("sklearn.tree._tree", "DepthFirstTreeBuilder", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_DepthFirstTreeBuilder), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_DepthFirstTreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_4tree_5_tree_DepthFirstTreeBuilder = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_DepthFirstTreeBuilder*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_DepthFirstTreeBuilder->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_DepthFirstTreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_4tree_5_tree_BestFirstTreeBuilder = __Pyx_ImportType("sklearn.tree._tree", "BestFirstTreeBuilder", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_BestFirstTreeBuilder), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_BestFirstTreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_4tree_5_tree_BestFirstTreeBuilder = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_BestFirstTreeBuilder*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_BestFirstTreeBuilder->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_BestFirstTreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_4tree_5_tree_Tree = __Pyx_ImportType("sklearn.tree._tree", "Tree", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_Tree), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_Tree)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_4tree_5_tree_Tree = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_Tree->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_Tree)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_4tree_5_tree_TreeBuilder = __Pyx_ImportType("sklearn.tree._tree", "TreeBuilder", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_TreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_TreeBuilder*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_TreeBuilder->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_4tree_5_tree_DepthFirstTreeBuilder = __Pyx_ImportType("sklearn.tree._tree", "DepthFirstTreeBuilder", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_DepthFirstTreeBuilder), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_DepthFirstTreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_4tree_5_tree_DepthFirstTreeBuilder = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_DepthFirstTreeBuilder*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_DepthFirstTreeBuilder->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_DepthFirstTreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_4tree_5_tree_BestFirstTreeBuilder = __Pyx_ImportType("sklearn.tree._tree", "BestFirstTreeBuilder", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_BestFirstTreeBuilder), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_BestFirstTreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_4tree_5_tree_BestFirstTreeBuilder = (struct __pyx_vtabstruct_7sklearn_4tree_5_tree_BestFirstTreeBuilder*)__Pyx_GetVtable(__pyx_ptype_7sklearn_4tree_5_tree_BestFirstTreeBuilder->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_4tree_5_tree_BestFirstTreeBuilder)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -17313,9 +18013,9 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * cimport numpy as np * np.import_array() */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/ensemble/_gradient_boosting.pyx":13 @@ -17336,15 +18036,15 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__bool)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__bool)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bool)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_bool); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_bool); + __Pyx_GIVEREF(__pyx_n_s_bool); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__bool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_bool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -17357,15 +18057,15 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_n_s__zeros)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__zeros)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zeros)); - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_zeros); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_zeros); + __Pyx_GIVEREF(__pyx_n_s_zeros); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np_zeros, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np_zeros, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17378,15 +18078,15 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__ones)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__ones)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ones)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_ones); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ones); + __Pyx_GIVEREF(__pyx_n_s_ones); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np_ones, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np_ones, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -17399,15 +18099,15 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_n_s__bool)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__bool)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bool)); - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_bool); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_bool); + __Pyx_GIVEREF(__pyx_n_s_bool); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__bool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_bool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np_bool, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np_bool, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17420,15 +18120,15 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__int8)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__int8)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__int8)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_int8); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_int8); + __Pyx_GIVEREF(__pyx_n_s_int8); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__int8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_int8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np_int8, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np_int8, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -17441,15 +18141,15 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_n_s__intp)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__intp)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__intp)); - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_intp); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_intp); + __Pyx_GIVEREF(__pyx_n_s_intp); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__intp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_intp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np_intp, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np_intp, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17462,15 +18162,15 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__float32)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_float32); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_float32); + __Pyx_GIVEREF(__pyx_n_s_float32); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np_float32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np_float32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -17483,15 +18183,15 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__float64)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_float64); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_float64); + __Pyx_GIVEREF(__pyx_n_s_float64); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np_float64, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np_float64, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17502,12 +18202,12 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * ctypedef np.float32_t DTYPE_t * ctypedef np.npy_intp SIZE_t */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/ensemble/_gradient_boosting.pyx":39 @@ -17526,9 +18226,9 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * np.ndarray[DTYPE_t, ndim=2, mode='c'] X, double scale, * np.ndarray[float64, ndim=2] out): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_8ensemble_18_gradient_boosting_1predict_stages, NULL, __pyx_n_s_51); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_8ensemble_18_gradient_boosting_1predict_stages, NULL, __pyx_n_s_sklearn_ensemble__gradient_boost); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__predict_stages, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_stages, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/ensemble/_gradient_boosting.pyx":133 @@ -17538,9 +18238,9 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * int stage, * np.ndarray[DTYPE_t, ndim=2] X, double scale, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_8ensemble_18_gradient_boosting_3predict_stage, NULL, __pyx_n_s_51); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_8ensemble_18_gradient_boosting_3predict_stage, NULL, __pyx_n_s_sklearn_ensemble__gradient_boost); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__predict_stage, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_stage, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/ensemble/_gradient_boosting.pyx":270 @@ -17550,9 +18250,9 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * """Create a random sample mask where ``n_total_in_bag`` elements are set. * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_8ensemble_18_gradient_boosting_7_random_sample_mask, NULL, __pyx_n_s_51); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_8ensemble_18_gradient_boosting_7_random_sample_mask, NULL, __pyx_n_s_sklearn_ensemble__gradient_boost); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s___random_sample_mask, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_random_sample_mask, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/ensemble/_gradient_boosting.pyx":1 @@ -17561,9 +18261,9 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * # cython: wraparound=False */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "View.MemoryView":207 * info.obj = self @@ -17572,9 +18272,9 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * * def __dealloc__(array self): */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_56); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), __pyx_k_getbuffer_obj_view_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_array_type); @@ -17585,7 +18285,7 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(generic); __Pyx_DECREF_SET(generic, __pyx_t_2); @@ -17599,7 +18299,7 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * cdef indirect = Enum("") * */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(strided); __Pyx_DECREF_SET(strided, __pyx_t_2); @@ -17613,7 +18313,7 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * * */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(indirect); __Pyx_DECREF_SET(indirect, __pyx_t_2); @@ -17627,7 +18327,7 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * cdef indirect_contiguous = Enum("") * */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(contiguous); __Pyx_DECREF_SET(contiguous, __pyx_t_2); @@ -17641,40 +18341,40 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * * */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XGOTREF(indirect_contiguous); __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":503 + /* "View.MemoryView":504 * info.obj = self * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_56); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_getbuffer_obj_view_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_memoryview_type); - /* "View.MemoryView":958 + /* "View.MemoryView":961 * return self.from_object * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_56); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_getbuffer_obj_view_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 961; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_memoryviewslice_type); - /* "View.MemoryView":1365 + /* "View.MemoryView":1368 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -17724,7 +18424,7 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else - "name '%s' is not defined", PyString_AS_STRING(name)); + "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; @@ -17750,7 +18450,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -17854,12 +18554,12 @@ static int __Pyx_ParseOptionalKeywords( goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); + "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", + "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", @@ -17869,23 +18569,29 @@ static int __Pyx_ParseOptionalKeywords( return -1; } -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, +static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); +} +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { - if (Py_TYPE(obj) == type) return 1; + if (likely(Py_TYPE(obj) == type)) return 1; + #if PY_MAJOR_VERSION == 2 + else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif } else { - if (PyObject_TypeCheck(obj, type)) return 1; + if (likely(PyObject_TypeCheck(obj, type))) return 1; } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); + __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } @@ -18434,7 +19140,7 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); + PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) @@ -18675,30 +19381,43 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyEval_CallObject(type, args); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + if (PyObject_IsSubclass(instance_class, type)) { + type = instance_class; + } else { + instance_class = NULL; + } + } } - } else { - PyErr_SetString(PyExc_TypeError, + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } @@ -18887,7 +19606,7 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } @@ -18895,51 +19614,6 @@ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } - } - return 0; -#endif -} - -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; -} - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION >= 3 @@ -18954,7 +19628,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { PyObject *r = __Pyx_GetAttr(o, n); - if (!r) { + if (unlikely(!r)) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; PyErr_Clear(); @@ -18966,39 +19640,30 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject return NULL; } -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { return (equals == Py_EQ); - } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { - #if CYTHON_PEP393_ENABLED - if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0)) - return -1; - if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) { + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) return (equals == Py_NE); - } else if (PyUnicode_GET_LENGTH(s1) == 1) { - Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0); - Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0); - return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); - #else - if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { return (equals == Py_NE); - } else if (PyUnicode_GET_SIZE(s1) == 1) { - Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0]; - Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0]; - return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); - #endif + } else if (length == 1) { + return (equals == Py_EQ); } else { - int result = PyUnicode_Compare(s1, s2); - if ((result == -1) && unlikely(PyErr_Occurred())) - return -1; + int result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } - } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { return (equals == Py_NE); - } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { return (equals == Py_NE); } else { int result; @@ -19012,6 +19677,91 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #endif } +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + #if CYTHON_PEP393_ENABLED + if (unlikely(PyUnicode_READY(s1) < 0) || unlikely(PyUnicode_READY(s2) < 0)) + return -1; + #endif + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, length * kind); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, @@ -19038,6 +19788,37 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( } } +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +#else + PyErr_GetExcInfo(type, value, tb); +#endif +} +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(type, value, tb); +#endif +} + static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *local_type, *local_value, *local_tb; #if CYTHON_COMPILING_IN_CPYTHON @@ -19060,12 +19841,14 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif goto bad; #if PY_MAJOR_VERSION >= 3 - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } #endif - Py_INCREF(local_type); - Py_INCREF(local_value); - Py_INCREF(local_tb); + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); *type = local_type; *value = local_value; *tb = local_tb; @@ -19076,8 +19859,6 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; - /* Make sure tstate is in a consistent state when we XDECREF - these objects (DECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); @@ -19174,10 +19955,18 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else @@ -19200,7 +19989,7 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #endif if (!ob) goto bad; - if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) + if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; @@ -19211,7 +20000,7 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { static void* __Pyx_GetVtable(PyObject *dict) { void* ptr; - PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__); + PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable); if (!ob) goto bad; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) @@ -19252,7 +20041,7 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict) { PyObject *getbuffer_cobj = PyObject_GetItem( - obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer); + obj->ob_type->tp_dict, __pyx_n_s_pyx_getbuffer); if (getbuffer_cobj) { getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); Py_DECREF(getbuffer_cobj); @@ -19264,7 +20053,7 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { } } #endif - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); #if PY_VERSION_HEX < 0x02060000 fail: #endif @@ -19283,7 +20072,7 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict) { PyObject *releasebuffer_cobj = PyObject_GetItem( - obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer); + obj->ob_type->tp_dict, __pyx_n_s_pyx_releasebuffer); if (releasebuffer_cobj) { releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); Py_DECREF(releasebuffer_cobj); @@ -19308,7 +20097,7 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { #endif /* PY_MAJOR_VERSION < 3 */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; @@ -19316,7 +20105,7 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif @@ -19390,6 +20179,122 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { return module; } +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func) \ + { \ + func_type value = func(x); \ + if (sizeof(target_type) < sizeof(func_type)) { \ + if (unlikely(value != (func_type) (target_type) value)) { \ + func_type zero = 0; \ + PyErr_SetString(PyExc_OverflowError, \ + (is_unsigned && unlikely(value < zero)) ? \ + "can't convert negative value to " #target_type : \ + "value too large to convert to " #target_type); \ + return (target_type) -1; \ + } \ + } \ + return (target_type) value; \ + } + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(int)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (int) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; + } + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong) + } else if (sizeof(int) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(int)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(int) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(int) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong) + } else if (sizeof(int) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } +} + static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) { @@ -19497,7 +20402,7 @@ __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec if (spec & __Pyx_MEMVIEW_PTR) { if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) { PyErr_Format(PyExc_ValueError, - "Buffer is not indirectly accessisble " + "Buffer is not indirectly accessible " "in dimension %d.", dim); goto fail; } @@ -19677,113 +20582,184 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_dou return result; } -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32 val) { - const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(npy_int32) == sizeof(char)) || - (sizeof(npy_int32) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(npy_int32) == sizeof(int)) || - (sizeof(npy_int32) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_npy_int32(npy_int32 value) { + const npy_int32 neg_one = (npy_int32) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(npy_int32) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(npy_int32) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(npy_int32) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } } else { + if (sizeof(npy_int32) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(npy_int32) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; + unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(npy_int32), little, !is_unsigned); } } -static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) { - const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(npy_int32) == sizeof(char)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedChar(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(npy_int32) == sizeof(short)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedShort(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(npy_int32) == sizeof(int)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedInt(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(npy_int32) == sizeof(long)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedLong(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (npy_int32)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (npy_int32)__Pyx_PyInt_AsSignedLongLong(x); - } else { - #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); - #else - npy_int32 val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif +static CYTHON_INLINE npy_int32 __Pyx_PyInt_As_npy_int32(PyObject *x) { + const npy_int32 neg_one = (npy_int32) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(npy_int32) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(npy_int32, long, PyInt_AS_LONG) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to npy_int32"); + return (npy_int32) -1; + } + return (npy_int32) val; } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(npy_int32)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (npy_int32) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to npy_int32"); + return (npy_int32) -1; + } + if (sizeof(npy_int32) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long, PyLong_AsUnsignedLong) + } else if (sizeof(npy_int32) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(npy_int32, unsigned long long, PyLong_AsUnsignedLongLong) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(npy_int32)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(npy_int32) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(npy_int32) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (sizeof(npy_int32) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(npy_int32, long, PyLong_AsLong) + } else if (sizeof(npy_int32) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(npy_int32, long long, PyLong_AsLongLong) + } } - #endif - return (npy_int32)-1; + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + npy_int32 val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (npy_int32) -1; + } + } else { + npy_int32 val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (npy_int32) -1; + val = __Pyx_PyInt_As_npy_int32(tmp); + Py_DECREF(tmp); + return val; } } -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { - const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(Py_intptr_t) == sizeof(char)) || - (sizeof(Py_intptr_t) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(Py_intptr_t) == sizeof(int)) || - (sizeof(Py_intptr_t) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) { + const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(Py_intptr_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } } else { + if (sizeof(Py_intptr_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; + unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), little, !is_unsigned); } } +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(int) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { @@ -20024,68 +21000,111 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { #endif #endif -static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject* x) { - const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(Py_intptr_t) == sizeof(char)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedChar(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(Py_intptr_t) == sizeof(short)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedShort(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(Py_intptr_t) == sizeof(int)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedInt(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(Py_intptr_t) == sizeof(long)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedLong(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedLongLong(x); - } else { - #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); - #else - Py_intptr_t val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif +static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) { + const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(Py_intptr_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to Py_intptr_t"); + return (Py_intptr_t) -1; + } + return (Py_intptr_t) val; } - #endif - return (Py_intptr_t)-1; - } -} - -static int -__pyx_memviewslice_is_contig(const __Pyx_memviewslice *mvs, - char order, int ndim) -{ - int i, index, step, start; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(Py_intptr_t)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (Py_intptr_t) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to Py_intptr_t"); + return (Py_intptr_t) -1; + } + if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong) + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long long, PyLong_AsUnsignedLongLong) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(Py_intptr_t)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(Py_intptr_t) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(Py_intptr_t) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (sizeof(Py_intptr_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyLong_AsLong) + } else if (sizeof(Py_intptr_t) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, long long, PyLong_AsLongLong) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + Py_intptr_t val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (Py_intptr_t) -1; + } + } else { + Py_intptr_t val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (Py_intptr_t) -1; + val = __Pyx_PyInt_As_Py_intptr_t(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int +__pyx_memviewslice_is_contig(const __Pyx_memviewslice *mvs, + char order, int ndim) +{ + int i, index, step, start; Py_ssize_t itemsize = mvs->memview->view.itemsize; if (order == 'F') { step = 1; @@ -20216,389 +21235,180 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) return cobj; } -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -#else - PyErr_GetExcInfo(type, value, tb); -#endif -} -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(type, value, tb); -#endif -} - -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { - const unsigned char neg_one = (unsigned char)-1, const_zero = 0; +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned char" : - "value too large to convert to unsigned char"); - } - return (unsigned char)-1; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(long) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); } - return (unsigned char)val; - } - return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { - const unsigned short neg_one = (unsigned short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned short" : - "value too large to convert to unsigned short"); - } - return (unsigned short)-1; - } - return (unsigned short)val; - } - return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { - const unsigned int neg_one = (unsigned int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned int" : - "value too large to convert to unsigned int"); - } - return (unsigned int)-1; - } - return (unsigned int)val; - } - return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { - const char neg_one = (char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to char" : - "value too large to convert to char"); - } - return (char)-1; - } - return (char)val; - } - return (char)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { - const short neg_one = (short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to short" : - "value too large to convert to short"); - } - return (short)-1; - } - return (short)val; - } - return (short)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { - const signed char neg_one = (signed char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed char" : - "value too large to convert to signed char"); - } - return (signed char)-1; - } - return (signed char)val; - } - return (signed char)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { - const signed short neg_one = (signed short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed short" : - "value too large to convert to signed short"); - } - return (signed short)-1; - } - return (signed short)val; - } - return (signed short)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed int" : - "value too large to convert to signed int"); - } - return (signed int)-1; + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); } - return (signed int)val; } - return (signed int)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); } - return (int)__Pyx_PyInt_AsLong(x); } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif #endif -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { - const unsigned long neg_one = (unsigned long)-1, const_zero = 0; +static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { + const char neg_one = (char) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; + if (sizeof(char) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to char"); + return (char) -1; + } + return (char) val; } - return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned long)) { + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(char)) { switch (Py_SIZE(x)) { case 0: return 0; - case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case 1: return (char) ((PyLongObject*)x)->ob_digit[0]; } } -#endif + #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; + "can't convert negative value to char"); + return (char) -1; + } + if (sizeof(char) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long, PyLong_AsUnsignedLong) + } else if (sizeof(char) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(char, unsigned long long, PyLong_AsUnsignedLongLong) } - return (unsigned long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned long)) { + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(char)) { switch (Py_SIZE(x)) { case 0: return 0; - case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case 1: return +(char) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(char) ((PyLongObject*)x)->ob_digit[0]; } } + #endif #endif -#endif - return (unsigned long)PyLong_AsLong(x); - } - } else { - unsigned long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned long)-1; - val = __Pyx_PyInt_AsUnsignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return (unsigned PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } + if (sizeof(char) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(char, long, PyLong_AsLong) + } else if (sizeof(char) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(char, long long, PyLong_AsLongLong) } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + char val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); } - return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; } #endif -#endif - return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + return (char) -1; } } else { - unsigned PY_LONG_LONG val; + char val; PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + if (!tmp) return (char) -1; + val = __Pyx_PyInt_As_char(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif #endif -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { - const long neg_one = (long)-1, const_zero = 0; +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; + } + return (long) val; } - return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS + #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; } } -#endif + #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); - return (long)-1; + return (long) -1; + } + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong) + } else if (sizeof(long) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong) } - return (long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS + #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; @@ -20606,198 +21416,46 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; } } + #endif #endif -#endif - return (long)PyLong_AsLong(x); - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (long)-1; - val = __Pyx_PyInt_AsLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { - const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return (PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - return (PY_LONG_LONG)PyLong_AsLongLong(x); - } - } else { - PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { - const signed long neg_one = (signed long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return (signed long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; - } + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong) + } else if (sizeof(long) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong) } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return (signed long)PyLong_AsUnsignedLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - return (signed long)PyLong_AsLong(x); } - } else { - signed long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed long)-1; - val = __Pyx_PyInt_AsSignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { - const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; - } - return (signed PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + long val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); } - return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; } #endif -#endif - return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + return (long) -1; } } else { - signed PY_LONG_LONG val; + long val; PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsSignedLongLong(tmp); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } @@ -20867,7 +21525,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, - "%s.%s is not a type object", + "%.200s.%.200s is not a type object", module_name, class_name); goto bad; } @@ -20895,7 +21553,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s has the wrong size, try recompiling", + "%.200s.%.200s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -21148,10 +21806,16 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_ #endif /* PY_VERSION_HEX < 0x03030000 */ } else #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ +#if PY_VERSION_HEX >= 0x02060000 + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); - if (r < 0) { + if (unlikely(r < 0)) { return NULL; } else { return result; @@ -21196,7 +21860,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, - "__%s__ returned non-%s (type %.200s)", + "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; @@ -21208,9 +21872,35 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { } return res; } +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) + return PyInt_AS_LONG(b); +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(b)) { + case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0]; + case 0: return 0; + case 1: return ((PyLongObject*)b)->ob_digit[0]; + } + #endif + #endif + #if PY_VERSION_HEX < 0x02060000 + return PyInt_AsSsize_t(b); + #else + return PyLong_AsSsize_t(b); + #endif + } + x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); @@ -21229,16 +21919,6 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); #endif } -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { - unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); - if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { - if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t)-1; - } - return (size_t)val; -} #endif /* Py_PYTHON_H */ diff --git a/sklearn/tree/_tree.c b/sklearn/tree/_tree.c index 698c2e3b1513b..012a3357b968a 100644 --- a/sklearn/tree/_tree.c +++ b/sklearn/tree/_tree.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.2 on Sat Jan 25 22:10:02 2014 */ +/* Generated by Cython 0.20 on Sat Jan 25 15:13:16 2014 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -19,6 +19,7 @@ #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else +#define CYTHON_ABI "0_20" #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -53,6 +54,9 @@ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif +#if CYTHON_COMPILING_IN_PYPY +#define Py_OptimizeFlag 0 +#endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -60,7 +64,7 @@ #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_As_int(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ @@ -113,12 +117,14 @@ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type #endif -#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 +#if PY_VERSION_HEX < 0x02060000 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 @@ -131,19 +137,38 @@ #if PY_VERSION_HEX < 0x02060000 #define Py_TPFLAGS_HAVE_VERSION_TAG 0 #endif +#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT) + #define Py_TPFLAGS_IS_ABSTRACT 0 +#endif +#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE) + #define Py_TPFLAGS_HAVE_FINALIZE 0 +#endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#define __Pyx_PyUnicode_Concat(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \ + PyNumber_Add(a, b) : PyUnicode_Concat(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type @@ -176,7 +201,7 @@ #else #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) @@ -201,6 +226,7 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -344,8 +370,20 @@ typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) ( \ + (sizeof(type) < sizeof(Py_ssize_t)) || \ + (sizeof(type) > sizeof(Py_ssize_t) && \ + likely(v < (type)PY_SSIZE_T_MAX || \ + v == (type)PY_SSIZE_T_MAX) && \ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN || \ + v == (type)PY_SSIZE_T_MIN))) || \ + (sizeof(type) == sizeof(Py_ssize_t) && \ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX || \ + v == (type)PY_SSIZE_T_MAX))) ) static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) +#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); @@ -356,9 +394,11 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif +#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyByteArray_FromUString(s) __Pyx_PyByteArray_FromString((char*)s) #define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) #define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) #if PY_MAJOR_VERSION < 3 @@ -380,7 +420,6 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -389,7 +428,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params() { +static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys = NULL; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; @@ -414,7 +453,7 @@ static int __Pyx_init_sys_getdefaultencoding_params() { if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } @@ -438,7 +477,7 @@ static int __Pyx_init_sys_getdefaultencoding_params() { #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params() { +static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys = NULL; PyObject* default_encoding = NULL; char* default_encoding_c; @@ -510,7 +549,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "_tree.pyx", "_tree.pxd", - "numpy.pxd", + "__init__.pxd", "type.pxd", "bool.pxd", "complex.pxd", @@ -552,7 +591,7 @@ typedef struct { } __Pyx_BufFmt_Context; -/* "numpy.pxd":723 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -561,7 +600,7 @@ typedef struct { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":724 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -570,7 +609,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":725 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -579,7 +618,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":726 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -588,7 +627,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":730 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -597,7 +636,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":731 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -606,7 +645,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":732 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -615,7 +654,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":733 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -624,7 +663,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":737 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -633,7 +672,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":738 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -642,7 +681,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":747 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -651,7 +690,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":748 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -660,7 +699,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":749 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -669,7 +708,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":751 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -678,7 +717,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":752 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -687,7 +726,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":753 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -696,7 +735,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":755 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -705,7 +744,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":756 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -714,7 +753,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":758 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -723,7 +762,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":759 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -732,7 +771,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":760 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -834,7 +873,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_BestFirstTreeBuilder; struct __pyx_obj_7sklearn_4tree_5_tree_DepthFirstTreeBuilder; struct __pyx_obj_7sklearn_4tree_5_tree_BestSplitter; -/* "numpy.pxd":762 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -843,7 +882,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_BestSplitter; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":763 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -852,7 +891,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":764 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -861,7 +900,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":766 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -912,7 +951,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_11TreeBuilder_build; struct __pyx_opt_args_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build; struct __pyx_opt_args_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build; -/* "sklearn/tree/_tree.pxd":113 +/* "sklearn/tree/_tree.pxd":114 * # ============================================================================= * * cdef struct Node: # <<<<<<<<<<<<<< @@ -928,7 +967,7 @@ struct __pyx_t_7sklearn_4tree_5_tree_Node { __pyx_t_7sklearn_4tree_5_tree_SIZE_t n_samples; }; -/* "sklearn/tree/_tree.pxd":158 +/* "sklearn/tree/_tree.pxd":159 * SIZE_t n_node_samples) nogil * cdef void _resize(self, SIZE_t capacity) * cdef int _resize_c(self, SIZE_t capacity=*) nogil # <<<<<<<<<<<<<< @@ -940,7 +979,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree__resize_c { __pyx_t_7sklearn_4tree_5_tree_SIZE_t capacity; }; -/* "sklearn/tree/_tree.pxd":165 +/* "sklearn/tree/_tree.pxd":166 * cpdef np.ndarray predict(self, np.ndarray[DTYPE_t, ndim=2] X) * cpdef np.ndarray apply(self, np.ndarray[DTYPE_t, ndim=2] X) * cpdef compute_feature_importances(self, normalize=*) # <<<<<<<<<<<<<< @@ -952,7 +991,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_compute_feature_importances { PyObject *normalize; }; -/* "sklearn/tree/_tree.pxd":173 +/* "sklearn/tree/_tree.pxd":174 * * cdef class TreeBuilder: * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -964,7 +1003,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_11TreeBuilder_build { PyArrayObject *sample_weight; }; -/* "sklearn/tree/_tree.pxd":178 +/* "sklearn/tree/_tree.pxd":179 * * cdef class DepthFirstTreeBuilder(TreeBuilder): * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -976,7 +1015,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build { PyArrayObject *sample_weight; }; -/* "sklearn/tree/_tree.pxd":183 +/* "sklearn/tree/_tree.pxd":184 * * cdef class BestFirstTreeBuilder(TreeBuilder): * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -1017,6 +1056,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Splitter { __pyx_t_7sklearn_4tree_5_tree_SIZE_t n_samples; __pyx_t_7sklearn_4tree_5_tree_SIZE_t *features; __pyx_t_7sklearn_4tree_5_tree_SIZE_t n_features; + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *feature_values; __pyx_t_7sklearn_4tree_5_tree_SIZE_t start; __pyx_t_7sklearn_4tree_5_tree_SIZE_t end; __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *X; @@ -1028,7 +1068,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Splitter { }; -/* "sklearn/tree/_tree.pyx":1336 +/* "sklearn/tree/_tree.pyx":1417 * * * cdef class PresortBestSplitter(Splitter): # <<<<<<<<<<<<<< @@ -1046,7 +1086,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter { }; -/* "sklearn/tree/_tree.pxd":126 +/* "sklearn/tree/_tree.pxd":127 * * * cdef class Tree: # <<<<<<<<<<<<<< @@ -1074,7 +1114,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Tree { }; -/* "sklearn/tree/_tree.pyx":1178 +/* "sklearn/tree/_tree.pyx":1258 * * * cdef class RandomSplitter(Splitter): # <<<<<<<<<<<<<< @@ -1086,7 +1126,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_RandomSplitter { }; -/* "sklearn/tree/_tree.pxd":172 +/* "sklearn/tree/_tree.pxd":173 * # ============================================================================= * * cdef class TreeBuilder: # <<<<<<<<<<<<<< @@ -1244,7 +1284,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Entropy { }; -/* "sklearn/tree/_tree.pxd":182 +/* "sklearn/tree/_tree.pxd":183 * * * cdef class BestFirstTreeBuilder(TreeBuilder): # <<<<<<<<<<<<<< @@ -1256,7 +1296,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_BestFirstTreeBuilder { }; -/* "sklearn/tree/_tree.pxd":177 +/* "sklearn/tree/_tree.pxd":178 * * * cdef class DepthFirstTreeBuilder(TreeBuilder): # <<<<<<<<<<<<<< @@ -1268,7 +1308,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_DepthFirstTreeBuilder { }; -/* "sklearn/tree/_tree.pyx":996 +/* "sklearn/tree/_tree.pyx":1002 * * * cdef class BestSplitter(Splitter): # <<<<<<<<<<<<<< @@ -1343,7 +1383,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_FriedmanMSE { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_FriedmanMSE *__pyx_vtabptr_7sklearn_4tree_5_tree_FriedmanMSE; -/* "sklearn/tree/_tree.pyx":1554 +/* "sklearn/tree/_tree.pyx":1633 * # ============================================================================= * * cdef class TreeBuilder: # <<<<<<<<<<<<<< @@ -1357,7 +1397,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_TreeBuilder { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_TreeBuilder *__pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder; -/* "sklearn/tree/_tree.pyx":1893 +/* "sklearn/tree/_tree.pyx":1972 * # ============================================================================= * * cdef class Tree: # <<<<<<<<<<<<<< @@ -1378,7 +1418,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *__pyx_vtabptr_7sklearn_4tree_5_tree_Tree; -/* "sklearn/tree/_tree.pyx":1565 +/* "sklearn/tree/_tree.pyx":1644 * # Depth first builder --------------------------------------------------------- * * cdef class DepthFirstTreeBuilder(TreeBuilder): # <<<<<<<<<<<<<< @@ -1409,7 +1449,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *__pyx_vtabptr_7sklearn_4tree_5_tree_Splitter; -/* "sklearn/tree/_tree.pyx":996 +/* "sklearn/tree/_tree.pyx":1002 * * * cdef class BestSplitter(Splitter): # <<<<<<<<<<<<<< @@ -1481,7 +1521,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Entropy { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Entropy *__pyx_vtabptr_7sklearn_4tree_5_tree_Entropy; -/* "sklearn/tree/_tree.pyx":1766 +/* "sklearn/tree/_tree.pyx":1845 * * * cdef class BestFirstTreeBuilder(TreeBuilder): # <<<<<<<<<<<<<< @@ -1495,7 +1535,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_BestFirstTreeBuilder { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_BestFirstTreeBuilder *__pyx_vtabptr_7sklearn_4tree_5_tree_BestFirstTreeBuilder; -/* "sklearn/tree/_tree.pyx":1178 +/* "sklearn/tree/_tree.pyx":1258 * * * cdef class RandomSplitter(Splitter): # <<<<<<<<<<<<<< @@ -1509,7 +1549,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_RandomSplitter { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_RandomSplitter *__pyx_vtabptr_7sklearn_4tree_5_tree_RandomSplitter; -/* "sklearn/tree/_tree.pyx":1336 +/* "sklearn/tree/_tree.pyx":1417 * * * cdef class PresortBestSplitter(Splitter): # <<<<<<<<<<<<<< @@ -1625,7 +1665,7 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, @@ -1637,7 +1677,8 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename); /*proto*/ + int lineno, const char *filename, + int full_traceback); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ @@ -1655,20 +1696,21 @@ static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } -#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) -#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ - (((size) <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); @@ -1684,19 +1726,19 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ - -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ - static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value); -static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject *); +static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *); + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ @@ -1725,7 +1767,9 @@ typedef struct { static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; -static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject *); +static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *); + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); static CYTHON_INLINE long __Pyx_pow_long(long, long); /* proto */ @@ -1745,7 +1789,7 @@ static CYTHON_INLINE long __Pyx_pow_long(long, long); /* proto */ #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif -#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX +#if (defined(_WIN32) || defined(__clang__)) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else @@ -1831,37 +1875,7 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #endif #endif -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); - -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); static int __Pyx_check_binary_version(void); @@ -2024,7 +2038,12 @@ static int __pyx_v_7sklearn_4tree_5_tree_IS_FIRST; static int __pyx_v_7sklearn_4tree_5_tree_IS_NOT_FIRST; static int __pyx_v_7sklearn_4tree_5_tree_IS_LEFT; static int __pyx_v_7sklearn_4tree_5_tree_IS_NOT_LEFT; -static CYTHON_INLINE void __pyx_f_7sklearn_4tree_5_tree_sort(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t); /*proto*/ +static CYTHON_INLINE void __pyx_f_7sklearn_4tree_5_tree_sort(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t); /*proto*/ +static CYTHON_INLINE void __pyx_f_7sklearn_4tree_5_tree_swap(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, __pyx_t_7sklearn_4tree_5_tree_SIZE_t); /*proto*/ +static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_f_7sklearn_4tree_5_tree_median3(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t); /*proto*/ +static void __pyx_f_7sklearn_4tree_5_tree_introsort(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, int); /*proto*/ +static CYTHON_INLINE void __pyx_f_7sklearn_4tree_5_tree_sift_down(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, __pyx_t_7sklearn_4tree_5_tree_SIZE_t); /*proto*/ +static void __pyx_f_7sklearn_4tree_5_tree_heapsort(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t); /*proto*/ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, double, int, int, struct __pyx_t_7sklearn_4tree_5_tree_Node *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, struct __pyx_t_7sklearn_4tree_6_utils_PriorityHeapRecord *); /*proto*/ static int __pyx_f_7sklearn_4tree_5_tree__add_to_frontier(struct __pyx_t_7sklearn_4tree_6_utils_PriorityHeapRecord *, struct __pyx_obj_7sklearn_4tree_6_utils_PriorityHeap *); /*proto*/ static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_UINT32_t __pyx_f_7sklearn_4tree_5_tree_our_rand_r(__pyx_t_7sklearn_4tree_5_tree_UINT32_t *); /*proto*/ @@ -2130,212 +2149,210 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_Entropy(PyTypeObject *t, PyO static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_BestFirstTreeBuilder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_DepthFirstTreeBuilder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_BestSplitter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static char __pyx_k_1[] = "failed to allocate %d bytes"; -static char __pyx_k_2[] = "You have loaded Tree version which cannot be imported"; -static char __pyx_k_4[] = "Did not recognise loaded array layout"; -static char __pyx_k_8[] = "compute_feature_importances"; -static char __pyx_k_9[] = "ndarray is not C contiguous"; -static char __pyx_k_11[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_13[] = "Non-native byte order not supported"; -static char __pyx_k_15[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_16[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_19[] = "Format string allocated too short."; -static char __pyx_k__B[] = "B"; -static char __pyx_k__C[] = "C"; -static char __pyx_k__H[] = "H"; -static char __pyx_k__I[] = "I"; -static char __pyx_k__L[] = "L"; -static char __pyx_k__O[] = "O"; -static char __pyx_k__Q[] = "Q"; -static char __pyx_k__X[] = "X"; -static char __pyx_k__b[] = "b"; -static char __pyx_k__d[] = "d"; -static char __pyx_k__f[] = "f"; -static char __pyx_k__g[] = "g"; -static char __pyx_k__h[] = "h"; -static char __pyx_k__i[] = "i"; -static char __pyx_k__l[] = "l"; -static char __pyx_k__q[] = "q"; -static char __pyx_k__y[] = "y"; -static char __pyx_k__Zd[] = "Zd"; -static char __pyx_k__Zf[] = "Zf"; -static char __pyx_k__Zg[] = "Zg"; -static char __pyx_k__np[] = "np"; -static char __pyx_k__inf[] = "inf"; -static char __pyx_k__max[] = "max"; -static char __pyx_k__sum[] = "sum"; -static char __pyx_k__axis[] = "axis"; -static char __pyx_k__clip[] = "clip"; -static char __pyx_k__copy[] = "copy"; -static char __pyx_k__intp[] = "intp"; -static char __pyx_k__mode[] = "mode"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__take[] = "take"; -static char __pyx_k__tree[] = "tree"; -static char __pyx_k__DTYPE[] = "DTYPE"; -static char __pyx_k__apply[] = "apply"; -static char __pyx_k__build[] = "build"; -static char __pyx_k__dtype[] = "dtype"; -static char __pyx_k__flags[] = "flags"; -static char __pyx_k__int32[] = "int32"; -static char __pyx_k__names[] = "names"; -static char __pyx_k__nodes[] = "nodes"; -static char __pyx_k__numpy[] = "numpy"; -static char __pyx_k__order[] = "order"; -static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__zeros[] = "zeros"; -static char __pyx_k__DOUBLE[] = "DOUBLE"; -static char __pyx_k__values[] = "values"; -static char __pyx_k__argsort[] = "argsort"; -static char __pyx_k__asarray[] = "asarray"; -static char __pyx_k__feature[] = "feature"; -static char __pyx_k__float32[] = "float32"; -static char __pyx_k__float64[] = "float64"; -static char __pyx_k__formats[] = "formats"; -static char __pyx_k__offsets[] = "offsets"; -static char __pyx_k__predict[] = "predict"; -static char __pyx_k__randint[] = "randint"; -static char __pyx_k__reshape[] = "reshape"; -static char __pyx_k____main__[] = "__main__"; -static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__impurity[] = "impurity"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__splitter[] = "splitter"; -static char __pyx_k__TREE_LEAF[] = "TREE_LEAF"; -static char __pyx_k__criterion[] = "criterion"; -static char __pyx_k__max_depth[] = "max_depth"; -static char __pyx_k__n_classes[] = "n_classes"; -static char __pyx_k__n_outputs[] = "n_outputs"; -static char __pyx_k__n_samples[] = "n_samples"; -static char __pyx_k__normalize[] = "normalize"; -static char __pyx_k__threshold[] = "threshold"; -static char __pyx_k__NODE_DTYPE[] = "NODE_DTYPE"; -static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k____import__[] = "__import__"; -static char __pyx_k__contiguous[] = "contiguous"; -static char __pyx_k__left_child[] = "left_child"; -static char __pyx_k__n_features[] = "n_features"; -static char __pyx_k__node_count[] = "node_count"; -static char __pyx_k__MemoryError[] = "MemoryError"; -static char __pyx_k__right_child[] = "right_child"; -static char __pyx_k__RuntimeError[] = "RuntimeError"; -static char __pyx_k____getstate__[] = "__getstate__"; -static char __pyx_k__c_contiguous[] = "c_contiguous"; -static char __pyx_k__max_features[] = "max_features"; -static char __pyx_k__random_state[] = "random_state"; -static char __pyx_k__sample_weight[] = "sample_weight"; -static char __pyx_k__TREE_UNDEFINED[] = "TREE_UNDEFINED"; -static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; -static char __pyx_k__asfortranarray[] = "asfortranarray"; -static char __pyx_k__max_leaf_nodes[] = "max_leaf_nodes"; -static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; -static char __pyx_k__min_samples_leaf[] = "min_samples_leaf"; -static char __pyx_k__ascontiguousarray[] = "ascontiguousarray"; -static char __pyx_k__min_samples_split[] = "min_samples_split"; -static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer"; -static PyObject *__pyx_kp_s_1; -static PyObject *__pyx_kp_u_11; -static PyObject *__pyx_kp_u_13; -static PyObject *__pyx_kp_u_15; -static PyObject *__pyx_kp_u_16; -static PyObject *__pyx_kp_u_19; -static PyObject *__pyx_kp_s_2; -static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_n_s_8; -static PyObject *__pyx_kp_u_9; -static PyObject *__pyx_n_s__C; -static PyObject *__pyx_n_s__DOUBLE; -static PyObject *__pyx_n_s__DTYPE; -static PyObject *__pyx_n_s__MemoryError; -static PyObject *__pyx_n_s__NODE_DTYPE; -static PyObject *__pyx_n_s__RuntimeError; -static PyObject *__pyx_n_s__TREE_LEAF; -static PyObject *__pyx_n_s__TREE_UNDEFINED; -static PyObject *__pyx_n_s__ValueError; -static PyObject *__pyx_n_s__X; -static PyObject *__pyx_n_s____getstate__; -static PyObject *__pyx_n_s____import__; -static PyObject *__pyx_n_s____main__; -static PyObject *__pyx_n_s____pyx_getbuffer; -static PyObject *__pyx_n_s____pyx_releasebuffer; -static PyObject *__pyx_n_s____pyx_vtable__; -static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s__apply; -static PyObject *__pyx_n_s__argsort; -static PyObject *__pyx_n_s__asarray; -static PyObject *__pyx_n_s__ascontiguousarray; -static PyObject *__pyx_n_s__asfortranarray; -static PyObject *__pyx_n_s__axis; -static PyObject *__pyx_n_s__build; -static PyObject *__pyx_n_s__c_contiguous; -static PyObject *__pyx_n_s__clip; -static PyObject *__pyx_n_s__contiguous; -static PyObject *__pyx_n_s__copy; -static PyObject *__pyx_n_s__criterion; -static PyObject *__pyx_n_s__dtype; -static PyObject *__pyx_n_s__feature; -static PyObject *__pyx_n_s__flags; -static PyObject *__pyx_n_s__float32; -static PyObject *__pyx_n_s__float64; -static PyObject *__pyx_n_s__formats; -static PyObject *__pyx_n_s__impurity; -static PyObject *__pyx_n_s__inf; -static PyObject *__pyx_n_s__int32; -static PyObject *__pyx_n_s__intp; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__left_child; -static PyObject *__pyx_n_s__max; -static PyObject *__pyx_n_s__max_depth; -static PyObject *__pyx_n_s__max_features; -static PyObject *__pyx_n_s__max_leaf_nodes; -static PyObject *__pyx_n_s__min_samples_leaf; -static PyObject *__pyx_n_s__min_samples_split; -static PyObject *__pyx_n_s__mode; -static PyObject *__pyx_n_s__n_classes; -static PyObject *__pyx_n_s__n_features; -static PyObject *__pyx_n_s__n_outputs; -static PyObject *__pyx_n_s__n_samples; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; -static PyObject *__pyx_n_s__node_count; -static PyObject *__pyx_n_s__nodes; -static PyObject *__pyx_n_s__normalize; -static PyObject *__pyx_n_s__np; -static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__offsets; -static PyObject *__pyx_n_s__order; -static PyObject *__pyx_n_s__predict; -static PyObject *__pyx_n_s__randint; -static PyObject *__pyx_n_s__random_state; -static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__reshape; -static PyObject *__pyx_n_s__right_child; -static PyObject *__pyx_n_s__sample_weight; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__splitter; -static PyObject *__pyx_n_s__sum; -static PyObject *__pyx_n_s__take; -static PyObject *__pyx_n_s__threshold; -static PyObject *__pyx_n_s__tree; -static PyObject *__pyx_n_s__values; -static PyObject *__pyx_n_s__y; -static PyObject *__pyx_n_s__zeros; +static char __pyx_k_B[] = "B"; +static char __pyx_k_C[] = "C"; +static char __pyx_k_H[] = "H"; +static char __pyx_k_I[] = "I"; +static char __pyx_k_L[] = "L"; +static char __pyx_k_O[] = "O"; +static char __pyx_k_Q[] = "Q"; +static char __pyx_k_X[] = "X"; +static char __pyx_k_b[] = "b"; +static char __pyx_k_d[] = "d"; +static char __pyx_k_f[] = "f"; +static char __pyx_k_g[] = "g"; +static char __pyx_k_h[] = "h"; +static char __pyx_k_i[] = "i"; +static char __pyx_k_l[] = "l"; +static char __pyx_k_q[] = "q"; +static char __pyx_k_y[] = "y"; +static char __pyx_k_Zd[] = "Zd"; +static char __pyx_k_Zf[] = "Zf"; +static char __pyx_k_Zg[] = "Zg"; +static char __pyx_k_np[] = "np"; +static char __pyx_k_inf[] = "inf"; +static char __pyx_k_max[] = "max"; +static char __pyx_k_sum[] = "sum"; +static char __pyx_k_axis[] = "axis"; +static char __pyx_k_clip[] = "clip"; +static char __pyx_k_copy[] = "copy"; +static char __pyx_k_intp[] = "intp"; +static char __pyx_k_main[] = "__main__"; +static char __pyx_k_mode[] = "mode"; +static char __pyx_k_ndim[] = "ndim"; +static char __pyx_k_take[] = "take"; +static char __pyx_k_test[] = "__test__"; +static char __pyx_k_tree[] = "tree"; +static char __pyx_k_DTYPE[] = "DTYPE"; +static char __pyx_k_apply[] = "apply"; +static char __pyx_k_build[] = "build"; +static char __pyx_k_dtype[] = "dtype"; +static char __pyx_k_flags[] = "flags"; +static char __pyx_k_int32[] = "int32"; +static char __pyx_k_names[] = "names"; +static char __pyx_k_nodes[] = "nodes"; +static char __pyx_k_numpy[] = "numpy"; +static char __pyx_k_order[] = "order"; +static char __pyx_k_range[] = "range"; +static char __pyx_k_shape[] = "shape"; +static char __pyx_k_zeros[] = "zeros"; +static char __pyx_k_DOUBLE[] = "DOUBLE"; +static char __pyx_k_import[] = "__import__"; +static char __pyx_k_values[] = "values"; +static char __pyx_k_argsort[] = "argsort"; +static char __pyx_k_asarray[] = "asarray"; +static char __pyx_k_feature[] = "feature"; +static char __pyx_k_float32[] = "float32"; +static char __pyx_k_float64[] = "float64"; +static char __pyx_k_formats[] = "formats"; +static char __pyx_k_offsets[] = "offsets"; +static char __pyx_k_predict[] = "predict"; +static char __pyx_k_randint[] = "randint"; +static char __pyx_k_reshape[] = "reshape"; +static char __pyx_k_getstate[] = "__getstate__"; +static char __pyx_k_impurity[] = "impurity"; +static char __pyx_k_itemsize[] = "itemsize"; +static char __pyx_k_splitter[] = "splitter"; +static char __pyx_k_TREE_LEAF[] = "TREE_LEAF"; +static char __pyx_k_criterion[] = "criterion"; +static char __pyx_k_max_depth[] = "max_depth"; +static char __pyx_k_n_classes[] = "n_classes"; +static char __pyx_k_n_outputs[] = "n_outputs"; +static char __pyx_k_n_samples[] = "n_samples"; +static char __pyx_k_normalize[] = "normalize"; +static char __pyx_k_threshold[] = "threshold"; +static char __pyx_k_NODE_DTYPE[] = "NODE_DTYPE"; +static char __pyx_k_ValueError[] = "ValueError"; +static char __pyx_k_contiguous[] = "contiguous"; +static char __pyx_k_left_child[] = "left_child"; +static char __pyx_k_n_features[] = "n_features"; +static char __pyx_k_node_count[] = "node_count"; +static char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; +static char __pyx_k_MemoryError[] = "MemoryError"; +static char __pyx_k_right_child[] = "right_child"; +static char __pyx_k_RuntimeError[] = "RuntimeError"; +static char __pyx_k_c_contiguous[] = "c_contiguous"; +static char __pyx_k_max_features[] = "max_features"; +static char __pyx_k_random_state[] = "random_state"; +static char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; +static char __pyx_k_sample_weight[] = "sample_weight"; +static char __pyx_k_TREE_UNDEFINED[] = "TREE_UNDEFINED"; +static char __pyx_k_asfortranarray[] = "asfortranarray"; +static char __pyx_k_max_leaf_nodes[] = "max_leaf_nodes"; +static char __pyx_k_min_samples_leaf[] = "min_samples_leaf"; +static char __pyx_k_ascontiguousarray[] = "ascontiguousarray"; +static char __pyx_k_min_samples_split[] = "min_samples_split"; +static char __pyx_k_pyx_releasebuffer[] = "__pyx_releasebuffer"; +static char __pyx_k_failed_to_allocate_d_bytes[] = "failed to allocate %d bytes"; +static char __pyx_k_compute_feature_importances[] = "compute_feature_importances"; +static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; +static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_Did_not_recognise_loaded_array_l[] = "Did not recognise loaded array layout"; +static char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported"; +static char __pyx_k_You_have_loaded_Tree_version_whi[] = "You have loaded Tree version which cannot be imported"; +static char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short."; +static PyObject *__pyx_n_s_C; +static PyObject *__pyx_n_s_DOUBLE; +static PyObject *__pyx_n_s_DTYPE; +static PyObject *__pyx_kp_s_Did_not_recognise_loaded_array_l; +static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; +static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; +static PyObject *__pyx_n_s_MemoryError; +static PyObject *__pyx_n_s_NODE_DTYPE; +static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; +static PyObject *__pyx_n_s_RuntimeError; +static PyObject *__pyx_n_s_TREE_LEAF; +static PyObject *__pyx_n_s_TREE_UNDEFINED; +static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_n_s_X; +static PyObject *__pyx_kp_s_You_have_loaded_Tree_version_whi; +static PyObject *__pyx_n_s_apply; +static PyObject *__pyx_n_s_argsort; +static PyObject *__pyx_n_s_asarray; +static PyObject *__pyx_n_s_ascontiguousarray; +static PyObject *__pyx_n_s_asfortranarray; +static PyObject *__pyx_n_s_axis; +static PyObject *__pyx_n_s_build; +static PyObject *__pyx_n_s_c_contiguous; +static PyObject *__pyx_n_s_clip; +static PyObject *__pyx_n_s_compute_feature_importances; +static PyObject *__pyx_n_s_contiguous; +static PyObject *__pyx_n_s_copy; +static PyObject *__pyx_n_s_criterion; +static PyObject *__pyx_n_s_dtype; +static PyObject *__pyx_kp_s_failed_to_allocate_d_bytes; +static PyObject *__pyx_n_s_feature; +static PyObject *__pyx_n_s_flags; +static PyObject *__pyx_n_s_float32; +static PyObject *__pyx_n_s_float64; +static PyObject *__pyx_n_s_formats; +static PyObject *__pyx_n_s_getstate; +static PyObject *__pyx_n_s_import; +static PyObject *__pyx_n_s_impurity; +static PyObject *__pyx_n_s_inf; +static PyObject *__pyx_n_s_int32; +static PyObject *__pyx_n_s_intp; +static PyObject *__pyx_n_s_itemsize; +static PyObject *__pyx_n_s_left_child; +static PyObject *__pyx_n_s_main; +static PyObject *__pyx_n_s_max; +static PyObject *__pyx_n_s_max_depth; +static PyObject *__pyx_n_s_max_features; +static PyObject *__pyx_n_s_max_leaf_nodes; +static PyObject *__pyx_n_s_min_samples_leaf; +static PyObject *__pyx_n_s_min_samples_split; +static PyObject *__pyx_n_s_mode; +static PyObject *__pyx_n_s_n_classes; +static PyObject *__pyx_n_s_n_features; +static PyObject *__pyx_n_s_n_outputs; +static PyObject *__pyx_n_s_n_samples; +static PyObject *__pyx_n_s_names; +static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; +static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; +static PyObject *__pyx_n_s_ndim; +static PyObject *__pyx_n_s_node_count; +static PyObject *__pyx_n_s_nodes; +static PyObject *__pyx_n_s_normalize; +static PyObject *__pyx_n_s_np; +static PyObject *__pyx_n_s_numpy; +static PyObject *__pyx_n_s_offsets; +static PyObject *__pyx_n_s_order; +static PyObject *__pyx_n_s_predict; +static PyObject *__pyx_n_s_pyx_getbuffer; +static PyObject *__pyx_n_s_pyx_releasebuffer; +static PyObject *__pyx_n_s_pyx_vtable; +static PyObject *__pyx_n_s_randint; +static PyObject *__pyx_n_s_random_state; +static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_reshape; +static PyObject *__pyx_n_s_right_child; +static PyObject *__pyx_n_s_sample_weight; +static PyObject *__pyx_n_s_shape; +static PyObject *__pyx_n_s_splitter; +static PyObject *__pyx_n_s_sum; +static PyObject *__pyx_n_s_take; +static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_threshold; +static PyObject *__pyx_n_s_tree; +static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; +static PyObject *__pyx_n_s_values; +static PyObject *__pyx_n_s_y; +static PyObject *__pyx_n_s_zeros; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_int_neg_2; -static PyObject *__pyx_int_15; -static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_k_6; -static PyObject *__pyx_k_7; -static PyObject *__pyx_k_tuple_3; -static PyObject *__pyx_k_tuple_5; -static PyObject *__pyx_k_tuple_10; -static PyObject *__pyx_k_tuple_12; -static PyObject *__pyx_k_tuple_14; -static PyObject *__pyx_k_tuple_17; -static PyObject *__pyx_k_tuple_18; -static PyObject *__pyx_k_tuple_20; +static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_k__3; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_tuple__2; +static PyObject *__pyx_tuple__4; +static PyObject *__pyx_tuple__5; +static PyObject *__pyx_tuple__6; +static PyObject *__pyx_tuple__7; +static PyObject *__pyx_tuple__8; +static PyObject *__pyx_tuple__9; /* "sklearn/tree/_tree.pyx":85 * """Interface for impurity criteria.""" @@ -2347,6 +2364,7 @@ static PyObject *__pyx_k_tuple_20; static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_init(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *__pyx_v_self, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *__pyx_v_y, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_y_stride, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *__pyx_v_sample_weight, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_samples, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_start, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_end) { + /* function exit code */ } /* "sklearn/tree/_tree.pyx":95 @@ -2359,6 +2377,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_init(CYTHON_UNUSED struct _ static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_reset(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *__pyx_v_self) { + /* function exit code */ } /* "sklearn/tree/_tree.pyx":99 @@ -2371,6 +2390,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_reset(CYTHON_UNUSED struct static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_update(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *__pyx_v_self, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_new_pos) { + /* function exit code */ } /* "sklearn/tree/_tree.pyx":104 @@ -2384,6 +2404,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_update(CYTHON_UNUSED struct static double __pyx_f_7sklearn_4tree_5_tree_9Criterion_node_impurity(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *__pyx_v_self) { double __pyx_r; + /* function exit code */ __pyx_r = 0; return __pyx_r; } @@ -2398,6 +2419,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_9Criterion_node_impurity(CYTHON_UNUS static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_children_impurity(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *__pyx_v_self, CYTHON_UNUSED double *__pyx_v_impurity_left, CYTHON_UNUSED double *__pyx_v_impurity_right) { + /* function exit code */ } /* "sklearn/tree/_tree.pyx":114 @@ -2410,6 +2432,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_children_impurity(CYTHON_UN static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_node_value(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *__pyx_v_self, CYTHON_UNUSED double *__pyx_v_dest) { + /* function exit code */ } /* "sklearn/tree/_tree.pyx":118 @@ -2444,11 +2467,27 @@ static double __pyx_f_7sklearn_4tree_5_tree_9Criterion_impurity_improvement(stru __pyx_r = ((__pyx_v_impurity - ((__pyx_v_self->weighted_n_right / __pyx_v_self->weighted_n_node_samples) * __pyx_v_impurity_right)) - ((__pyx_v_self->weighted_n_left / __pyx_v_self->weighted_n_node_samples) * __pyx_v_impurity_left)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":118 + * pass + * + * cdef double impurity_improvement(self, double impurity) nogil: # <<<<<<<<<<<<<< + * """Impurity improvement, i.e. + * impurity - (left impurity + right impurity).""" + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } +/* "sklearn/tree/_tree.pyx":139 + * cdef double* label_count_total + * + * def __cinit__(self, SIZE_t n_outputs, np.ndarray[SIZE_t, ndim=1] n_classes): # <<<<<<<<<<<<<< + * # Default values + * self.y = NULL + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -2461,7 +2500,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_1__cinit__(P __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_outputs,&__pyx_n_s__n_classes,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n_outputs,&__pyx_n_s_n_classes,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -2475,10 +2514,10 @@ static int __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_1__cinit__(P kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_outputs)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n_outputs)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_classes)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n_classes)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -2492,7 +2531,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_1__cinit__(P values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_n_outputs = __Pyx_PyInt_from_py_Py_intptr_t(values[0]); if (unlikely((__pyx_v_n_outputs == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_outputs = __Pyx_PyInt_As_Py_intptr_t(values[0]); if (unlikely((__pyx_v_n_outputs == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_n_classes = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; @@ -2505,6 +2544,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_1__cinit__(P __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n_classes), __pyx_ptype_5numpy_ndarray, 1, "n_classes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(((struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *)__pyx_v_self), __pyx_v_n_outputs, __pyx_v_n_classes); + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -2513,14 +2554,6 @@ static int __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_1__cinit__(P return __pyx_r; } -/* "sklearn/tree/_tree.pyx":139 - * cdef double* label_count_total - * - * def __cinit__(self, SIZE_t n_outputs, np.ndarray[SIZE_t, ndim=1] n_classes): # <<<<<<<<<<<<<< - * # Default values - * self.y = NULL - */ - static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *__pyx_v_self, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n_outputs, PyArrayObject *__pyx_v_n_classes) { __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_k; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_label_count_stride; @@ -2713,9 +2746,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st * cdef SIZE_t k = 0 */ PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; } - __pyx_L3:; /* "sklearn/tree/_tree.pyx":165 * raise MemoryError() @@ -2863,10 +2894,17 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st * def __dealloc__(self): */ PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; } - __pyx_L7:; + /* "sklearn/tree/_tree.pyx":139 + * cdef double* label_count_total + * + * def __cinit__(self, SIZE_t n_outputs, np.ndarray[SIZE_t, ndim=1] n_classes): # <<<<<<<<<<<<<< + * # Default values + * self.y = NULL + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -2884,23 +2922,25 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st return __pyx_r; } +/* "sklearn/tree/_tree.pyx":187 + * raise MemoryError() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * free(self.n_classes) + */ + /* Python wrapper */ static void __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_2__dealloc__(((struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":187 - * raise MemoryError() - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * """Destructor.""" - * free(self.n_classes) - */ - static void __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_2__dealloc__(struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); @@ -2941,9 +2981,26 @@ static void __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_2__dealloc_ */ free(__pyx_v_self->label_count_total); + /* "sklearn/tree/_tree.pyx":187 + * raise MemoryError() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * free(self.n_classes) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } +/* "sklearn/tree/_tree.pyx":194 + * free(self.label_count_total) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (ClassificationCriterion, + * (self.n_outputs, + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -2951,18 +3008,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_5__red __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_4__reduce__(((struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":194 - * free(self.label_count_total) - * - * def __reduce__(self): # <<<<<<<<<<<<<< - * return (ClassificationCriterion, - * (self.n_outputs, - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_4__reduce__(struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2990,7 +3041,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_4__red * sizet_ptr_to_ndarray(self.n_classes, self.n_outputs)), * self.__getstate__()) */ - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->__pyx_base.n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->__pyx_base.n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); /* "sklearn/tree/_tree.pyx":197 @@ -3002,6 +3053,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_4__red */ __pyx_t_2 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_ndarray(__pyx_v_self->n_classes, __pyx_v_self->__pyx_base.n_outputs)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + + /* "sklearn/tree/_tree.pyx":196 + * def __reduce__(self): + * return (ClassificationCriterion, + * (self.n_outputs, # <<<<<<<<<<<<<< + * sizet_ptr_to_ndarray(self.n_classes, self.n_outputs)), + * self.__getstate__()) + */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -3018,28 +3077,43 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_4__red * * def __getstate__(self): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "sklearn/tree/_tree.pyx":195 + * + * def __reduce__(self): + * return (ClassificationCriterion, # <<<<<<<<<<<<<< + * (self.n_outputs, + * sizet_ptr_to_ndarray(self.n_classes, self.n_outputs)), + */ __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_ClassificationCriterion))); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_ClassificationCriterion))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_ClassificationCriterion))); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":194 + * free(self.label_count_total) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (ClassificationCriterion, + * (self.n_outputs, + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -3052,6 +3126,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_4__red return __pyx_r; } +/* "sklearn/tree/_tree.pyx":200 + * self.__getstate__()) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * return {} + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_7__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_7__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -3059,18 +3141,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_7__get __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_6__getstate__(((struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":200 - * self.__getstate__()) - * - * def __getstate__(self): # <<<<<<<<<<<<<< - * return {} - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_6__getstate__(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3089,13 +3165,20 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_6__get */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_r = ((PyObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":200 + * self.__getstate__()) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * return {} + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.ClassificationCriterion.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -3106,6 +3189,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_6__get return __pyx_r; } +/* "sklearn/tree/_tree.pyx":203 + * return {} + * + * def __setstate__(self, d): # <<<<<<<<<<<<<< + * pass + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_9__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_9__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d) { @@ -3113,23 +3204,18 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_9__set __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_8__setstate__(((struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *)__pyx_v_self), ((PyObject *)__pyx_v_d)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":203 - * return {} - * - * def __setstate__(self, d): # <<<<<<<<<<<<<< - * pass - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_8__setstate__(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__", 0); + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -3462,6 +3548,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_ClassificationCriterion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.reset(((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self)); + /* "sklearn/tree/_tree.pyx":206 + * pass + * + * cdef void init(self, DOUBLE_t* y, # <<<<<<<<<<<<<< + * SIZE_t y_stride, + * DOUBLE_t* sample_weight, + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":258 @@ -3641,6 +3736,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_reset(struct __pyx_v_label_count_right = (__pyx_v_label_count_right + __pyx_v_label_count_stride); } + /* "sklearn/tree/_tree.pyx":258 + * self.reset() + * + * cdef void reset(self) nogil: # <<<<<<<<<<<<<< + * """Reset the criterion at pos=start.""" + * self.pos = self.start + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":282 @@ -3873,12 +3977,12 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_update(struc for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_k = __pyx_t_9; - /* "sklearn/tree/_tree.pyx":318 + /* "sklearn/tree/_tree.pyx":317 + * * for k in range(n_outputs): - * label_index = (k * label_count_stride + - * y[i * y_stride + k]) # <<<<<<<<<<<<<< + * label_index = (k * label_count_stride + # <<<<<<<<<<<<<< + * y[i * y_stride + k]) * label_count_left[label_index] += w - * label_count_right[label_index] -= w */ __pyx_v_label_index = ((__pyx_v_k * __pyx_v_label_count_stride) + ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)(__pyx_v_y[((__pyx_v_i * __pyx_v_y_stride) + __pyx_v_k)]))); @@ -3949,6 +4053,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_update(struc */ __pyx_v_self->__pyx_base.pos = __pyx_v_new_pos; + /* "sklearn/tree/_tree.pyx":282 + * label_count_right += label_count_stride + * + * cdef void update(self, SIZE_t new_pos) nogil: # <<<<<<<<<<<<<< + * """Update the collected statistics by moving samples[pos:new_pos] from + * the right child to the left child.""" + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":330 @@ -3962,6 +4075,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_update(struc static double __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_node_impurity(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *__pyx_v_self) { double __pyx_r; + /* function exit code */ __pyx_r = 0; return __pyx_r; } @@ -3976,6 +4090,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_node_impur static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_children_impurity(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion *__pyx_v_self, CYTHON_UNUSED double *__pyx_v_impurity_left, CYTHON_UNUSED double *__pyx_v_impurity_right) { + /* function exit code */ } /* "sklearn/tree/_tree.pyx":336 @@ -4076,6 +4191,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_node_value(s __pyx_v_label_count_total = (__pyx_v_label_count_total + __pyx_v_label_count_stride); } + /* "sklearn/tree/_tree.pyx":336 + * pass + * + * cdef void node_value(self, double* dest) nogil: # <<<<<<<<<<<<<< + * """Compute the node value of samples[start:end] into dest.""" + * cdef SIZE_t n_outputs = self.n_outputs + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":364 @@ -4276,7 +4400,15 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_node_impurity(struct __pyx_ __pyx_r = (__pyx_v_total / __pyx_v_n_outputs); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":364 + * cross-entropy = - \sum_{k=0}^{K-1} pmk log(pmk) + * """ + * cdef double node_impurity(self) nogil: # <<<<<<<<<<<<<< + * """Evaluate the impurity of the current node, i.e. the impurity of + * samples[start:end].""" + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } @@ -4606,6 +4738,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_7Entropy_children_impurity(struct __py */ (__pyx_v_impurity_right[0]) = (__pyx_v_total_right / __pyx_v_n_outputs); + /* "sklearn/tree/_tree.pyx":394 + * return total / n_outputs + * + * cdef void children_impurity(self, double* impurity_left, double* impurity_right) nogil: # <<<<<<<<<<<<<< + * """Evaluate the impurity in children nodes, i.e. the impurity of the + * left child (samples[start:pos]) and the impurity the right child + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":455 @@ -4754,12 +4895,12 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_node_impurity(struct __pyx_obj __pyx_v_gini = (__pyx_v_gini + (__pyx_v_tmp * __pyx_v_tmp)); } - /* "sklearn/tree/_tree.pyx":479 + /* "sklearn/tree/_tree.pyx":478 + * gini += tmp * tmp * - * gini = 1.0 - gini / (weighted_n_node_samples * - * weighted_n_node_samples) # <<<<<<<<<<<<<< + * gini = 1.0 - gini / (weighted_n_node_samples * # <<<<<<<<<<<<<< + * weighted_n_node_samples) * - * total += gini */ __pyx_v_gini = (1.0 - (__pyx_v_gini / (__pyx_v_weighted_n_node_samples * __pyx_v_weighted_n_node_samples))); @@ -4792,7 +4933,15 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_node_impurity(struct __pyx_obj __pyx_r = (__pyx_v_total / __pyx_v_n_outputs); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":455 + * = 1 - \sum_{k=0}^{K-1} pmk ** 2 + * """ + * cdef double node_impurity(self) nogil: # <<<<<<<<<<<<<< + * """Evaluate the impurity of the current node, i.e. the impurity of + * samples[start:end].""" + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } @@ -5032,21 +5181,21 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Gini_children_impurity(struct __pyx_o __pyx_v_gini_right = (__pyx_v_gini_right + (__pyx_v_tmp * __pyx_v_tmp)); } - /* "sklearn/tree/_tree.pyx":520 + /* "sklearn/tree/_tree.pyx":519 + * gini_right += tmp * tmp * - * gini_left = 1.0 - gini_left / (weighted_n_left * - * weighted_n_left) # <<<<<<<<<<<<<< + * gini_left = 1.0 - gini_left / (weighted_n_left * # <<<<<<<<<<<<<< + * weighted_n_left) * gini_right = 1.0 - gini_right / (weighted_n_right * - * weighted_n_right) */ __pyx_v_gini_left = (1.0 - (__pyx_v_gini_left / (__pyx_v_weighted_n_left * __pyx_v_weighted_n_left))); - /* "sklearn/tree/_tree.pyx":522 + /* "sklearn/tree/_tree.pyx":521 + * gini_left = 1.0 - gini_left / (weighted_n_left * * weighted_n_left) - * gini_right = 1.0 - gini_right / (weighted_n_right * - * weighted_n_right) # <<<<<<<<<<<<<< + * gini_right = 1.0 - gini_right / (weighted_n_right * # <<<<<<<<<<<<<< + * weighted_n_right) * - * total_left += gini_left */ __pyx_v_gini_right = (1.0 - (__pyx_v_gini_right / (__pyx_v_weighted_n_right * __pyx_v_weighted_n_right))); @@ -5105,12 +5254,29 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Gini_children_impurity(struct __pyx_o */ (__pyx_v_impurity_right[0]) = (__pyx_v_total_right / __pyx_v_n_outputs); -} - -/* Python wrapper */ -static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n_outputs; + /* "sklearn/tree/_tree.pyx":486 + * return total / n_outputs + * + * cdef void children_impurity(self, double* impurity_left, double* impurity_right) nogil: # <<<<<<<<<<<<<< + * """Evaluate the impurity in children nodes, i.e. the impurity of the + * left child (samples[start:pos]) and the impurity the right child + */ + + /* function exit code */ +} + +/* "sklearn/tree/_tree.pyx":554 + * cdef double* sum_total + * + * def __cinit__(self, SIZE_t n_outputs): # <<<<<<<<<<<<<< + * # Default values + * self.y = NULL + */ + +/* Python wrapper */ +static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n_outputs; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5118,7 +5284,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_outputs,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n_outputs,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -5131,7 +5297,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObj kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_outputs)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n_outputs)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { @@ -5142,7 +5308,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObj } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_n_outputs = __Pyx_PyInt_from_py_Py_intptr_t(values[0]); if (unlikely((__pyx_v_n_outputs == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_outputs = __Pyx_PyInt_As_Py_intptr_t(values[0]); if (unlikely((__pyx_v_n_outputs == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; @@ -5153,18 +5319,12 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObj return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(((struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *)__pyx_v_self), __pyx_v_n_outputs); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":554 - * cdef double* sum_total - * - * def __cinit__(self, SIZE_t n_outputs): # <<<<<<<<<<<<<< - * # Default values - * self.y = NULL - */ - static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *__pyx_v_self, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n_outputs) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -5649,10 +5809,17 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct * def __dealloc__(self): */ PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; } - __pyx_L3:; + /* "sklearn/tree/_tree.pyx":554 + * cdef double* sum_total + * + * def __cinit__(self, SIZE_t n_outputs): # <<<<<<<<<<<<<< + * # Default values + * self.y = NULL + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -5663,23 +5830,25 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct return __pyx_r; } +/* "sklearn/tree/_tree.pyx":610 + * raise MemoryError() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * free(self.mean_left) + */ + /* Python wrapper */ static void __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(((struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":610 - * raise MemoryError() - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * """Destructor.""" - * free(self.mean_left) - */ - static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); @@ -5783,9 +5952,26 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(st */ free(__pyx_v_self->sum_total); + /* "sklearn/tree/_tree.pyx":610 + * raise MemoryError() + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * free(self.mean_left) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } +/* "sklearn/tree/_tree.pyx":624 + * free(self.sum_total) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (RegressionCriterion, (self.n_outputs,), self.__getstate__()) + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -5793,18 +5979,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_5__reduce_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_4__reduce__(((struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":624 - * free(self.sum_total) - * - * def __reduce__(self): # <<<<<<<<<<<<<< - * return (RegressionCriterion, (self.n_outputs,), self.__getstate__()) - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_4__reduce__(struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5824,16 +6004,16 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_4__reduce_ * def __getstate__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->__pyx_base.n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->__pyx_base.n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5841,18 +6021,25 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_4__reduce_ __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_RegressionCriterion))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_RegressionCriterion))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_RegressionCriterion))); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":624 + * free(self.sum_total) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (RegressionCriterion, (self.n_outputs,), self.__getstate__()) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -5865,6 +6052,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_4__reduce_ return __pyx_r; } +/* "sklearn/tree/_tree.pyx":627 + * return (RegressionCriterion, (self.n_outputs,), self.__getstate__()) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * return {} + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_7__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_7__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -5872,18 +6067,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_7__getstat __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_6__getstate__(((struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":627 - * return (RegressionCriterion, (self.n_outputs,), self.__getstate__()) - * - * def __getstate__(self): # <<<<<<<<<<<<<< - * return {} - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_6__getstate__(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -5902,13 +6091,20 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_6__getstat */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_r = ((PyObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":627 + * return (RegressionCriterion, (self.n_outputs,), self.__getstate__()) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * return {} + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.RegressionCriterion.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -5919,6 +6115,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_6__getstat return __pyx_r; } +/* "sklearn/tree/_tree.pyx":630 + * return {} + * + * def __setstate__(self, d): # <<<<<<<<<<<<<< + * pass + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_9__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_9__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d) { @@ -5926,23 +6130,18 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_9__setstat __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_8__setstate__(((struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *)__pyx_v_self), ((PyObject *)__pyx_v_d)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":630 - * return {} - * - * def __setstate__(self, d): # <<<<<<<<<<<<<< - * pass - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_8__setstate__(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__", 0); + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -6481,6 +6680,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_RegressionCriterion *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.reset(((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self)); + /* "sklearn/tree/_tree.pyx":633 + * pass + * + * cdef void init(self, DOUBLE_t* y, # <<<<<<<<<<<<<< + * SIZE_t y_stride, + * DOUBLE_t* sample_weight, + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":707 @@ -6763,6 +6971,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p (__pyx_v_sum_left[__pyx_v_k]) = 0.0; } + /* "sklearn/tree/_tree.pyx":707 + * self.reset() + * + * cdef void reset(self) nogil: # <<<<<<<<<<<<<< + * """Reset the criterion at pos=start.""" + * self.pos = self.start + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":741 @@ -7182,6 +7399,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update(struct __ */ __pyx_v_self->__pyx_base.pos = __pyx_v_new_pos; + /* "sklearn/tree/_tree.pyx":741 + * sum_left[k] = 0.0 + * + * cdef void update(self, SIZE_t new_pos) nogil: # <<<<<<<<<<<<<< + * """Update the collected statistics by moving samples[pos:new_pos] from + * the right child to the left child.""" + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":803 @@ -7195,6 +7421,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update(struct __ static double __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_node_impurity(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *__pyx_v_self) { double __pyx_r; + /* function exit code */ __pyx_r = 0; return __pyx_r; } @@ -7209,6 +7436,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_node_impurity( static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_children_impurity(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion *__pyx_v_self, CYTHON_UNUSED double *__pyx_v_impurity_left, CYTHON_UNUSED double *__pyx_v_impurity_right) { + /* function exit code */ } /* "sklearn/tree/_tree.pyx":809 @@ -7230,6 +7458,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_node_value(struc */ memcpy(__pyx_v_dest, __pyx_v_self->mean_total, (__pyx_v_self->__pyx_base.n_outputs * (sizeof(double)))); + /* "sklearn/tree/_tree.pyx":809 + * pass + * + * cdef void node_value(self, double* dest) nogil: # <<<<<<<<<<<<<< + * """Compute the node value of samples[start:end] into dest.""" + * memcpy(dest, self.mean_total, self.n_outputs * sizeof(double)) + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":819 @@ -7313,12 +7550,12 @@ static double __pyx_f_7sklearn_4tree_5_tree_3MSE_node_impurity(struct __pyx_obj_ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_1; __pyx_t_4+=1) { __pyx_v_k = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":831 + /* "sklearn/tree/_tree.pyx":830 + * * for k in range(n_outputs): - * total += (sq_sum_total[k] / weighted_n_node_samples - - * mean_total[k] * mean_total[k]) # <<<<<<<<<<<<<< + * total += (sq_sum_total[k] / weighted_n_node_samples - # <<<<<<<<<<<<<< + * mean_total[k] * mean_total[k]) * - * return total / n_outputs */ __pyx_v_total = (__pyx_v_total + (((__pyx_v_sq_sum_total[__pyx_v_k]) / __pyx_v_weighted_n_node_samples) - ((__pyx_v_mean_total[__pyx_v_k]) * (__pyx_v_mean_total[__pyx_v_k])))); } @@ -7333,7 +7570,15 @@ static double __pyx_f_7sklearn_4tree_5_tree_3MSE_node_impurity(struct __pyx_obj_ __pyx_r = (__pyx_v_total / __pyx_v_n_outputs); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":819 + * MSE = var_left + var_right + * """ + * cdef double node_impurity(self) nogil: # <<<<<<<<<<<<<< + * """Evaluate the impurity of the current node, i.e. the impurity of + * samples[start:end].""" + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } @@ -7453,6 +7698,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_3MSE_children_impurity(struct __pyx_ob */ (__pyx_v_impurity_right[0]) = (__pyx_v_total_right / __pyx_v_n_outputs); + /* "sklearn/tree/_tree.pyx":835 + * return total / n_outputs + * + * cdef void children_impurity(self, double* impurity_left, double* impurity_right) nogil: # <<<<<<<<<<<<<< + * """Evaluate the impurity in children nodes, i.e. the impurity of the + * left child (samples[start:pos]) and the impurity the right child + */ + + /* function exit code */ } /* "sklearn/tree/_tree.pyx":863 @@ -7602,12 +7856,12 @@ static double __pyx_f_7sklearn_4tree_5_tree_11FriedmanMSE_impurity_improvement(s */ __pyx_v_total_sum_right = (__pyx_v_total_sum_right / __pyx_v_n_outputs); - /* "sklearn/tree/_tree.pyx":881 + /* "sklearn/tree/_tree.pyx":880 + * total_sum_left = total_sum_left / n_outputs * total_sum_right = total_sum_right / n_outputs - * diff = ((total_sum_left / weighted_n_left) - - * (total_sum_right / weighted_n_right)) # <<<<<<<<<<<<<< + * diff = ((total_sum_left / weighted_n_left) - # <<<<<<<<<<<<<< + * (total_sum_right / weighted_n_right)) * - * return (weighted_n_left * weighted_n_right * diff * diff) / (weighted_n_left + weighted_n_right) */ __pyx_v_diff = ((__pyx_v_total_sum_left / __pyx_v_weighted_n_left) - (__pyx_v_total_sum_right / __pyx_v_weighted_n_right)); @@ -7621,11 +7875,27 @@ static double __pyx_f_7sklearn_4tree_5_tree_11FriedmanMSE_impurity_improvement(s __pyx_r = ((((__pyx_v_weighted_n_left * __pyx_v_weighted_n_right) * __pyx_v_diff) * __pyx_v_diff) / (__pyx_v_weighted_n_left + __pyx_v_weighted_n_right)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":863 + * """ + * + * cdef double impurity_improvement(self, double impurity) nogil: # <<<<<<<<<<<<<< + * cdef SIZE_t n_outputs = self.n_outputs + * cdef SIZE_t k + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } +/* "sklearn/tree/_tree.pyx":891 + * + * cdef class Splitter: + * def __cinit__(self, Criterion criterion, # <<<<<<<<<<<<<< + * SIZE_t max_features, + * SIZE_t min_samples_leaf, + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -7640,7 +7910,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_1__cinit__(PyObject *__pyx_v __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__criterion,&__pyx_n_s__max_features,&__pyx_n_s__min_samples_leaf,&__pyx_n_s__random_state,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_criterion,&__pyx_n_s_max_features,&__pyx_n_s_min_samples_leaf,&__pyx_n_s_random_state,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -7656,20 +7926,20 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_1__cinit__(PyObject *__pyx_v kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__criterion)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_criterion)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_features)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_features)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_samples_leaf)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_samples_leaf)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__random_state)) != 0)) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -7686,8 +7956,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_1__cinit__(PyObject *__pyx_v values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)values[0]); - __pyx_v_max_features = __Pyx_PyInt_from_py_Py_intptr_t(values[1]); if (unlikely((__pyx_v_max_features == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_min_samples_leaf = __Pyx_PyInt_from_py_Py_intptr_t(values[2]); if (unlikely((__pyx_v_min_samples_leaf == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_features = __Pyx_PyInt_As_Py_intptr_t(values[1]); if (unlikely((__pyx_v_max_features == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_min_samples_leaf = __Pyx_PyInt_As_Py_intptr_t(values[2]); if (unlikely((__pyx_v_min_samples_leaf == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_random_state = values[3]; } goto __pyx_L4_argument_unpacking_done; @@ -7700,6 +7970,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_1__cinit__(PyObject *__pyx_v __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_criterion), __pyx_ptype_7sklearn_4tree_5_tree_Criterion, 1, "criterion", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self), __pyx_v_criterion, __pyx_v_max_features, __pyx_v_min_samples_leaf, __pyx_v_random_state); + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -7708,14 +7980,6 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_1__cinit__(PyObject *__pyx_v return __pyx_r; } -/* "sklearn/tree/_tree.pyx":891 - * - * cdef class Splitter: - * def __cinit__(self, Criterion criterion, # <<<<<<<<<<<<<< - * SIZE_t max_features, - * SIZE_t min_samples_leaf, - */ - static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self, struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *__pyx_v_criterion, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_max_features, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_min_samples_leaf, PyObject *__pyx_v_random_state) { int __pyx_r; __Pyx_RefNannyDeclarations @@ -7757,7 +8021,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 * self.n_samples = 0 * self.features = NULL # <<<<<<<<<<<<<< * self.n_features = 0 - * + * self.feature_values = NULL */ __pyx_v_self->features = NULL; @@ -7765,13 +8029,22 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 * self.n_samples = 0 * self.features = NULL * self.n_features = 0 # <<<<<<<<<<<<<< + * self.feature_values = NULL * - * self.X = NULL */ __pyx_v_self->n_features = 0; - /* "sklearn/tree/_tree.pyx":902 + /* "sklearn/tree/_tree.pyx":901 + * self.features = NULL * self.n_features = 0 + * self.feature_values = NULL # <<<<<<<<<<<<<< + * + * self.X = NULL + */ + __pyx_v_self->feature_values = NULL; + + /* "sklearn/tree/_tree.pyx":903 + * self.feature_values = NULL * * self.X = NULL # <<<<<<<<<<<<<< * self.X_sample_stride = 0 @@ -7779,7 +8052,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 */ __pyx_v_self->X = NULL; - /* "sklearn/tree/_tree.pyx":903 + /* "sklearn/tree/_tree.pyx":904 * * self.X = NULL * self.X_sample_stride = 0 # <<<<<<<<<<<<<< @@ -7788,7 +8061,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 */ __pyx_v_self->X_sample_stride = 0; - /* "sklearn/tree/_tree.pyx":904 + /* "sklearn/tree/_tree.pyx":905 * self.X = NULL * self.X_sample_stride = 0 * self.X_fx_stride = 0 # <<<<<<<<<<<<<< @@ -7797,7 +8070,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 */ __pyx_v_self->X_fx_stride = 0; - /* "sklearn/tree/_tree.pyx":905 + /* "sklearn/tree/_tree.pyx":906 * self.X_sample_stride = 0 * self.X_fx_stride = 0 * self.y = NULL # <<<<<<<<<<<<<< @@ -7806,7 +8079,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 */ __pyx_v_self->y = NULL; - /* "sklearn/tree/_tree.pyx":906 + /* "sklearn/tree/_tree.pyx":907 * self.X_fx_stride = 0 * self.y = NULL * self.y_stride = 0 # <<<<<<<<<<<<<< @@ -7815,7 +8088,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 */ __pyx_v_self->y_stride = 0; - /* "sklearn/tree/_tree.pyx":907 + /* "sklearn/tree/_tree.pyx":908 * self.y = NULL * self.y_stride = 0 * self.sample_weight = NULL # <<<<<<<<<<<<<< @@ -7824,7 +8097,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 */ __pyx_v_self->sample_weight = NULL; - /* "sklearn/tree/_tree.pyx":909 + /* "sklearn/tree/_tree.pyx":910 * self.sample_weight = NULL * * self.max_features = max_features # <<<<<<<<<<<<<< @@ -7833,7 +8106,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 */ __pyx_v_self->max_features = __pyx_v_max_features; - /* "sklearn/tree/_tree.pyx":910 + /* "sklearn/tree/_tree.pyx":911 * * self.max_features = max_features * self.min_samples_leaf = min_samples_leaf # <<<<<<<<<<<<<< @@ -7842,7 +8115,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 */ __pyx_v_self->min_samples_leaf = __pyx_v_min_samples_leaf; - /* "sklearn/tree/_tree.pyx":911 + /* "sklearn/tree/_tree.pyx":912 * self.max_features = max_features * self.min_samples_leaf = min_samples_leaf * self.random_state = random_state # <<<<<<<<<<<<<< @@ -7855,53 +8128,90 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter___cinit__(struct __pyx_obj_7 __Pyx_DECREF(__pyx_v_self->random_state); __pyx_v_self->random_state = __pyx_v_random_state; + /* "sklearn/tree/_tree.pyx":891 + * + * cdef class Splitter: + * def __cinit__(self, Criterion criterion, # <<<<<<<<<<<<<< + * SIZE_t max_features, + * SIZE_t min_samples_leaf, + */ + + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/tree/_tree.pyx":914 + * self.random_state = random_state + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * free(self.samples) + */ + /* Python wrapper */ static void __pyx_pw_7sklearn_4tree_5_tree_8Splitter_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7sklearn_4tree_5_tree_8Splitter_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_7sklearn_4tree_5_tree_8Splitter_2__dealloc__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":913 - * self.random_state = random_state - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * """Destructor.""" - * free(self.samples) - */ - static void __pyx_pf_7sklearn_4tree_5_tree_8Splitter_2__dealloc__(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "sklearn/tree/_tree.pyx":915 + /* "sklearn/tree/_tree.pyx":916 * def __dealloc__(self): * """Destructor.""" * free(self.samples) # <<<<<<<<<<<<<< * free(self.features) - * + * free(self.feature_values) */ free(__pyx_v_self->samples); - /* "sklearn/tree/_tree.pyx":916 + /* "sklearn/tree/_tree.pyx":917 * """Destructor.""" * free(self.samples) * free(self.features) # <<<<<<<<<<<<<< + * free(self.feature_values) * - * def __getstate__(self): */ free(__pyx_v_self->features); + /* "sklearn/tree/_tree.pyx":918 + * free(self.samples) + * free(self.features) + * free(self.feature_values) # <<<<<<<<<<<<<< + * + * def __getstate__(self): + */ + free(__pyx_v_self->feature_values); + + /* "sklearn/tree/_tree.pyx":914 + * self.random_state = random_state + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * free(self.samples) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } +/* "sklearn/tree/_tree.pyx":920 + * free(self.feature_values) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * return {} + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -7909,18 +8219,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_5__getstate__(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter_4__getstate__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":918 - * free(self.features) - * - * def __getstate__(self): # <<<<<<<<<<<<<< - * return {} - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_4__getstate__(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7930,7 +8234,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_4__getstate__(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getstate__", 0); - /* "sklearn/tree/_tree.pyx":919 + /* "sklearn/tree/_tree.pyx":921 * * def __getstate__(self): * return {} # <<<<<<<<<<<<<< @@ -7938,14 +8242,21 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_4__getstate__(CYTHON_U * def __setstate__(self, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":920 + * free(self.feature_values) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * return {} + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Splitter.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -7956,6 +8267,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_4__getstate__(CYTHON_U return __pyx_r; } +/* "sklearn/tree/_tree.pyx":923 + * return {} + * + * def __setstate__(self, d): # <<<<<<<<<<<<<< + * pass + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d) { @@ -7963,30 +8282,25 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_7__setstate__(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter_6__setstate__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self), ((PyObject *)__pyx_v_d)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":921 - * return {} - * - * def __setstate__(self, d): # <<<<<<<<<<<<<< - * pass - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_6__setstate__(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__", 0); + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":924 +/* "sklearn/tree/_tree.pyx":926 * pass * * cdef void init(self, np.ndarray[DTYPE_t, ndim=2] X, # <<<<<<<<<<<<<< @@ -8001,6 +8315,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_j; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n_features; __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_features; + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_fv; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; __Pyx_LocalBuf_ND __pyx_pybuffernd_y; @@ -8029,45 +8344,27 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DOUBLE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DOUBLE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_y.diminfo[1].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_y.diminfo[1].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[1]; - /* "sklearn/tree/_tree.pyx":929 + /* "sklearn/tree/_tree.pyx":931 * """Initialize the splitter.""" - * # Free old structures, if any - * free(self.samples) # <<<<<<<<<<<<<< - * free(self.features) - * - */ - free(__pyx_v_self->samples); - - /* "sklearn/tree/_tree.pyx":930 - * # Free old structures, if any - * free(self.samples) - * free(self.features) # <<<<<<<<<<<<<< - * - * # Reset random state - */ - free(__pyx_v_self->features); - - /* "sklearn/tree/_tree.pyx":933 - * * # Reset random state * self.rand_r_state = self.random_state.randint(0, RAND_R_MAX) # <<<<<<<<<<<<<< * * # Initialize samples and features structures */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->random_state, __pyx_n_s__randint); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_e_7sklearn_4tree_5_tree_RAND_R_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_e_7sklearn_4tree_5_tree_RAND_R_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); @@ -8075,35 +8372,35 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_from_py_npy_uint32(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_uint32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_As_npy_uint32(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_uint32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->rand_r_state = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":936 + /* "sklearn/tree/_tree.pyx":934 * * # Initialize samples and features structures * cdef SIZE_t n_samples = X.shape[0] # <<<<<<<<<<<<<< - * cdef SIZE_t* samples = malloc(n_samples * sizeof(SIZE_t)) - * if samples == NULL: + * cdef SIZE_t* samples = realloc(self.samples, + * n_samples * sizeof(SIZE_t)) */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/tree/_tree.pyx":937 + /* "sklearn/tree/_tree.pyx":935 * # Initialize samples and features structures * cdef SIZE_t n_samples = X.shape[0] - * cdef SIZE_t* samples = malloc(n_samples * sizeof(SIZE_t)) # <<<<<<<<<<<<<< + * cdef SIZE_t* samples = realloc(self.samples, # <<<<<<<<<<<<<< + * n_samples * sizeof(SIZE_t)) * if samples == NULL: - * raise MemoryError() */ - __pyx_v_samples = ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t *)malloc((__pyx_v_n_samples * (sizeof(__pyx_t_7sklearn_4tree_5_tree_SIZE_t))))); + __pyx_v_samples = ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t *)realloc(__pyx_v_self->samples, (__pyx_v_n_samples * (sizeof(__pyx_t_7sklearn_4tree_5_tree_SIZE_t))))); - /* "sklearn/tree/_tree.pyx":938 - * cdef SIZE_t n_samples = X.shape[0] - * cdef SIZE_t* samples = malloc(n_samples * sizeof(SIZE_t)) + /* "sklearn/tree/_tree.pyx":937 + * cdef SIZE_t* samples = realloc(self.samples, + * n_samples * sizeof(SIZE_t)) * if samples == NULL: # <<<<<<<<<<<<<< * raise MemoryError() * @@ -8111,19 +8408,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea __pyx_t_5 = ((__pyx_v_samples == NULL) != 0); if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":939 - * cdef SIZE_t* samples = malloc(n_samples * sizeof(SIZE_t)) + /* "sklearn/tree/_tree.pyx":938 + * n_samples * sizeof(SIZE_t)) * if samples == NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * cdef SIZE_t i, j */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/tree/_tree.pyx":942 + /* "sklearn/tree/_tree.pyx":941 * * cdef SIZE_t i, j * j = 0 # <<<<<<<<<<<<<< @@ -8132,7 +8427,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea */ __pyx_v_j = 0; - /* "sklearn/tree/_tree.pyx":944 + /* "sklearn/tree/_tree.pyx":943 * j = 0 * * for i in range(n_samples): # <<<<<<<<<<<<<< @@ -8143,7 +8438,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "sklearn/tree/_tree.pyx":946 + /* "sklearn/tree/_tree.pyx":945 * for i in range(n_samples): * # Only work with positively weighted samples * if sample_weight == NULL or sample_weight[i] != 0.0: # <<<<<<<<<<<<<< @@ -8159,7 +8454,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea } if (__pyx_t_9) { - /* "sklearn/tree/_tree.pyx":947 + /* "sklearn/tree/_tree.pyx":946 * # Only work with positively weighted samples * if sample_weight == NULL or sample_weight[i] != 0.0: * samples[j] = i # <<<<<<<<<<<<<< @@ -8168,7 +8463,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea */ (__pyx_v_samples[__pyx_v_j]) = __pyx_v_i; - /* "sklearn/tree/_tree.pyx":948 + /* "sklearn/tree/_tree.pyx":947 * if sample_weight == NULL or sample_weight[i] != 0.0: * samples[j] = i * j += 1 # <<<<<<<<<<<<<< @@ -8181,7 +8476,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea __pyx_L6:; } - /* "sklearn/tree/_tree.pyx":950 + /* "sklearn/tree/_tree.pyx":949 * j += 1 * * self.samples = samples # <<<<<<<<<<<<<< @@ -8190,7 +8485,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea */ __pyx_v_self->samples = __pyx_v_samples; - /* "sklearn/tree/_tree.pyx":951 + /* "sklearn/tree/_tree.pyx":950 * * self.samples = samples * self.n_samples = j # <<<<<<<<<<<<<< @@ -8199,27 +8494,27 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea */ __pyx_v_self->n_samples = __pyx_v_j; - /* "sklearn/tree/_tree.pyx":953 + /* "sklearn/tree/_tree.pyx":952 * self.n_samples = j * * cdef SIZE_t n_features = X.shape[1] # <<<<<<<<<<<<<< - * cdef SIZE_t* features = malloc(n_features * sizeof(SIZE_t)) - * if features == NULL: + * cdef SIZE_t* features = realloc(self.features, + * n_features * sizeof(SIZE_t)) */ __pyx_v_n_features = (__pyx_v_X->dimensions[1]); - /* "sklearn/tree/_tree.pyx":954 + /* "sklearn/tree/_tree.pyx":953 * * cdef SIZE_t n_features = X.shape[1] - * cdef SIZE_t* features = malloc(n_features * sizeof(SIZE_t)) # <<<<<<<<<<<<<< + * cdef SIZE_t* features = realloc(self.features, # <<<<<<<<<<<<<< + * n_features * sizeof(SIZE_t)) * if features == NULL: - * raise MemoryError() */ - __pyx_v_features = ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t *)malloc((__pyx_v_n_features * (sizeof(__pyx_t_7sklearn_4tree_5_tree_SIZE_t))))); + __pyx_v_features = ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t *)realloc(__pyx_v_self->features, (__pyx_v_n_features * (sizeof(__pyx_t_7sklearn_4tree_5_tree_SIZE_t))))); /* "sklearn/tree/_tree.pyx":955 - * cdef SIZE_t n_features = X.shape[1] - * cdef SIZE_t* features = malloc(n_features * sizeof(SIZE_t)) + * cdef SIZE_t* features = realloc(self.features, + * n_features * sizeof(SIZE_t)) * if features == NULL: # <<<<<<<<<<<<<< * raise MemoryError() * @@ -8228,16 +8523,14 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea if (__pyx_t_9) { /* "sklearn/tree/_tree.pyx":956 - * cdef SIZE_t* features = malloc(n_features * sizeof(SIZE_t)) + * n_features * sizeof(SIZE_t)) * if features == NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * for i in range(n_features): */ PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; } - __pyx_L7:; /* "sklearn/tree/_tree.pyx":958 * raise MemoryError() @@ -8274,11 +8567,49 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea * self.features = features * self.n_features = n_features # <<<<<<<<<<<<<< * - * # Initialize X, y, sample_weight + * cdef DTYPE_t* fv = realloc(self.feature_values, */ __pyx_v_self->n_features = __pyx_v_n_features; - /* "sklearn/tree/_tree.pyx":965 + /* "sklearn/tree/_tree.pyx":964 + * self.n_features = n_features + * + * cdef DTYPE_t* fv = realloc(self.feature_values, # <<<<<<<<<<<<<< + * n_samples * sizeof(DTYPE_t)) + * if fv == NULL: + */ + __pyx_v_fv = ((__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *)realloc(__pyx_v_self->feature_values, (__pyx_v_n_samples * (sizeof(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t))))); + + /* "sklearn/tree/_tree.pyx":966 + * cdef DTYPE_t* fv = realloc(self.feature_values, + * n_samples * sizeof(DTYPE_t)) + * if fv == NULL: # <<<<<<<<<<<<<< + * raise MemoryError() + * self.feature_values = fv + */ + __pyx_t_9 = ((__pyx_v_fv == NULL) != 0); + if (__pyx_t_9) { + + /* "sklearn/tree/_tree.pyx":967 + * n_samples * sizeof(DTYPE_t)) + * if fv == NULL: + * raise MemoryError() # <<<<<<<<<<<<<< + * self.feature_values = fv + * + */ + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "sklearn/tree/_tree.pyx":968 + * if fv == NULL: + * raise MemoryError() + * self.feature_values = fv # <<<<<<<<<<<<<< + * + * # Initialize X, y, sample_weight + */ + __pyx_v_self->feature_values = __pyx_v_fv; + + /* "sklearn/tree/_tree.pyx":971 * * # Initialize X, y, sample_weight * self.X = X.data # <<<<<<<<<<<<<< @@ -8287,33 +8618,33 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea */ __pyx_v_self->X = ((__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *)__pyx_v_X->data); - /* "sklearn/tree/_tree.pyx":966 + /* "sklearn/tree/_tree.pyx":972 * # Initialize X, y, sample_weight * self.X = X.data * self.X_sample_stride = X.strides[0] / X.itemsize # <<<<<<<<<<<<<< * self.X_fx_stride = X.strides[1] / X.itemsize * self.y = y.data */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->X_sample_stride = (((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)(__pyx_v_X->strides[0])) / ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)__pyx_t_6)); - /* "sklearn/tree/_tree.pyx":967 + /* "sklearn/tree/_tree.pyx":973 * self.X = X.data * self.X_sample_stride = X.strides[0] / X.itemsize * self.X_fx_stride = X.strides[1] / X.itemsize # <<<<<<<<<<<<<< * self.y = y.data * self.y_stride = y.strides[0] / y.itemsize */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->X_fx_stride = (((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)(__pyx_v_X->strides[1])) / ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)__pyx_t_6)); - /* "sklearn/tree/_tree.pyx":968 + /* "sklearn/tree/_tree.pyx":974 * self.X_sample_stride = X.strides[0] / X.itemsize * self.X_fx_stride = X.strides[1] / X.itemsize * self.y = y.data # <<<<<<<<<<<<<< @@ -8322,20 +8653,20 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea */ __pyx_v_self->y = ((__pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *)__pyx_v_y->data); - /* "sklearn/tree/_tree.pyx":969 + /* "sklearn/tree/_tree.pyx":975 * self.X_fx_stride = X.strides[1] / X.itemsize * self.y = y.data * self.y_stride = y.strides[0] / y.itemsize # <<<<<<<<<<<<<< * self.sample_weight = sample_weight * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->y_stride = (((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)(__pyx_v_y->strides[0])) / ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)__pyx_t_6)); - /* "sklearn/tree/_tree.pyx":970 + /* "sklearn/tree/_tree.pyx":976 * self.y = y.data * self.y_stride = y.strides[0] / y.itemsize * self.sample_weight = sample_weight # <<<<<<<<<<<<<< @@ -8344,6 +8675,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea */ __pyx_v_self->sample_weight = __pyx_v_sample_weight; + /* "sklearn/tree/_tree.pyx":926 + * pass + * + * cdef void init(self, np.ndarray[DTYPE_t, ndim=2] X, # <<<<<<<<<<<<<< + * np.ndarray[DOUBLE_t, ndim=2, mode="c"] y, + * DOUBLE_t* sample_weight): + */ + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -8354,7 +8694,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("sklearn.tree._tree.Splitter.init", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.tree._tree.Splitter.init", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); @@ -8363,7 +8703,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":972 +/* "sklearn/tree/_tree.pyx":978 * self.sample_weight = sample_weight * * cdef void node_reset(self, SIZE_t start, SIZE_t end) nogil: # <<<<<<<<<<<<<< @@ -8373,7 +8713,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_init(struct __pyx_obj_7sklea static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_node_reset(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_start, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_end) { - /* "sklearn/tree/_tree.pyx":974 + /* "sklearn/tree/_tree.pyx":980 * cdef void node_reset(self, SIZE_t start, SIZE_t end) nogil: * """Reset splitter on node samples[start:end].""" * self.start = start # <<<<<<<<<<<<<< @@ -8382,7 +8722,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_node_reset(struct __pyx_obj_ */ __pyx_v_self->start = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":975 + /* "sklearn/tree/_tree.pyx":981 * """Reset splitter on node samples[start:end].""" * self.start = start * self.end = end # <<<<<<<<<<<<<< @@ -8391,18 +8731,27 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_node_reset(struct __pyx_obj_ */ __pyx_v_self->end = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":982 - * self.samples, - * start, - * end) # <<<<<<<<<<<<<< + /* "sklearn/tree/_tree.pyx":983 + * self.end = end * - * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, + * self.criterion.init(self.y, # <<<<<<<<<<<<<< + * self.y_stride, + * self.sample_weight, */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->criterion->__pyx_vtab)->init(__pyx_v_self->criterion, __pyx_v_self->y, __pyx_v_self->y_stride, __pyx_v_self->sample_weight, __pyx_v_self->samples, __pyx_v_start, __pyx_v_end); + /* "sklearn/tree/_tree.pyx":978 + * self.sample_weight = sample_weight + * + * cdef void node_reset(self, SIZE_t start, SIZE_t end) nogil: # <<<<<<<<<<<<<< + * """Reset splitter on node samples[start:end].""" + * self.start = start + */ + + /* function exit code */ } -/* "sklearn/tree/_tree.pyx":984 +/* "sklearn/tree/_tree.pyx":990 * end) * * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, # <<<<<<<<<<<<<< @@ -8412,9 +8761,10 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_node_reset(struct __pyx_obj_ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_node_split(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self, CYTHON_UNUSED double __pyx_v_impurity, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_pos, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_feature, CYTHON_UNUSED double *__pyx_v_threshold, CYTHON_UNUSED double *__pyx_v_impurity_left, CYTHON_UNUSED double *__pyx_v_impurity_right, CYTHON_UNUSED double *__pyx_v_impurity_improvement) { + /* function exit code */ } -/* "sklearn/tree/_tree.pyx":991 +/* "sklearn/tree/_tree.pyx":997 * pass * * cdef void node_value(self, double* dest) nogil: # <<<<<<<<<<<<<< @@ -8424,7 +8774,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_node_split(CYTHON_UNUSED str static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_node_value(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self, double *__pyx_v_dest) { - /* "sklearn/tree/_tree.pyx":993 + /* "sklearn/tree/_tree.pyx":999 * cdef void node_value(self, double* dest) nogil: * """Copy the value of node samples[start:end] into dest.""" * self.criterion.node_value(dest) # <<<<<<<<<<<<<< @@ -8433,8 +8783,25 @@ static void __pyx_f_7sklearn_4tree_5_tree_8Splitter_node_value(struct __pyx_obj_ */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->criterion->__pyx_vtab)->node_value(__pyx_v_self->criterion, __pyx_v_dest); + /* "sklearn/tree/_tree.pyx":997 + * pass + * + * cdef void node_value(self, double* dest) nogil: # <<<<<<<<<<<<<< + * """Copy the value of node samples[start:end] into dest.""" + * self.criterion.node_value(dest) + */ + + /* function exit code */ } +/* "sklearn/tree/_tree.pxd":65 + * cdef class Splitter: + * # Internal structures + * cdef public Criterion criterion # Impurity criterion # <<<<<<<<<<<<<< + * cdef public SIZE_t max_features # Number of features to test + * cdef public SIZE_t min_samples_leaf # Min samples in a leaf + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_9criterion_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_9criterion_1__get__(PyObject *__pyx_v_self) { @@ -8442,18 +8809,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_9criterion_1__get__(Py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter_9criterion___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":65 - * cdef class Splitter: - * # Internal structures - * cdef public Criterion criterion # Impurity criterion # <<<<<<<<<<<<<< - * cdef public SIZE_t max_features # Number of features to test - * cdef public SIZE_t min_samples_leaf # Min samples in a leaf - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_9criterion___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8463,7 +8824,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_9criterion___get__(str __pyx_r = ((PyObject *)__pyx_v_self->criterion); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -8477,6 +8838,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_9criterion_3__set__(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter_9criterion_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8484,20 +8847,25 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_9criterion_3__set__(PyObject static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter_9criterion_2__set__(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_7sklearn_4tree_5_tree_Criterion))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->criterion); __Pyx_DECREF(((PyObject *)__pyx_v_self->criterion)); - __pyx_v_self->criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)__pyx_v_value); + __pyx_v_self->criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)__pyx_t_1); + __pyx_t_1 = 0; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Splitter.criterion.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -8512,6 +8880,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_9criterion_5__del__(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter_9criterion_4__del__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8526,11 +8896,20 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter_9criterion_4__del__(struct _ __Pyx_DECREF(((PyObject *)__pyx_v_self->criterion)); __pyx_v_self->criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)Py_None); + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/tree/_tree.pxd":66 + * # Internal structures + * cdef public Criterion criterion # Impurity criterion + * cdef public SIZE_t max_features # Number of features to test # <<<<<<<<<<<<<< + * cdef public SIZE_t min_samples_leaf # Min samples in a leaf + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_12max_features_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_12max_features_1__get__(PyObject *__pyx_v_self) { @@ -8538,18 +8917,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_12max_features_1__get_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter_12max_features___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":66 - * # Internal structures - * cdef public Criterion criterion # Impurity criterion - * cdef public SIZE_t max_features # Number of features to test # <<<<<<<<<<<<<< - * cdef public SIZE_t min_samples_leaf # Min samples in a leaf - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_12max_features___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8559,14 +8932,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_12max_features___get__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->max_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->max_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Splitter.max_features.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -8584,6 +8956,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_12max_features_3__set__(PyOb __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter_12max_features_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8596,9 +8970,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter_12max_features_2__set__(stru const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->max_features = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -8609,6 +8984,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter_12max_features_2__set__(stru return __pyx_r; } +/* "sklearn/tree/_tree.pxd":67 + * cdef public Criterion criterion # Impurity criterion + * cdef public SIZE_t max_features # Number of features to test + * cdef public SIZE_t min_samples_leaf # Min samples in a leaf # <<<<<<<<<<<<<< + * + * cdef object random_state # Random state + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf_1__get__(PyObject *__pyx_v_self) { @@ -8616,18 +8999,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf_1__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":67 - * cdef public Criterion criterion # Impurity criterion - * cdef public SIZE_t max_features # Number of features to test - * cdef public SIZE_t min_samples_leaf # Min samples in a leaf # <<<<<<<<<<<<<< - * - * cdef object random_state # Random state - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8637,14 +9014,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf___g int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->min_samples_leaf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->min_samples_leaf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Splitter.min_samples_leaf.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -8662,6 +9038,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf_3__set__( __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -8674,9 +9052,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf_2__set__( const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->min_samples_leaf = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -8687,6 +9066,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_8Splitter_16min_samples_leaf_2__set__( return __pyx_r; } +/* "sklearn/tree/_tree.pyx":1004 + * cdef class BestSplitter(Splitter): + * """Splitter for finding the best split.""" + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (BestSplitter, (self.criterion, + * self.max_features, + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_12BestSplitter_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_12BestSplitter_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -8694,18 +9081,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_12BestSplitter_1__reduce__(PyObj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_12BestSplitter___reduce__(((struct __pyx_obj_7sklearn_4tree_5_tree_BestSplitter *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":998 - * cdef class BestSplitter(Splitter): - * """Splitter for finding the best split.""" - * def __reduce__(self): # <<<<<<<<<<<<<< - * return (BestSplitter, (self.criterion, - * self.max_features, - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_12BestSplitter___reduce__(struct __pyx_obj_7sklearn_4tree_5_tree_BestSplitter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -8717,7 +9098,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_12BestSplitter___reduce__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/tree/_tree.pyx":999 + /* "sklearn/tree/_tree.pyx":1005 * """Splitter for finding the best split.""" * def __reduce__(self): * return (BestSplitter, (self.criterion, # <<<<<<<<<<<<<< @@ -8726,34 +9107,34 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_12BestSplitter___reduce__(struct */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/tree/_tree.pyx":1000 + /* "sklearn/tree/_tree.pyx":1006 * def __reduce__(self): * return (BestSplitter, (self.criterion, * self.max_features, # <<<<<<<<<<<<<< * self.min_samples_leaf, * self.random_state), self.__getstate__()) */ - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->__pyx_base.max_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->__pyx_base.max_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/tree/_tree.pyx":1001 + /* "sklearn/tree/_tree.pyx":1007 * return (BestSplitter, (self.criterion, * self.max_features, * self.min_samples_leaf, # <<<<<<<<<<<<<< * self.random_state), self.__getstate__()) * */ - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->__pyx_base.min_samples_leaf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->__pyx_base.min_samples_leaf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/tree/_tree.pyx":1002 + /* "sklearn/tree/_tree.pyx":1005 + * """Splitter for finding the best split.""" + * def __reduce__(self): + * return (BestSplitter, (self.criterion, # <<<<<<<<<<<<<< * self.max_features, * self.min_samples_leaf, - * self.random_state), self.__getstate__()) # <<<<<<<<<<<<<< - * - * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, */ - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.criterion)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->__pyx_base.criterion)); @@ -8767,28 +9148,51 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_12BestSplitter___reduce__(struct __Pyx_GIVEREF(__pyx_v_self->__pyx_base.random_state); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":1008 + * self.max_features, + * self.min_samples_leaf, + * self.random_state), self.__getstate__()) # <<<<<<<<<<<<<< + * + * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":1005 + * """Splitter for finding the best split.""" + * def __reduce__(self): + * return (BestSplitter, (self.criterion, # <<<<<<<<<<<<<< + * self.max_features, + * self.min_samples_leaf, + */ + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_BestSplitter))); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_BestSplitter))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_BestSplitter))); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":1004 + * cdef class BestSplitter(Splitter): + * """Splitter for finding the best split.""" + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (BestSplitter, (self.criterion, + * self.max_features, + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -8801,7 +9205,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_12BestSplitter___reduce__(struct return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1004 +/* "sklearn/tree/_tree.pyx":1010 * self.random_state), self.__getstate__()) * * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, # <<<<<<<<<<<<<< @@ -8816,6 +9220,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_features; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n_features; __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_X; + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_Xf; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_X_sample_stride; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_X_fx_stride; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_max_features; @@ -8845,11 +9250,13 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_t_2; __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_t_3; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_t_5; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; - /* "sklearn/tree/_tree.pyx":1010 + /* "sklearn/tree/_tree.pyx":1016 * """Find the best split on node samples[start:end].""" * # Find the best split * cdef SIZE_t* samples = self.samples # <<<<<<<<<<<<<< @@ -8859,7 +9266,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_1 = __pyx_v_self->__pyx_base.samples; __pyx_v_samples = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1011 + /* "sklearn/tree/_tree.pyx":1017 * # Find the best split * cdef SIZE_t* samples = self.samples * cdef SIZE_t start = self.start # <<<<<<<<<<<<<< @@ -8869,7 +9276,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_2 = __pyx_v_self->__pyx_base.start; __pyx_v_start = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1012 + /* "sklearn/tree/_tree.pyx":1018 * cdef SIZE_t* samples = self.samples * cdef SIZE_t start = self.start * cdef SIZE_t end = self.end # <<<<<<<<<<<<<< @@ -8879,7 +9286,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_2 = __pyx_v_self->__pyx_base.end; __pyx_v_end = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1014 + /* "sklearn/tree/_tree.pyx":1020 * cdef SIZE_t end = self.end * * cdef SIZE_t* features = self.features # <<<<<<<<<<<<<< @@ -8889,7 +9296,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_1 = __pyx_v_self->__pyx_base.features; __pyx_v_features = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1015 + /* "sklearn/tree/_tree.pyx":1021 * * cdef SIZE_t* features = self.features * cdef SIZE_t n_features = self.n_features # <<<<<<<<<<<<<< @@ -8899,19 +9306,29 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_2 = __pyx_v_self->__pyx_base.n_features; __pyx_v_n_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1017 + /* "sklearn/tree/_tree.pyx":1023 * cdef SIZE_t n_features = self.n_features * * cdef DTYPE_t* X = self.X # <<<<<<<<<<<<<< + * cdef DTYPE_t* Xf = self.feature_values * cdef SIZE_t X_sample_stride = self.X_sample_stride - * cdef SIZE_t X_fx_stride = self.X_fx_stride */ __pyx_t_3 = __pyx_v_self->__pyx_base.X; __pyx_v_X = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1018 + /* "sklearn/tree/_tree.pyx":1024 * * cdef DTYPE_t* X = self.X + * cdef DTYPE_t* Xf = self.feature_values # <<<<<<<<<<<<<< + * cdef SIZE_t X_sample_stride = self.X_sample_stride + * cdef SIZE_t X_fx_stride = self.X_fx_stride + */ + __pyx_t_3 = __pyx_v_self->__pyx_base.feature_values; + __pyx_v_Xf = __pyx_t_3; + + /* "sklearn/tree/_tree.pyx":1025 + * cdef DTYPE_t* X = self.X + * cdef DTYPE_t* Xf = self.feature_values * cdef SIZE_t X_sample_stride = self.X_sample_stride # <<<<<<<<<<<<<< * cdef SIZE_t X_fx_stride = self.X_fx_stride * cdef SIZE_t max_features = self.max_features @@ -8919,8 +9336,8 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_2 = __pyx_v_self->__pyx_base.X_sample_stride; __pyx_v_X_sample_stride = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1019 - * cdef DTYPE_t* X = self.X + /* "sklearn/tree/_tree.pyx":1026 + * cdef DTYPE_t* Xf = self.feature_values * cdef SIZE_t X_sample_stride = self.X_sample_stride * cdef SIZE_t X_fx_stride = self.X_fx_stride # <<<<<<<<<<<<<< * cdef SIZE_t max_features = self.max_features @@ -8929,7 +9346,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_2 = __pyx_v_self->__pyx_base.X_fx_stride; __pyx_v_X_fx_stride = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1020 + /* "sklearn/tree/_tree.pyx":1027 * cdef SIZE_t X_sample_stride = self.X_sample_stride * cdef SIZE_t X_fx_stride = self.X_fx_stride * cdef SIZE_t max_features = self.max_features # <<<<<<<<<<<<<< @@ -8939,7 +9356,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_2 = __pyx_v_self->__pyx_base.max_features; __pyx_v_max_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1021 + /* "sklearn/tree/_tree.pyx":1028 * cdef SIZE_t X_fx_stride = self.X_fx_stride * cdef SIZE_t max_features = self.max_features * cdef SIZE_t min_samples_leaf = self.min_samples_leaf # <<<<<<<<<<<<<< @@ -8949,7 +9366,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_t_2 = __pyx_v_self->__pyx_base.min_samples_leaf; __pyx_v_min_samples_leaf = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1022 + /* "sklearn/tree/_tree.pyx":1029 * cdef SIZE_t max_features = self.max_features * cdef SIZE_t min_samples_leaf = self.min_samples_leaf * cdef UINT32_t* random_state = &self.rand_r_state # <<<<<<<<<<<<<< @@ -8958,7 +9375,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_random_state = (&__pyx_v_self->__pyx_base.rand_r_state); - /* "sklearn/tree/_tree.pyx":1024 + /* "sklearn/tree/_tree.pyx":1031 * cdef UINT32_t* random_state = &self.rand_r_state * * cdef double best_impurity_left = INFINITY # <<<<<<<<<<<<<< @@ -8967,7 +9384,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_impurity_left = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1025 + /* "sklearn/tree/_tree.pyx":1032 * * cdef double best_impurity_left = INFINITY * cdef double best_impurity_right = INFINITY # <<<<<<<<<<<<<< @@ -8976,7 +9393,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_impurity_right = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1026 + /* "sklearn/tree/_tree.pyx":1033 * cdef double best_impurity_left = INFINITY * cdef double best_impurity_right = INFINITY * cdef SIZE_t best_pos = end # <<<<<<<<<<<<<< @@ -8985,7 +9402,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_pos = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":1027 + /* "sklearn/tree/_tree.pyx":1034 * cdef double best_impurity_right = INFINITY * cdef SIZE_t best_pos = end * cdef SIZE_t best_feature = 0 # <<<<<<<<<<<<<< @@ -8994,7 +9411,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_feature = 0; - /* "sklearn/tree/_tree.pyx":1028 + /* "sklearn/tree/_tree.pyx":1035 * cdef SIZE_t best_pos = end * cdef SIZE_t best_feature = 0 * cdef double best_threshold = 0. # <<<<<<<<<<<<<< @@ -9003,7 +9420,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_threshold = 0.; - /* "sklearn/tree/_tree.pyx":1029 + /* "sklearn/tree/_tree.pyx":1036 * cdef SIZE_t best_feature = 0 * cdef double best_threshold = 0. * cdef double best_improvement = -INFINITY # <<<<<<<<<<<<<< @@ -9012,7 +9429,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_improvement = (-__pyx_v_7sklearn_4tree_5_tree_INFINITY); - /* "sklearn/tree/_tree.pyx":1040 + /* "sklearn/tree/_tree.pyx":1047 * * cdef SIZE_t f_idx, f_i, f_j, p, tmp * cdef SIZE_t visited_features = 0 # <<<<<<<<<<<<<< @@ -9021,7 +9438,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_visited_features = 0; - /* "sklearn/tree/_tree.pyx":1045 + /* "sklearn/tree/_tree.pyx":1052 * cdef SIZE_t partition_end * * for f_idx in range(n_features): # <<<<<<<<<<<<<< @@ -9032,7 +9449,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_2; __pyx_t_4+=1) { __pyx_v_f_idx = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1047 + /* "sklearn/tree/_tree.pyx":1054 * for f_idx in range(n_features): * # Draw a feature at random * f_i = n_features - f_idx - 1 # <<<<<<<<<<<<<< @@ -9041,7 +9458,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_f_i = ((__pyx_v_n_features - __pyx_v_f_idx) - 1); - /* "sklearn/tree/_tree.pyx":1048 + /* "sklearn/tree/_tree.pyx":1055 * # Draw a feature at random * f_i = n_features - f_idx - 1 * f_j = rand_int(n_features - f_idx, random_state) # <<<<<<<<<<<<<< @@ -9050,7 +9467,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_f_j = __pyx_f_7sklearn_4tree_5_tree_rand_int((__pyx_v_n_features - __pyx_v_f_idx), __pyx_v_random_state); - /* "sklearn/tree/_tree.pyx":1050 + /* "sklearn/tree/_tree.pyx":1057 * f_j = rand_int(n_features - f_idx, random_state) * * tmp = features[f_i] # <<<<<<<<<<<<<< @@ -9059,7 +9476,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_tmp = (__pyx_v_features[__pyx_v_f_i]); - /* "sklearn/tree/_tree.pyx":1051 + /* "sklearn/tree/_tree.pyx":1058 * * tmp = features[f_i] * features[f_i] = features[f_j] # <<<<<<<<<<<<<< @@ -9068,7 +9485,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ (__pyx_v_features[__pyx_v_f_i]) = (__pyx_v_features[__pyx_v_f_j]); - /* "sklearn/tree/_tree.pyx":1052 + /* "sklearn/tree/_tree.pyx":1059 * tmp = features[f_i] * features[f_i] = features[f_j] * features[f_j] = tmp # <<<<<<<<<<<<<< @@ -9077,25 +9494,46 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ (__pyx_v_features[__pyx_v_f_j]) = __pyx_v_tmp; - /* "sklearn/tree/_tree.pyx":1054 + /* "sklearn/tree/_tree.pyx":1061 * features[f_j] = tmp * * current_feature = features[f_i] # <<<<<<<<<<<<<< * - * # Sort samples along that feature + * # Sort samples along that feature; first copy the feature values */ __pyx_v_current_feature = (__pyx_v_features[__pyx_v_f_i]); - /* "sklearn/tree/_tree.pyx":1057 + /* "sklearn/tree/_tree.pyx":1066 + * # for the active samples into Xf, s.t. Xf[i] == X[samples[i], j], + * # so the sort uses the cache more effectively. + * for p in range(start, end): # <<<<<<<<<<<<<< + * Xf[p] = X[X_sample_stride * samples[p] + * + X_fx_stride * current_feature] + */ + __pyx_t_5 = __pyx_v_end; + for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_p = __pyx_t_6; + + /* "sklearn/tree/_tree.pyx":1067 + * # so the sort uses the cache more effectively. + * for p in range(start, end): + * Xf[p] = X[X_sample_stride * samples[p] # <<<<<<<<<<<<<< + * + X_fx_stride * current_feature] * - * # Sort samples along that feature - * sort(X, X_sample_stride, X_fx_stride, current_feature, samples + start, end - start) # <<<<<<<<<<<<<< + */ + (__pyx_v_Xf[__pyx_v_p]) = (__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]); + } + + /* "sklearn/tree/_tree.pyx":1070 + * + X_fx_stride * current_feature] + * + * sort(Xf + start, samples + start, end - start) # <<<<<<<<<<<<<< * * # Evaluate all splits */ - __pyx_f_7sklearn_4tree_5_tree_sort(__pyx_v_X, __pyx_v_X_sample_stride, __pyx_v_X_fx_stride, __pyx_v_current_feature, (__pyx_v_samples + __pyx_v_start), (__pyx_v_end - __pyx_v_start)); + __pyx_f_7sklearn_4tree_5_tree_sort((__pyx_v_Xf + __pyx_v_start), (__pyx_v_samples + __pyx_v_start), (__pyx_v_end - __pyx_v_start)); - /* "sklearn/tree/_tree.pyx":1060 + /* "sklearn/tree/_tree.pyx":1073 * * # Evaluate all splits * self.criterion.reset() # <<<<<<<<<<<<<< @@ -9104,7 +9542,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->reset(__pyx_v_self->__pyx_base.criterion); - /* "sklearn/tree/_tree.pyx":1061 + /* "sklearn/tree/_tree.pyx":1074 * # Evaluate all splits * self.criterion.reset() * p = start # <<<<<<<<<<<<<< @@ -9113,45 +9551,37 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_p = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1063 + /* "sklearn/tree/_tree.pyx":1076 * p = start * * while p < end: # <<<<<<<<<<<<<< - * while ((p + 1 < end) and - * (X[X_sample_stride * samples[p + 1] + X_fx_stride * current_feature] <= + * while p + 1 < end and Xf[p + 1] <= Xf[p] + EPSILON_FLT: + * p += 1 */ while (1) { - __pyx_t_5 = ((__pyx_v_p < __pyx_v_end) != 0); - if (!__pyx_t_5) break; + __pyx_t_7 = ((__pyx_v_p < __pyx_v_end) != 0); + if (!__pyx_t_7) break; - /* "sklearn/tree/_tree.pyx":1064 + /* "sklearn/tree/_tree.pyx":1077 * * while p < end: - * while ((p + 1 < end) and # <<<<<<<<<<<<<< - * (X[X_sample_stride * samples[p + 1] + X_fx_stride * current_feature] <= - * X[X_sample_stride * samples[p] + X_fx_stride * current_feature] + EPSILON_FLT)): - */ - while (1) { - __pyx_t_5 = (((__pyx_v_p + 1) < __pyx_v_end) != 0); - if (__pyx_t_5) { - - /* "sklearn/tree/_tree.pyx":1066 - * while ((p + 1 < end) and - * (X[X_sample_stride * samples[p + 1] + X_fx_stride * current_feature] <= - * X[X_sample_stride * samples[p] + X_fx_stride * current_feature] + EPSILON_FLT)): # <<<<<<<<<<<<<< + * while p + 1 < end and Xf[p + 1] <= Xf[p] + EPSILON_FLT: # <<<<<<<<<<<<<< * p += 1 * */ - __pyx_t_6 = (((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[(__pyx_v_p + 1)])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]) <= ((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]) + __pyx_v_7sklearn_4tree_5_tree_EPSILON_FLT)) != 0); - __pyx_t_7 = __pyx_t_6; + while (1) { + __pyx_t_7 = (((__pyx_v_p + 1) < __pyx_v_end) != 0); + if (__pyx_t_7) { + __pyx_t_8 = (((__pyx_v_Xf[(__pyx_v_p + 1)]) <= ((__pyx_v_Xf[__pyx_v_p]) + __pyx_v_7sklearn_4tree_5_tree_EPSILON_FLT)) != 0); + __pyx_t_9 = __pyx_t_8; } else { - __pyx_t_7 = __pyx_t_5; + __pyx_t_9 = __pyx_t_7; } - if (!__pyx_t_7) break; + if (!__pyx_t_9) break; - /* "sklearn/tree/_tree.pyx":1067 - * (X[X_sample_stride * samples[p + 1] + X_fx_stride * current_feature] <= - * X[X_sample_stride * samples[p] + X_fx_stride * current_feature] + EPSILON_FLT)): + /* "sklearn/tree/_tree.pyx":1078 + * while p < end: + * while p + 1 < end and Xf[p + 1] <= Xf[p] + EPSILON_FLT: * p += 1 # <<<<<<<<<<<<<< * * # (p + 1 >= end) or (X[samples[p + 1], current_feature] > @@ -9159,7 +9589,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx __pyx_v_p = (__pyx_v_p + 1); } - /* "sklearn/tree/_tree.pyx":1071 + /* "sklearn/tree/_tree.pyx":1082 * # (p + 1 >= end) or (X[samples[p + 1], current_feature] > * # X[samples[p], current_feature]) * p += 1 # <<<<<<<<<<<<<< @@ -9168,17 +9598,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_p = (__pyx_v_p + 1); - /* "sklearn/tree/_tree.pyx":1075 + /* "sklearn/tree/_tree.pyx":1086 * # X[samples[p - 1], current_feature]) * * if p < end: # <<<<<<<<<<<<<< * current_pos = p * */ - __pyx_t_7 = ((__pyx_v_p < __pyx_v_end) != 0); - if (__pyx_t_7) { + __pyx_t_9 = ((__pyx_v_p < __pyx_v_end) != 0); + if (__pyx_t_9) { - /* "sklearn/tree/_tree.pyx":1076 + /* "sklearn/tree/_tree.pyx":1087 * * if p < end: * current_pos = p # <<<<<<<<<<<<<< @@ -9187,43 +9617,41 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_current_pos = __pyx_v_p; - /* "sklearn/tree/_tree.pyx":1079 + /* "sklearn/tree/_tree.pyx":1090 * * # Reject if min_samples_leaf is not guaranteed * if (((current_pos - start) < min_samples_leaf) or # <<<<<<<<<<<<<< * ((end - current_pos) < min_samples_leaf)): * continue */ - __pyx_t_7 = (((__pyx_v_current_pos - __pyx_v_start) < __pyx_v_min_samples_leaf) != 0); - if (!__pyx_t_7) { + __pyx_t_9 = (((__pyx_v_current_pos - __pyx_v_start) < __pyx_v_min_samples_leaf) != 0); + if (!__pyx_t_9) { - /* "sklearn/tree/_tree.pyx":1080 + /* "sklearn/tree/_tree.pyx":1091 * # Reject if min_samples_leaf is not guaranteed * if (((current_pos - start) < min_samples_leaf) or * ((end - current_pos) < min_samples_leaf)): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_5 = (((__pyx_v_end - __pyx_v_current_pos) < __pyx_v_min_samples_leaf) != 0); - __pyx_t_6 = __pyx_t_5; + __pyx_t_7 = (((__pyx_v_end - __pyx_v_current_pos) < __pyx_v_min_samples_leaf) != 0); + __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_8 = __pyx_t_9; } - if (__pyx_t_6) { + if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1081 + /* "sklearn/tree/_tree.pyx":1092 * if (((current_pos - start) < min_samples_leaf) or * ((end - current_pos) < min_samples_leaf)): * continue # <<<<<<<<<<<<<< * * self.criterion.update(current_pos) */ - goto __pyx_L5_continue; - goto __pyx_L10; + goto __pyx_L7_continue; } - __pyx_L10:; - /* "sklearn/tree/_tree.pyx":1083 + /* "sklearn/tree/_tree.pyx":1094 * continue * * self.criterion.update(current_pos) # <<<<<<<<<<<<<< @@ -9232,7 +9660,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->update(__pyx_v_self->__pyx_base.criterion, __pyx_v_current_pos); - /* "sklearn/tree/_tree.pyx":1084 + /* "sklearn/tree/_tree.pyx":1095 * * self.criterion.update(current_pos) * current_improvement = self.criterion.impurity_improvement(impurity) # <<<<<<<<<<<<<< @@ -9241,17 +9669,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_current_improvement = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->impurity_improvement(__pyx_v_self->__pyx_base.criterion, __pyx_v_impurity); - /* "sklearn/tree/_tree.pyx":1086 + /* "sklearn/tree/_tree.pyx":1097 * current_improvement = self.criterion.impurity_improvement(impurity) * * if current_improvement > best_improvement: # <<<<<<<<<<<<<< * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) * best_impurity_left = current_impurity_left */ - __pyx_t_6 = ((__pyx_v_current_improvement > __pyx_v_best_improvement) != 0); - if (__pyx_t_6) { + __pyx_t_8 = ((__pyx_v_current_improvement > __pyx_v_best_improvement) != 0); + if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1087 + /* "sklearn/tree/_tree.pyx":1098 * * if current_improvement > best_improvement: * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) # <<<<<<<<<<<<<< @@ -9260,7 +9688,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->children_impurity(__pyx_v_self->__pyx_base.criterion, (&__pyx_v_current_impurity_left), (&__pyx_v_current_impurity_right)); - /* "sklearn/tree/_tree.pyx":1088 + /* "sklearn/tree/_tree.pyx":1099 * if current_improvement > best_improvement: * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) * best_impurity_left = current_impurity_left # <<<<<<<<<<<<<< @@ -9269,7 +9697,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_impurity_left = __pyx_v_current_impurity_left; - /* "sklearn/tree/_tree.pyx":1089 + /* "sklearn/tree/_tree.pyx":1100 * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) * best_impurity_left = current_impurity_left * best_impurity_right = current_impurity_right # <<<<<<<<<<<<<< @@ -9278,7 +9706,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_impurity_right = __pyx_v_current_impurity_right; - /* "sklearn/tree/_tree.pyx":1090 + /* "sklearn/tree/_tree.pyx":1101 * best_impurity_left = current_impurity_left * best_impurity_right = current_impurity_right * best_improvement = current_improvement # <<<<<<<<<<<<<< @@ -9287,7 +9715,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_improvement = __pyx_v_current_improvement; - /* "sklearn/tree/_tree.pyx":1091 + /* "sklearn/tree/_tree.pyx":1102 * best_impurity_right = current_impurity_right * best_improvement = current_improvement * best_pos = current_pos # <<<<<<<<<<<<<< @@ -9296,74 +9724,74 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_best_pos = __pyx_v_current_pos; - /* "sklearn/tree/_tree.pyx":1092 + /* "sklearn/tree/_tree.pyx":1103 * best_improvement = current_improvement * best_pos = current_pos * best_feature = current_feature # <<<<<<<<<<<<<< * - * current_threshold = (X[X_sample_stride * samples[p - 1] + X_fx_stride * current_feature] + + * current_threshold = (Xf[p - 1] + Xf[p]) / 2.0 */ __pyx_v_best_feature = __pyx_v_current_feature; - /* "sklearn/tree/_tree.pyx":1095 + /* "sklearn/tree/_tree.pyx":1105 + * best_feature = current_feature * - * current_threshold = (X[X_sample_stride * samples[p - 1] + X_fx_stride * current_feature] + - * X[X_sample_stride * samples[p] + X_fx_stride * current_feature]) / 2.0 # <<<<<<<<<<<<<< + * current_threshold = (Xf[p - 1] + Xf[p]) / 2.0 # <<<<<<<<<<<<<< * - * if current_threshold == X[X_sample_stride * samples[p] + X_fx_stride * current_feature]: + * if current_threshold == Xf[p]: */ - __pyx_v_current_threshold = (((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[(__pyx_v_p - 1)])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]) + (__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))])) / 2.0); + __pyx_v_current_threshold = (((__pyx_v_Xf[(__pyx_v_p - 1)]) + (__pyx_v_Xf[__pyx_v_p])) / 2.0); - /* "sklearn/tree/_tree.pyx":1097 - * X[X_sample_stride * samples[p] + X_fx_stride * current_feature]) / 2.0 + /* "sklearn/tree/_tree.pyx":1107 + * current_threshold = (Xf[p - 1] + Xf[p]) / 2.0 * - * if current_threshold == X[X_sample_stride * samples[p] + X_fx_stride * current_feature]: # <<<<<<<<<<<<<< - * current_threshold = X[X_sample_stride * samples[p - 1] + X_fx_stride * current_feature] + * if current_threshold == Xf[p]: # <<<<<<<<<<<<<< + * current_threshold = Xf[p - 1] * */ - __pyx_t_6 = ((__pyx_v_current_threshold == (__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))])) != 0); - if (__pyx_t_6) { + __pyx_t_8 = ((__pyx_v_current_threshold == (__pyx_v_Xf[__pyx_v_p])) != 0); + if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1098 + /* "sklearn/tree/_tree.pyx":1108 * - * if current_threshold == X[X_sample_stride * samples[p] + X_fx_stride * current_feature]: - * current_threshold = X[X_sample_stride * samples[p - 1] + X_fx_stride * current_feature] # <<<<<<<<<<<<<< + * if current_threshold == Xf[p]: + * current_threshold = Xf[p - 1] # <<<<<<<<<<<<<< * * best_threshold = current_threshold */ - __pyx_v_current_threshold = (__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[(__pyx_v_p - 1)])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]); - goto __pyx_L12; + __pyx_v_current_threshold = (__pyx_v_Xf[(__pyx_v_p - 1)]); + goto __pyx_L14; } - __pyx_L12:; + __pyx_L14:; - /* "sklearn/tree/_tree.pyx":1100 - * current_threshold = X[X_sample_stride * samples[p - 1] + X_fx_stride * current_feature] + /* "sklearn/tree/_tree.pyx":1110 + * current_threshold = Xf[p - 1] * * best_threshold = current_threshold # <<<<<<<<<<<<<< * * if best_pos == end: # No valid split was ever found */ __pyx_v_best_threshold = __pyx_v_current_threshold; - goto __pyx_L11; + goto __pyx_L13; } - __pyx_L11:; - goto __pyx_L9; + __pyx_L13:; + goto __pyx_L11; } - __pyx_L9:; - __pyx_L5_continue:; + __pyx_L11:; + __pyx_L7_continue:; } - /* "sklearn/tree/_tree.pyx":1102 + /* "sklearn/tree/_tree.pyx":1112 * best_threshold = current_threshold * * if best_pos == end: # No valid split was ever found # <<<<<<<<<<<<<< * continue * */ - __pyx_t_6 = ((__pyx_v_best_pos == __pyx_v_end) != 0); - if (__pyx_t_6) { + __pyx_t_8 = ((__pyx_v_best_pos == __pyx_v_end) != 0); + if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1103 + /* "sklearn/tree/_tree.pyx":1113 * * if best_pos == end: # No valid split was ever found * continue # <<<<<<<<<<<<<< @@ -9371,11 +9799,9 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx * # Count one more visited feature */ goto __pyx_L3_continue; - goto __pyx_L13; } - __pyx_L13:; - /* "sklearn/tree/_tree.pyx":1106 + /* "sklearn/tree/_tree.pyx":1116 * * # Count one more visited feature * visited_features += 1 # <<<<<<<<<<<<<< @@ -9384,17 +9810,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_visited_features = (__pyx_v_visited_features + 1); - /* "sklearn/tree/_tree.pyx":1108 + /* "sklearn/tree/_tree.pyx":1118 * visited_features += 1 * * if visited_features >= max_features: # <<<<<<<<<<<<<< * break * */ - __pyx_t_6 = ((__pyx_v_visited_features >= __pyx_v_max_features) != 0); - if (__pyx_t_6) { + __pyx_t_8 = ((__pyx_v_visited_features >= __pyx_v_max_features) != 0); + if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1109 + /* "sklearn/tree/_tree.pyx":1119 * * if visited_features >= max_features: * break # <<<<<<<<<<<<<< @@ -9402,24 +9828,22 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx * # Reorganize into samples[start:best_pos] + samples[best_pos:end] */ goto __pyx_L4_break; - goto __pyx_L14; } - __pyx_L14:; __pyx_L3_continue:; } __pyx_L4_break:; - /* "sklearn/tree/_tree.pyx":1112 + /* "sklearn/tree/_tree.pyx":1122 * * # Reorganize into samples[start:best_pos] + samples[best_pos:end] * if best_pos < end: # <<<<<<<<<<<<<< * partition_start = start * partition_end = end */ - __pyx_t_6 = ((__pyx_v_best_pos < __pyx_v_end) != 0); - if (__pyx_t_6) { + __pyx_t_8 = ((__pyx_v_best_pos < __pyx_v_end) != 0); + if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1113 + /* "sklearn/tree/_tree.pyx":1123 * # Reorganize into samples[start:best_pos] + samples[best_pos:end] * if best_pos < end: * partition_start = start # <<<<<<<<<<<<<< @@ -9428,7 +9852,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_partition_start = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1114 + /* "sklearn/tree/_tree.pyx":1124 * if best_pos < end: * partition_start = start * partition_end = end # <<<<<<<<<<<<<< @@ -9437,7 +9861,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_partition_end = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":1115 + /* "sklearn/tree/_tree.pyx":1125 * partition_start = start * partition_end = end * p = start # <<<<<<<<<<<<<< @@ -9446,40 +9870,40 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_p = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1117 + /* "sklearn/tree/_tree.pyx":1127 * p = start * * while p < partition_end: # <<<<<<<<<<<<<< - * if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: - * p += 1 + * if X[X_sample_stride * samples[p] + * + X_fx_stride * best_feature] <= best_threshold: */ while (1) { - __pyx_t_6 = ((__pyx_v_p < __pyx_v_partition_end) != 0); - if (!__pyx_t_6) break; + __pyx_t_8 = ((__pyx_v_p < __pyx_v_partition_end) != 0); + if (!__pyx_t_8) break; - /* "sklearn/tree/_tree.pyx":1118 - * + /* "sklearn/tree/_tree.pyx":1129 * while p < partition_end: - * if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: # <<<<<<<<<<<<<< + * if X[X_sample_stride * samples[p] + * + X_fx_stride * best_feature] <= best_threshold: # <<<<<<<<<<<<<< * p += 1 * */ - __pyx_t_6 = (((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_best_feature))]) <= __pyx_v_best_threshold) != 0); - if (__pyx_t_6) { + __pyx_t_8 = (((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_best_feature))]) <= __pyx_v_best_threshold) != 0); + if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1119 - * while p < partition_end: - * if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: + /* "sklearn/tree/_tree.pyx":1130 + * if X[X_sample_stride * samples[p] + * + X_fx_stride * best_feature] <= best_threshold: * p += 1 # <<<<<<<<<<<<<< * * else: */ __pyx_v_p = (__pyx_v_p + 1); - goto __pyx_L18; + goto __pyx_L20; } /*else*/ { - /* "sklearn/tree/_tree.pyx":1122 + /* "sklearn/tree/_tree.pyx":1133 * * else: * partition_end -= 1 # <<<<<<<<<<<<<< @@ -9488,7 +9912,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_partition_end = (__pyx_v_partition_end - 1); - /* "sklearn/tree/_tree.pyx":1124 + /* "sklearn/tree/_tree.pyx":1135 * partition_end -= 1 * * tmp = samples[partition_end] # <<<<<<<<<<<<<< @@ -9497,7 +9921,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ __pyx_v_tmp = (__pyx_v_samples[__pyx_v_partition_end]); - /* "sklearn/tree/_tree.pyx":1125 + /* "sklearn/tree/_tree.pyx":1136 * * tmp = samples[partition_end] * samples[partition_end] = samples[p] # <<<<<<<<<<<<<< @@ -9506,7 +9930,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ (__pyx_v_samples[__pyx_v_partition_end]) = (__pyx_v_samples[__pyx_v_p]); - /* "sklearn/tree/_tree.pyx":1126 + /* "sklearn/tree/_tree.pyx":1137 * tmp = samples[partition_end] * samples[partition_end] = samples[p] * samples[p] = tmp # <<<<<<<<<<<<<< @@ -9515,13 +9939,13 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ (__pyx_v_samples[__pyx_v_p]) = __pyx_v_tmp; } - __pyx_L18:; + __pyx_L20:; } - goto __pyx_L15; + goto __pyx_L17; } - __pyx_L15:; + __pyx_L17:; - /* "sklearn/tree/_tree.pyx":1129 + /* "sklearn/tree/_tree.pyx":1140 * * # Return values * pos[0] = best_pos # <<<<<<<<<<<<<< @@ -9530,7 +9954,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ (__pyx_v_pos[0]) = __pyx_v_best_pos; - /* "sklearn/tree/_tree.pyx":1130 + /* "sklearn/tree/_tree.pyx":1141 * # Return values * pos[0] = best_pos * feature[0] = best_feature # <<<<<<<<<<<<<< @@ -9539,7 +9963,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ (__pyx_v_feature[0]) = __pyx_v_best_feature; - /* "sklearn/tree/_tree.pyx":1131 + /* "sklearn/tree/_tree.pyx":1142 * pos[0] = best_pos * feature[0] = best_feature * threshold[0] = best_threshold # <<<<<<<<<<<<<< @@ -9548,7 +9972,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ (__pyx_v_threshold[0]) = __pyx_v_best_threshold; - /* "sklearn/tree/_tree.pyx":1132 + /* "sklearn/tree/_tree.pyx":1143 * feature[0] = best_feature * threshold[0] = best_threshold * impurity_left[0] = best_impurity_left # <<<<<<<<<<<<<< @@ -9557,7 +9981,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ (__pyx_v_impurity_left[0]) = __pyx_v_best_impurity_left; - /* "sklearn/tree/_tree.pyx":1133 + /* "sklearn/tree/_tree.pyx":1144 * threshold[0] = best_threshold * impurity_left[0] = best_impurity_left * impurity_right[0] = best_impurity_right # <<<<<<<<<<<<<< @@ -9566,298 +9990,810 @@ static void __pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split(struct __pyx */ (__pyx_v_impurity_right[0]) = __pyx_v_best_impurity_right; - /* "sklearn/tree/_tree.pyx":1134 + /* "sklearn/tree/_tree.pyx":1145 * impurity_left[0] = best_impurity_left * impurity_right[0] = best_impurity_right * impurity_improvement[0] = best_improvement # <<<<<<<<<<<<<< * - * cdef inline void sort(DTYPE_t* X, SIZE_t X_sample_stride, SIZE_t X_fx_stride, SIZE_t current_feature, + * */ (__pyx_v_impurity_improvement[0]) = __pyx_v_best_improvement; + /* "sklearn/tree/_tree.pyx":1010 + * self.random_state), self.__getstate__()) + * + * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, # <<<<<<<<<<<<<< + * double* threshold, double* impurity_left, + * double* impurity_right, + */ + + /* function exit code */ } -/* "sklearn/tree/_tree.pyx":1136 - * impurity_improvement[0] = best_improvement +/* "sklearn/tree/_tree.pyx":1150 + * # Sort n-element arrays pointed to by Xf and samples, simultaneously, + * # by the values in Xf. Algorithm: Introsort (Musser, SP&E, 1997). + * cdef inline void sort(DTYPE_t* Xf, SIZE_t* samples, SIZE_t n) nogil: # <<<<<<<<<<<<<< + * cdef int maxd = 2 * log(n) + * introsort(Xf, samples, n, maxd) + */ + +static CYTHON_INLINE void __pyx_f_7sklearn_4tree_5_tree_sort(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_Xf, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_samples, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n) { + int __pyx_v_maxd; + + /* "sklearn/tree/_tree.pyx":1151 + * # by the values in Xf. Algorithm: Introsort (Musser, SP&E, 1997). + * cdef inline void sort(DTYPE_t* Xf, SIZE_t* samples, SIZE_t n) nogil: + * cdef int maxd = 2 * log(n) # <<<<<<<<<<<<<< + * introsort(Xf, samples, n, maxd) * - * cdef inline void sort(DTYPE_t* X, SIZE_t X_sample_stride, SIZE_t X_fx_stride, SIZE_t current_feature, # <<<<<<<<<<<<<< - * SIZE_t* samples, SIZE_t length) nogil: - * """In-place sorting of samples[start:end] using */ + __pyx_v_maxd = (2 * ((int)__pyx_f_7sklearn_4tree_5_tree_log(__pyx_v_n))); -static CYTHON_INLINE void __pyx_f_7sklearn_4tree_5_tree_sort(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_X, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_X_sample_stride, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_X_fx_stride, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_current_feature, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_samples, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_length) { - __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_tmp; - __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t __pyx_v_tmp_value; - __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n; - __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_parent; - __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_index; - __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_child; - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + /* "sklearn/tree/_tree.pyx":1152 + * cdef inline void sort(DTYPE_t* Xf, SIZE_t* samples, SIZE_t n) nogil: + * cdef int maxd = 2 * log(n) + * introsort(Xf, samples, n, maxd) # <<<<<<<<<<<<<< + * + * + */ + __pyx_f_7sklearn_4tree_5_tree_introsort(__pyx_v_Xf, __pyx_v_samples, __pyx_v_n, __pyx_v_maxd); - /* "sklearn/tree/_tree.pyx":1143 - * cdef SIZE_t tmp - * cdef DOUBLE_t tmp_value - * cdef SIZE_t n = length # <<<<<<<<<<<<<< - * cdef SIZE_t parent = length / 2 - * cdef SIZE_t index, child + /* "sklearn/tree/_tree.pyx":1150 + * # Sort n-element arrays pointed to by Xf and samples, simultaneously, + * # by the values in Xf. Algorithm: Introsort (Musser, SP&E, 1997). + * cdef inline void sort(DTYPE_t* Xf, SIZE_t* samples, SIZE_t n) nogil: # <<<<<<<<<<<<<< + * cdef int maxd = 2 * log(n) + * introsort(Xf, samples, n, maxd) */ - __pyx_v_n = __pyx_v_length; - /* "sklearn/tree/_tree.pyx":1144 - * cdef DOUBLE_t tmp_value - * cdef SIZE_t n = length - * cdef SIZE_t parent = length / 2 # <<<<<<<<<<<<<< - * cdef SIZE_t index, child + /* function exit code */ +} + +/* "sklearn/tree/_tree.pyx":1155 * + * + * cdef inline void swap(DTYPE_t* Xf, SIZE_t* samples, SIZE_t i, SIZE_t j) nogil: # <<<<<<<<<<<<<< + * # Helper for sort + * Xf[i], Xf[j] = Xf[j], Xf[i] */ - __pyx_v_parent = (__pyx_v_length / 2); - /* "sklearn/tree/_tree.pyx":1147 - * cdef SIZE_t index, child +static CYTHON_INLINE void __pyx_f_7sklearn_4tree_5_tree_swap(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_Xf, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_samples, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_i, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_j) { + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_t_1; + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_t_2; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_t_3; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_t_4; + + /* "sklearn/tree/_tree.pyx":1157 + * cdef inline void swap(DTYPE_t* Xf, SIZE_t* samples, SIZE_t i, SIZE_t j) nogil: + * # Helper for sort + * Xf[i], Xf[j] = Xf[j], Xf[i] # <<<<<<<<<<<<<< + * samples[i], samples[j] = samples[j], samples[i] * - * while True: # <<<<<<<<<<<<<< - * if parent > 0: - * parent -= 1 */ - while (1) { - if (!1) break; + __pyx_t_1 = (__pyx_v_Xf[__pyx_v_j]); + __pyx_t_2 = (__pyx_v_Xf[__pyx_v_i]); + (__pyx_v_Xf[__pyx_v_i]) = __pyx_t_1; + (__pyx_v_Xf[__pyx_v_j]) = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1148 + /* "sklearn/tree/_tree.pyx":1158 + * # Helper for sort + * Xf[i], Xf[j] = Xf[j], Xf[i] + * samples[i], samples[j] = samples[j], samples[i] # <<<<<<<<<<<<<< + * * - * while True: - * if parent > 0: # <<<<<<<<<<<<<< - * parent -= 1 - * tmp = samples[parent] */ - __pyx_t_1 = ((__pyx_v_parent > 0) != 0); + __pyx_t_3 = (__pyx_v_samples[__pyx_v_j]); + __pyx_t_4 = (__pyx_v_samples[__pyx_v_i]); + (__pyx_v_samples[__pyx_v_i]) = __pyx_t_3; + (__pyx_v_samples[__pyx_v_j]) = __pyx_t_4; + + /* "sklearn/tree/_tree.pyx":1155 + * + * + * cdef inline void swap(DTYPE_t* Xf, SIZE_t* samples, SIZE_t i, SIZE_t j) nogil: # <<<<<<<<<<<<<< + * # Helper for sort + * Xf[i], Xf[j] = Xf[j], Xf[i] + */ + + /* function exit code */ +} + +/* "sklearn/tree/_tree.pyx":1161 + * + * + * cdef inline DTYPE_t median3(DTYPE_t* Xf, SIZE_t n) nogil: # <<<<<<<<<<<<<< + * # Median of three pivot selection, after Bentley and McIlroy (1993). + * # Engineering a sort function. SP&E. Requires 8/3 comparisons on average. + */ + +static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_f_7sklearn_4tree_5_tree_median3(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_Xf, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n) { + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_v_a; + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_v_b; + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_v_c; + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_r; + int __pyx_t_1; + + /* "sklearn/tree/_tree.pyx":1164 + * # Median of three pivot selection, after Bentley and McIlroy (1993). + * # Engineering a sort function. SP&E. Requires 8/3 comparisons on average. + * cdef DTYPE_t a = Xf[0], b = Xf[n / 2], c = Xf[n - 1] # <<<<<<<<<<<<<< + * if a < b: + * if b < c: + */ + __pyx_v_a = (__pyx_v_Xf[0]); + __pyx_v_b = (__pyx_v_Xf[(__pyx_v_n / 2)]); + __pyx_v_c = (__pyx_v_Xf[(__pyx_v_n - 1)]); + + /* "sklearn/tree/_tree.pyx":1165 + * # Engineering a sort function. SP&E. Requires 8/3 comparisons on average. + * cdef DTYPE_t a = Xf[0], b = Xf[n / 2], c = Xf[n - 1] + * if a < b: # <<<<<<<<<<<<<< + * if b < c: + * return b + */ + __pyx_t_1 = ((__pyx_v_a < __pyx_v_b) != 0); + if (__pyx_t_1) { + + /* "sklearn/tree/_tree.pyx":1166 + * cdef DTYPE_t a = Xf[0], b = Xf[n / 2], c = Xf[n - 1] + * if a < b: + * if b < c: # <<<<<<<<<<<<<< + * return b + * elif a < c: + */ + __pyx_t_1 = ((__pyx_v_b < __pyx_v_c) != 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1149 - * while True: - * if parent > 0: - * parent -= 1 # <<<<<<<<<<<<<< - * tmp = samples[parent] + /* "sklearn/tree/_tree.pyx":1167 + * if a < b: + * if b < c: + * return b # <<<<<<<<<<<<<< + * elif a < c: + * return c + */ + __pyx_r = __pyx_v_b; + goto __pyx_L0; + } + + /* "sklearn/tree/_tree.pyx":1168 + * if b < c: + * return b + * elif a < c: # <<<<<<<<<<<<<< + * return c * else: */ - __pyx_v_parent = (__pyx_v_parent - 1); + __pyx_t_1 = ((__pyx_v_a < __pyx_v_c) != 0); + if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1150 - * if parent > 0: - * parent -= 1 - * tmp = samples[parent] # <<<<<<<<<<<<<< + /* "sklearn/tree/_tree.pyx":1169 + * return b + * elif a < c: + * return c # <<<<<<<<<<<<<< * else: - * n -= 1 + * return a */ - __pyx_v_tmp = (__pyx_v_samples[__pyx_v_parent]); - goto __pyx_L5; + __pyx_r = __pyx_v_c; + goto __pyx_L0; } /*else*/ { - /* "sklearn/tree/_tree.pyx":1152 - * tmp = samples[parent] + /* "sklearn/tree/_tree.pyx":1171 + * return c * else: - * n -= 1 # <<<<<<<<<<<<<< - * if n == 0: - * return + * return a # <<<<<<<<<<<<<< + * elif b < c: + * if a < c: */ - __pyx_v_n = (__pyx_v_n - 1); + __pyx_r = __pyx_v_a; + goto __pyx_L0; + } + } - /* "sklearn/tree/_tree.pyx":1153 + /* "sklearn/tree/_tree.pyx":1172 * else: - * n -= 1 - * if n == 0: # <<<<<<<<<<<<<< - * return - * tmp = samples[n] + * return a + * elif b < c: # <<<<<<<<<<<<<< + * if a < c: + * return a */ - __pyx_t_1 = ((__pyx_v_n == 0) != 0); - if (__pyx_t_1) { + __pyx_t_1 = ((__pyx_v_b < __pyx_v_c) != 0); + if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1154 - * n -= 1 - * if n == 0: - * return # <<<<<<<<<<<<<< - * tmp = samples[n] - * samples[n] = samples[0] + /* "sklearn/tree/_tree.pyx":1173 + * return a + * elif b < c: + * if a < c: # <<<<<<<<<<<<<< + * return a + * else: */ - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; + __pyx_t_1 = ((__pyx_v_a < __pyx_v_c) != 0); + if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1155 - * if n == 0: - * return - * tmp = samples[n] # <<<<<<<<<<<<<< - * samples[n] = samples[0] - * + /* "sklearn/tree/_tree.pyx":1174 + * elif b < c: + * if a < c: + * return a # <<<<<<<<<<<<<< + * else: + * return c */ - __pyx_v_tmp = (__pyx_v_samples[__pyx_v_n]); + __pyx_r = __pyx_v_a; + goto __pyx_L0; + } + /*else*/ { - /* "sklearn/tree/_tree.pyx":1156 - * return - * tmp = samples[n] - * samples[n] = samples[0] # <<<<<<<<<<<<<< - * - * tmp_value = X[X_sample_stride * tmp + X_fx_stride * current_feature] + /* "sklearn/tree/_tree.pyx":1176 + * return a + * else: + * return c # <<<<<<<<<<<<<< + * else: + * return b */ - (__pyx_v_samples[__pyx_v_n]) = (__pyx_v_samples[0]); + __pyx_r = __pyx_v_c; + goto __pyx_L0; } - __pyx_L5:; + } + /*else*/ { - /* "sklearn/tree/_tree.pyx":1158 - * samples[n] = samples[0] + /* "sklearn/tree/_tree.pyx":1178 + * return c + * else: + * return b # <<<<<<<<<<<<<< + * * - * tmp_value = X[X_sample_stride * tmp + X_fx_stride * current_feature] # <<<<<<<<<<<<<< - * index = parent - * child = index * 2 + 1 */ - __pyx_v_tmp_value = (__pyx_v_X[((__pyx_v_X_sample_stride * __pyx_v_tmp) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]); + __pyx_r = __pyx_v_b; + goto __pyx_L0; + } - /* "sklearn/tree/_tree.pyx":1159 + /* "sklearn/tree/_tree.pyx":1161 * - * tmp_value = X[X_sample_stride * tmp + X_fx_stride * current_feature] - * index = parent # <<<<<<<<<<<<<< - * child = index * 2 + 1 * + * cdef inline DTYPE_t median3(DTYPE_t* Xf, SIZE_t n) nogil: # <<<<<<<<<<<<<< + * # Median of three pivot selection, after Bentley and McIlroy (1993). + * # Engineering a sort function. SP&E. Requires 8/3 comparisons on average. */ - __pyx_v_index = __pyx_v_parent; - /* "sklearn/tree/_tree.pyx":1160 - * tmp_value = X[X_sample_stride * tmp + X_fx_stride * current_feature] - * index = parent - * child = index * 2 + 1 # <<<<<<<<<<<<<< - * - * while child < n: + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "sklearn/tree/_tree.pyx":1183 + * # Introsort with median of 3 pivot selection and 3-way partition function + * # (robust to repeated elements, e.g. lots of zero features). + * cdef void introsort(DTYPE_t* Xf, SIZE_t *samples, SIZE_t n, int maxd) nogil: # <<<<<<<<<<<<<< + * cdef DTYPE_t pivot + * cdef SIZE_t i, l, r */ - __pyx_v_child = ((__pyx_v_index * 2) + 1); - /* "sklearn/tree/_tree.pyx":1162 - * child = index * 2 + 1 +static void __pyx_f_7sklearn_4tree_5_tree_introsort(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_Xf, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_samples, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n, int __pyx_v_maxd) { + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_v_pivot; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_i; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_l; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_r; + int __pyx_t_1; + + /* "sklearn/tree/_tree.pyx":1187 + * cdef SIZE_t i, l, r * - * while child < n: # <<<<<<<<<<<<<< - * if ((child + 1 < n) and - * (X[X_sample_stride * samples[child + 1] + X_fx_stride * current_feature] > X[X_sample_stride * samples[child] + X_fx_stride * current_feature])): + * while n > 1: # <<<<<<<<<<<<<< + * if maxd <= 0: # max depth limit exceeded ("gone quadratic") + * heapsort(Xf, samples, n) */ - while (1) { - __pyx_t_1 = ((__pyx_v_child < __pyx_v_n) != 0); - if (!__pyx_t_1) break; + while (1) { + __pyx_t_1 = ((__pyx_v_n > 1) != 0); + if (!__pyx_t_1) break; - /* "sklearn/tree/_tree.pyx":1163 + /* "sklearn/tree/_tree.pyx":1188 * - * while child < n: - * if ((child + 1 < n) and # <<<<<<<<<<<<<< - * (X[X_sample_stride * samples[child + 1] + X_fx_stride * current_feature] > X[X_sample_stride * samples[child] + X_fx_stride * current_feature])): - * child += 1 + * while n > 1: + * if maxd <= 0: # max depth limit exceeded ("gone quadratic") # <<<<<<<<<<<<<< + * heapsort(Xf, samples, n) + * return */ - __pyx_t_1 = (((__pyx_v_child + 1) < __pyx_v_n) != 0); - if (__pyx_t_1) { + __pyx_t_1 = ((__pyx_v_maxd <= 0) != 0); + if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1164 - * while child < n: - * if ((child + 1 < n) and - * (X[X_sample_stride * samples[child + 1] + X_fx_stride * current_feature] > X[X_sample_stride * samples[child] + X_fx_stride * current_feature])): # <<<<<<<<<<<<<< - * child += 1 - * + /* "sklearn/tree/_tree.pyx":1189 + * while n > 1: + * if maxd <= 0: # max depth limit exceeded ("gone quadratic") + * heapsort(Xf, samples, n) # <<<<<<<<<<<<<< + * return + * maxd -= 1 */ - __pyx_t_2 = (((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[(__pyx_v_child + 1)])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]) > (__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_child])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))])) != 0); - __pyx_t_3 = __pyx_t_2; - } else { - __pyx_t_3 = __pyx_t_1; - } - if (__pyx_t_3) { + __pyx_f_7sklearn_4tree_5_tree_heapsort(__pyx_v_Xf, __pyx_v_samples, __pyx_v_n); - /* "sklearn/tree/_tree.pyx":1165 - * if ((child + 1 < n) and - * (X[X_sample_stride * samples[child + 1] + X_fx_stride * current_feature] > X[X_sample_stride * samples[child] + X_fx_stride * current_feature])): - * child += 1 # <<<<<<<<<<<<<< + /* "sklearn/tree/_tree.pyx":1190 + * if maxd <= 0: # max depth limit exceeded ("gone quadratic") + * heapsort(Xf, samples, n) + * return # <<<<<<<<<<<<<< + * maxd -= 1 * - * if X[X_sample_stride * samples[child] + X_fx_stride * current_feature] > tmp_value: */ - __pyx_v_child = (__pyx_v_child + 1); - goto __pyx_L9; - } - __pyx_L9:; + goto __pyx_L0; + } - /* "sklearn/tree/_tree.pyx":1167 - * child += 1 + /* "sklearn/tree/_tree.pyx":1191 + * heapsort(Xf, samples, n) + * return + * maxd -= 1 # <<<<<<<<<<<<<< * - * if X[X_sample_stride * samples[child] + X_fx_stride * current_feature] > tmp_value: # <<<<<<<<<<<<<< - * samples[index] = samples[child] - * index = child + * pivot = median3(Xf, n) */ - __pyx_t_3 = (((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_child])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]) > __pyx_v_tmp_value) != 0); - if (__pyx_t_3) { + __pyx_v_maxd = (__pyx_v_maxd - 1); - /* "sklearn/tree/_tree.pyx":1168 + /* "sklearn/tree/_tree.pyx":1193 + * maxd -= 1 * - * if X[X_sample_stride * samples[child] + X_fx_stride * current_feature] > tmp_value: - * samples[index] = samples[child] # <<<<<<<<<<<<<< - * index = child - * child = index * 2 + 1 + * pivot = median3(Xf, n) # <<<<<<<<<<<<<< + * + * # Three-way partition. */ - (__pyx_v_samples[__pyx_v_index]) = (__pyx_v_samples[__pyx_v_child]); + __pyx_v_pivot = __pyx_f_7sklearn_4tree_5_tree_median3(__pyx_v_Xf, __pyx_v_n); - /* "sklearn/tree/_tree.pyx":1169 - * if X[X_sample_stride * samples[child] + X_fx_stride * current_feature] > tmp_value: - * samples[index] = samples[child] - * index = child # <<<<<<<<<<<<<< - * child = index * 2 + 1 + /* "sklearn/tree/_tree.pyx":1196 * + * # Three-way partition. + * i = l = 0 # <<<<<<<<<<<<<< + * r = n + * while i < r: */ - __pyx_v_index = __pyx_v_child; + __pyx_v_i = 0; + __pyx_v_l = 0; - /* "sklearn/tree/_tree.pyx":1170 - * samples[index] = samples[child] - * index = child - * child = index * 2 + 1 # <<<<<<<<<<<<<< - * + /* "sklearn/tree/_tree.pyx":1197 + * # Three-way partition. + * i = l = 0 + * r = n # <<<<<<<<<<<<<< + * while i < r: + * if Xf[i] < pivot: + */ + __pyx_v_r = __pyx_v_n; + + /* "sklearn/tree/_tree.pyx":1198 + * i = l = 0 + * r = n + * while i < r: # <<<<<<<<<<<<<< + * if Xf[i] < pivot: + * swap(Xf, samples, i, l) + */ + while (1) { + __pyx_t_1 = ((__pyx_v_i < __pyx_v_r) != 0); + if (!__pyx_t_1) break; + + /* "sklearn/tree/_tree.pyx":1199 + * r = n + * while i < r: + * if Xf[i] < pivot: # <<<<<<<<<<<<<< + * swap(Xf, samples, i, l) + * i += 1 + */ + __pyx_t_1 = (((__pyx_v_Xf[__pyx_v_i]) < __pyx_v_pivot) != 0); + if (__pyx_t_1) { + + /* "sklearn/tree/_tree.pyx":1200 + * while i < r: + * if Xf[i] < pivot: + * swap(Xf, samples, i, l) # <<<<<<<<<<<<<< + * i += 1 + * l += 1 + */ + __pyx_f_7sklearn_4tree_5_tree_swap(__pyx_v_Xf, __pyx_v_samples, __pyx_v_i, __pyx_v_l); + + /* "sklearn/tree/_tree.pyx":1201 + * if Xf[i] < pivot: + * swap(Xf, samples, i, l) + * i += 1 # <<<<<<<<<<<<<< + * l += 1 + * elif Xf[i] > pivot: + */ + __pyx_v_i = (__pyx_v_i + 1); + + /* "sklearn/tree/_tree.pyx":1202 + * swap(Xf, samples, i, l) + * i += 1 + * l += 1 # <<<<<<<<<<<<<< + * elif Xf[i] > pivot: + * r -= 1 + */ + __pyx_v_l = (__pyx_v_l + 1); + goto __pyx_L8; + } + + /* "sklearn/tree/_tree.pyx":1203 + * i += 1 + * l += 1 + * elif Xf[i] > pivot: # <<<<<<<<<<<<<< + * r -= 1 + * swap(Xf, samples, i, r) + */ + __pyx_t_1 = (((__pyx_v_Xf[__pyx_v_i]) > __pyx_v_pivot) != 0); + if (__pyx_t_1) { + + /* "sklearn/tree/_tree.pyx":1204 + * l += 1 + * elif Xf[i] > pivot: + * r -= 1 # <<<<<<<<<<<<<< + * swap(Xf, samples, i, r) + * else: + */ + __pyx_v_r = (__pyx_v_r - 1); + + /* "sklearn/tree/_tree.pyx":1205 + * elif Xf[i] > pivot: + * r -= 1 + * swap(Xf, samples, i, r) # <<<<<<<<<<<<<< * else: + * i += 1 */ - __pyx_v_child = ((__pyx_v_index * 2) + 1); - goto __pyx_L10; + __pyx_f_7sklearn_4tree_5_tree_swap(__pyx_v_Xf, __pyx_v_samples, __pyx_v_i, __pyx_v_r); + goto __pyx_L8; } /*else*/ { - /* "sklearn/tree/_tree.pyx":1173 - * + /* "sklearn/tree/_tree.pyx":1207 + * swap(Xf, samples, i, r) * else: - * break # <<<<<<<<<<<<<< + * i += 1 # <<<<<<<<<<<<<< * - * samples[index] = tmp + * introsort(Xf, samples, l, maxd) */ - goto __pyx_L8_break; + __pyx_v_i = (__pyx_v_i + 1); } - __pyx_L10:; + __pyx_L8:; } - __pyx_L8_break:; - /* "sklearn/tree/_tree.pyx":1175 - * break + /* "sklearn/tree/_tree.pyx":1209 + * i += 1 + * + * introsort(Xf, samples, l, maxd) # <<<<<<<<<<<<<< + * Xf += r + * samples += r + */ + __pyx_f_7sklearn_4tree_5_tree_introsort(__pyx_v_Xf, __pyx_v_samples, __pyx_v_l, __pyx_v_maxd); + + /* "sklearn/tree/_tree.pyx":1210 + * + * introsort(Xf, samples, l, maxd) + * Xf += r # <<<<<<<<<<<<<< + * samples += r + * n -= r + */ + __pyx_v_Xf = (__pyx_v_Xf + __pyx_v_r); + + /* "sklearn/tree/_tree.pyx":1211 + * introsort(Xf, samples, l, maxd) + * Xf += r + * samples += r # <<<<<<<<<<<<<< + * n -= r * - * samples[index] = tmp # <<<<<<<<<<<<<< + */ + __pyx_v_samples = (__pyx_v_samples + __pyx_v_r); + + /* "sklearn/tree/_tree.pyx":1212 + * Xf += r + * samples += r + * n -= r # <<<<<<<<<<<<<< * * */ - (__pyx_v_samples[__pyx_v_index]) = __pyx_v_tmp; + __pyx_v_n = (__pyx_v_n - __pyx_v_r); } - __pyx_L0:; -} + /* "sklearn/tree/_tree.pyx":1183 + * # Introsort with median of 3 pivot selection and 3-way partition function + * # (robust to repeated elements, e.g. lots of zero features). + * cdef void introsort(DTYPE_t* Xf, SIZE_t *samples, SIZE_t n, int maxd) nogil: # <<<<<<<<<<<<<< + * cdef DTYPE_t pivot + * cdef SIZE_t i, l, r + */ -/* Python wrapper */ -static PyObject *__pyx_pw_7sklearn_4tree_5_tree_14RandomSplitter_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7sklearn_4tree_5_tree_14RandomSplitter_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_14RandomSplitter___reduce__(((struct __pyx_obj_7sklearn_4tree_5_tree_RandomSplitter *)__pyx_v_self)); - __Pyx_RefNannyFinishContext(); - return __pyx_r; + /* function exit code */ + __pyx_L0:; } -/* "sklearn/tree/_tree.pyx":1180 +/* "sklearn/tree/_tree.pyx":1215 + * + * + * cdef inline void sift_down(DTYPE_t* Xf, SIZE_t* samples, # <<<<<<<<<<<<<< + * SIZE_t start, SIZE_t end) nogil: + * # Restore heap order in Xf[start:end] by moving the max element to start. + */ + +static CYTHON_INLINE void __pyx_f_7sklearn_4tree_5_tree_sift_down(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_Xf, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_samples, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_start, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_end) { + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_child; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_maxind; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_root; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + + /* "sklearn/tree/_tree.pyx":1220 + * cdef SIZE_t child, maxind, root + * + * root = start # <<<<<<<<<<<<<< + * while True: + * child = root * 2 + 1 + */ + __pyx_v_root = __pyx_v_start; + + /* "sklearn/tree/_tree.pyx":1221 + * + * root = start + * while True: # <<<<<<<<<<<<<< + * child = root * 2 + 1 + * + */ + while (1) { + + /* "sklearn/tree/_tree.pyx":1222 + * root = start + * while True: + * child = root * 2 + 1 # <<<<<<<<<<<<<< + * + * # find max of root, left child, right child + */ + __pyx_v_child = ((__pyx_v_root * 2) + 1); + + /* "sklearn/tree/_tree.pyx":1225 + * + * # find max of root, left child, right child + * maxind = root # <<<<<<<<<<<<<< + * if child < end and Xf[maxind] < Xf[child]: + * maxind = child + */ + __pyx_v_maxind = __pyx_v_root; + + /* "sklearn/tree/_tree.pyx":1226 + * # find max of root, left child, right child + * maxind = root + * if child < end and Xf[maxind] < Xf[child]: # <<<<<<<<<<<<<< + * maxind = child + * if child + 1 < end and Xf[maxind] < Xf[child + 1]: + */ + __pyx_t_1 = ((__pyx_v_child < __pyx_v_end) != 0); + if (__pyx_t_1) { + __pyx_t_2 = (((__pyx_v_Xf[__pyx_v_maxind]) < (__pyx_v_Xf[__pyx_v_child])) != 0); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "sklearn/tree/_tree.pyx":1227 + * maxind = root + * if child < end and Xf[maxind] < Xf[child]: + * maxind = child # <<<<<<<<<<<<<< + * if child + 1 < end and Xf[maxind] < Xf[child + 1]: + * maxind = child + 1 + */ + __pyx_v_maxind = __pyx_v_child; + goto __pyx_L5; + } + __pyx_L5:; + + /* "sklearn/tree/_tree.pyx":1228 + * if child < end and Xf[maxind] < Xf[child]: + * maxind = child + * if child + 1 < end and Xf[maxind] < Xf[child + 1]: # <<<<<<<<<<<<<< + * maxind = child + 1 + * + */ + __pyx_t_3 = (((__pyx_v_child + 1) < __pyx_v_end) != 0); + if (__pyx_t_3) { + __pyx_t_1 = (((__pyx_v_Xf[__pyx_v_maxind]) < (__pyx_v_Xf[(__pyx_v_child + 1)])) != 0); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "sklearn/tree/_tree.pyx":1229 + * maxind = child + * if child + 1 < end and Xf[maxind] < Xf[child + 1]: + * maxind = child + 1 # <<<<<<<<<<<<<< + * + * if maxind == root: + */ + __pyx_v_maxind = (__pyx_v_child + 1); + goto __pyx_L6; + } + __pyx_L6:; + + /* "sklearn/tree/_tree.pyx":1231 + * maxind = child + 1 + * + * if maxind == root: # <<<<<<<<<<<<<< + * break + * else: + */ + __pyx_t_2 = ((__pyx_v_maxind == __pyx_v_root) != 0); + if (__pyx_t_2) { + + /* "sklearn/tree/_tree.pyx":1232 + * + * if maxind == root: + * break # <<<<<<<<<<<<<< + * else: + * swap(Xf, samples, root, maxind) + */ + goto __pyx_L4_break; + } + /*else*/ { + + /* "sklearn/tree/_tree.pyx":1234 + * break + * else: + * swap(Xf, samples, root, maxind) # <<<<<<<<<<<<<< + * root = maxind + * + */ + __pyx_f_7sklearn_4tree_5_tree_swap(__pyx_v_Xf, __pyx_v_samples, __pyx_v_root, __pyx_v_maxind); + + /* "sklearn/tree/_tree.pyx":1235 + * else: + * swap(Xf, samples, root, maxind) + * root = maxind # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_root = __pyx_v_maxind; + } + } + __pyx_L4_break:; + + /* "sklearn/tree/_tree.pyx":1215 + * + * + * cdef inline void sift_down(DTYPE_t* Xf, SIZE_t* samples, # <<<<<<<<<<<<<< + * SIZE_t start, SIZE_t end) nogil: + * # Restore heap order in Xf[start:end] by moving the max element to start. + */ + + /* function exit code */ +} + +/* "sklearn/tree/_tree.pyx":1238 + * + * + * cdef void heapsort(DTYPE_t* Xf, SIZE_t* samples, SIZE_t n) nogil: # <<<<<<<<<<<<<< + * cdef SIZE_t start, end + * + */ + +static void __pyx_f_7sklearn_4tree_5_tree_heapsort(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_Xf, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_samples, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n) { + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_start; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_end; + int __pyx_t_1; + + /* "sklearn/tree/_tree.pyx":1242 + * + * # heapify + * start = (n - 2) / 2 # <<<<<<<<<<<<<< + * end = n + * while True: + */ + __pyx_v_start = ((__pyx_v_n - 2) / 2); + + /* "sklearn/tree/_tree.pyx":1243 + * # heapify + * start = (n - 2) / 2 + * end = n # <<<<<<<<<<<<<< + * while True: + * sift_down(Xf, samples, start, end) + */ + __pyx_v_end = __pyx_v_n; + + /* "sklearn/tree/_tree.pyx":1244 + * start = (n - 2) / 2 + * end = n + * while True: # <<<<<<<<<<<<<< + * sift_down(Xf, samples, start, end) + * if start == 0: + */ + while (1) { + + /* "sklearn/tree/_tree.pyx":1245 + * end = n + * while True: + * sift_down(Xf, samples, start, end) # <<<<<<<<<<<<<< + * if start == 0: + * break + */ + __pyx_f_7sklearn_4tree_5_tree_sift_down(__pyx_v_Xf, __pyx_v_samples, __pyx_v_start, __pyx_v_end); + + /* "sklearn/tree/_tree.pyx":1246 + * while True: + * sift_down(Xf, samples, start, end) + * if start == 0: # <<<<<<<<<<<<<< + * break + * start -= 1 + */ + __pyx_t_1 = ((__pyx_v_start == 0) != 0); + if (__pyx_t_1) { + + /* "sklearn/tree/_tree.pyx":1247 + * sift_down(Xf, samples, start, end) + * if start == 0: + * break # <<<<<<<<<<<<<< + * start -= 1 + * + */ + goto __pyx_L4_break; + } + + /* "sklearn/tree/_tree.pyx":1248 + * if start == 0: + * break + * start -= 1 # <<<<<<<<<<<<<< + * + * # sort by shrinking the heap, putting the max element immediately after it + */ + __pyx_v_start = (__pyx_v_start - 1); + } + __pyx_L4_break:; + + /* "sklearn/tree/_tree.pyx":1251 + * + * # sort by shrinking the heap, putting the max element immediately after it + * end = n - 1 # <<<<<<<<<<<<<< + * while end > 0: + * swap(Xf, samples, 0, end) + */ + __pyx_v_end = (__pyx_v_n - 1); + + /* "sklearn/tree/_tree.pyx":1252 + * # sort by shrinking the heap, putting the max element immediately after it + * end = n - 1 + * while end > 0: # <<<<<<<<<<<<<< + * swap(Xf, samples, 0, end) + * sift_down(Xf, samples, 0, end) + */ + while (1) { + __pyx_t_1 = ((__pyx_v_end > 0) != 0); + if (!__pyx_t_1) break; + + /* "sklearn/tree/_tree.pyx":1253 + * end = n - 1 + * while end > 0: + * swap(Xf, samples, 0, end) # <<<<<<<<<<<<<< + * sift_down(Xf, samples, 0, end) + * end = end - 1 + */ + __pyx_f_7sklearn_4tree_5_tree_swap(__pyx_v_Xf, __pyx_v_samples, 0, __pyx_v_end); + + /* "sklearn/tree/_tree.pyx":1254 + * while end > 0: + * swap(Xf, samples, 0, end) + * sift_down(Xf, samples, 0, end) # <<<<<<<<<<<<<< + * end = end - 1 + * + */ + __pyx_f_7sklearn_4tree_5_tree_sift_down(__pyx_v_Xf, __pyx_v_samples, 0, __pyx_v_end); + + /* "sklearn/tree/_tree.pyx":1255 + * swap(Xf, samples, 0, end) + * sift_down(Xf, samples, 0, end) + * end = end - 1 # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_end = (__pyx_v_end - 1); + } + + /* "sklearn/tree/_tree.pyx":1238 + * + * + * cdef void heapsort(DTYPE_t* Xf, SIZE_t* samples, SIZE_t n) nogil: # <<<<<<<<<<<<<< + * cdef SIZE_t start, end + * + */ + + /* function exit code */ +} + +/* "sklearn/tree/_tree.pyx":1260 * cdef class RandomSplitter(Splitter): * """Splitter for finding the best random split.""" * def __reduce__(self): # <<<<<<<<<<<<<< @@ -9865,6 +10801,19 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_14RandomSplitter_1__reduce__(PyO * self.max_features, */ +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_4tree_5_tree_14RandomSplitter_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_4tree_5_tree_14RandomSplitter_1__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_14RandomSplitter___reduce__(((struct __pyx_obj_7sklearn_4tree_5_tree_RandomSplitter *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + static PyObject *__pyx_pf_7sklearn_4tree_5_tree_14RandomSplitter___reduce__(struct __pyx_obj_7sklearn_4tree_5_tree_RandomSplitter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -9876,7 +10825,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_14RandomSplitter___reduce__(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/tree/_tree.pyx":1181 + /* "sklearn/tree/_tree.pyx":1261 * """Splitter for finding the best random split.""" * def __reduce__(self): * return (RandomSplitter, (self.criterion, # <<<<<<<<<<<<<< @@ -9885,34 +10834,34 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_14RandomSplitter___reduce__(stru */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/tree/_tree.pyx":1182 + /* "sklearn/tree/_tree.pyx":1262 * def __reduce__(self): * return (RandomSplitter, (self.criterion, * self.max_features, # <<<<<<<<<<<<<< * self.min_samples_leaf, * self.random_state), self.__getstate__()) */ - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->__pyx_base.max_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->__pyx_base.max_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/tree/_tree.pyx":1183 + /* "sklearn/tree/_tree.pyx":1263 * return (RandomSplitter, (self.criterion, * self.max_features, * self.min_samples_leaf, # <<<<<<<<<<<<<< * self.random_state), self.__getstate__()) * */ - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->__pyx_base.min_samples_leaf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->__pyx_base.min_samples_leaf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/tree/_tree.pyx":1184 + /* "sklearn/tree/_tree.pyx":1261 + * """Splitter for finding the best random split.""" + * def __reduce__(self): + * return (RandomSplitter, (self.criterion, # <<<<<<<<<<<<<< * self.max_features, * self.min_samples_leaf, - * self.random_state), self.__getstate__()) # <<<<<<<<<<<<<< - * - * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, */ - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.criterion)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->__pyx_base.criterion)); @@ -9926,28 +10875,51 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_14RandomSplitter___reduce__(stru __Pyx_GIVEREF(__pyx_v_self->__pyx_base.random_state); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":1264 + * self.max_features, + * self.min_samples_leaf, + * self.random_state), self.__getstate__()) # <<<<<<<<<<<<<< + * + * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":1261 + * """Splitter for finding the best random split.""" + * def __reduce__(self): + * return (RandomSplitter, (self.criterion, # <<<<<<<<<<<<<< + * self.max_features, + * self.min_samples_leaf, + */ + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_RandomSplitter))); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_RandomSplitter))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_RandomSplitter))); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":1260 + * cdef class RandomSplitter(Splitter): + * """Splitter for finding the best random split.""" + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (RandomSplitter, (self.criterion, + * self.max_features, + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -9960,7 +10932,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_14RandomSplitter___reduce__(stru return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1186 +/* "sklearn/tree/_tree.pyx":1266 * self.random_state), self.__getstate__()) * * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, # <<<<<<<<<<<<<< @@ -10014,7 +10986,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p int __pyx_t_9; int __pyx_t_10; - /* "sklearn/tree/_tree.pyx":1192 + /* "sklearn/tree/_tree.pyx":1272 * """Find the best random split on node samples[start:end].""" * # Draw random splits and pick the best * cdef SIZE_t* samples = self.samples # <<<<<<<<<<<<<< @@ -10024,7 +10996,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_1 = __pyx_v_self->__pyx_base.samples; __pyx_v_samples = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1193 + /* "sklearn/tree/_tree.pyx":1273 * # Draw random splits and pick the best * cdef SIZE_t* samples = self.samples * cdef SIZE_t start = self.start # <<<<<<<<<<<<<< @@ -10034,7 +11006,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_2 = __pyx_v_self->__pyx_base.start; __pyx_v_start = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1194 + /* "sklearn/tree/_tree.pyx":1274 * cdef SIZE_t* samples = self.samples * cdef SIZE_t start = self.start * cdef SIZE_t end = self.end # <<<<<<<<<<<<<< @@ -10044,7 +11016,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_2 = __pyx_v_self->__pyx_base.end; __pyx_v_end = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1196 + /* "sklearn/tree/_tree.pyx":1276 * cdef SIZE_t end = self.end * * cdef SIZE_t* features = self.features # <<<<<<<<<<<<<< @@ -10054,7 +11026,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_1 = __pyx_v_self->__pyx_base.features; __pyx_v_features = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1197 + /* "sklearn/tree/_tree.pyx":1277 * * cdef SIZE_t* features = self.features * cdef SIZE_t n_features = self.n_features # <<<<<<<<<<<<<< @@ -10064,7 +11036,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_2 = __pyx_v_self->__pyx_base.n_features; __pyx_v_n_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1199 + /* "sklearn/tree/_tree.pyx":1279 * cdef SIZE_t n_features = self.n_features * * cdef DTYPE_t* X = self.X # <<<<<<<<<<<<<< @@ -10074,7 +11046,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_3 = __pyx_v_self->__pyx_base.X; __pyx_v_X = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1200 + /* "sklearn/tree/_tree.pyx":1280 * * cdef DTYPE_t* X = self.X * cdef SIZE_t X_sample_stride = self.X_sample_stride # <<<<<<<<<<<<<< @@ -10084,7 +11056,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_2 = __pyx_v_self->__pyx_base.X_sample_stride; __pyx_v_X_sample_stride = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1201 + /* "sklearn/tree/_tree.pyx":1281 * cdef DTYPE_t* X = self.X * cdef SIZE_t X_sample_stride = self.X_sample_stride * cdef SIZE_t X_fx_stride = self.X_fx_stride # <<<<<<<<<<<<<< @@ -10094,7 +11066,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_2 = __pyx_v_self->__pyx_base.X_fx_stride; __pyx_v_X_fx_stride = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1202 + /* "sklearn/tree/_tree.pyx":1282 * cdef SIZE_t X_sample_stride = self.X_sample_stride * cdef SIZE_t X_fx_stride = self.X_fx_stride * cdef SIZE_t max_features = self.max_features # <<<<<<<<<<<<<< @@ -10104,7 +11076,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_2 = __pyx_v_self->__pyx_base.max_features; __pyx_v_max_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1203 + /* "sklearn/tree/_tree.pyx":1283 * cdef SIZE_t X_fx_stride = self.X_fx_stride * cdef SIZE_t max_features = self.max_features * cdef SIZE_t min_samples_leaf = self.min_samples_leaf # <<<<<<<<<<<<<< @@ -10114,7 +11086,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_2 = __pyx_v_self->__pyx_base.min_samples_leaf; __pyx_v_min_samples_leaf = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1204 + /* "sklearn/tree/_tree.pyx":1284 * cdef SIZE_t max_features = self.max_features * cdef SIZE_t min_samples_leaf = self.min_samples_leaf * cdef UINT32_t* random_state = &self.rand_r_state # <<<<<<<<<<<<<< @@ -10123,7 +11095,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_random_state = (&__pyx_v_self->__pyx_base.rand_r_state); - /* "sklearn/tree/_tree.pyx":1206 + /* "sklearn/tree/_tree.pyx":1286 * cdef UINT32_t* random_state = &self.rand_r_state * * cdef double best_impurity_left = INFINITY # <<<<<<<<<<<<<< @@ -10132,7 +11104,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_impurity_left = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1207 + /* "sklearn/tree/_tree.pyx":1287 * * cdef double best_impurity_left = INFINITY * cdef double best_impurity_right = INFINITY # <<<<<<<<<<<<<< @@ -10141,7 +11113,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_impurity_right = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1208 + /* "sklearn/tree/_tree.pyx":1288 * cdef double best_impurity_left = INFINITY * cdef double best_impurity_right = INFINITY * cdef SIZE_t best_pos = end # <<<<<<<<<<<<<< @@ -10150,7 +11122,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_pos = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":1209 + /* "sklearn/tree/_tree.pyx":1289 * cdef double best_impurity_right = INFINITY * cdef SIZE_t best_pos = end * cdef SIZE_t best_feature = 0 # <<<<<<<<<<<<<< @@ -10159,7 +11131,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_feature = 0; - /* "sklearn/tree/_tree.pyx":1210 + /* "sklearn/tree/_tree.pyx":1290 * cdef SIZE_t best_pos = end * cdef SIZE_t best_feature = 0 * cdef double best_threshold = 0. # <<<<<<<<<<<<<< @@ -10168,7 +11140,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_threshold = 0.; - /* "sklearn/tree/_tree.pyx":1211 + /* "sklearn/tree/_tree.pyx":1291 * cdef SIZE_t best_feature = 0 * cdef double best_threshold = 0. * cdef double best_improvement = -INFINITY # <<<<<<<<<<<<<< @@ -10177,7 +11149,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_improvement = (-__pyx_v_7sklearn_4tree_5_tree_INFINITY); - /* "sklearn/tree/_tree.pyx":1222 + /* "sklearn/tree/_tree.pyx":1302 * * cdef SIZE_t f_idx, f_i, f_j, p, tmp * cdef SIZE_t visited_features = 0 # <<<<<<<<<<<<<< @@ -10186,7 +11158,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_visited_features = 0; - /* "sklearn/tree/_tree.pyx":1230 + /* "sklearn/tree/_tree.pyx":1310 * cdef SIZE_t partition_end * * for f_idx in range(n_features): # <<<<<<<<<<<<<< @@ -10197,7 +11169,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_2; __pyx_t_4+=1) { __pyx_v_f_idx = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1232 + /* "sklearn/tree/_tree.pyx":1312 * for f_idx in range(n_features): * # Draw a feature at random * f_i = n_features - f_idx - 1 # <<<<<<<<<<<<<< @@ -10206,7 +11178,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_f_i = ((__pyx_v_n_features - __pyx_v_f_idx) - 1); - /* "sklearn/tree/_tree.pyx":1233 + /* "sklearn/tree/_tree.pyx":1313 * # Draw a feature at random * f_i = n_features - f_idx - 1 * f_j = rand_int(n_features - f_idx, random_state) # <<<<<<<<<<<<<< @@ -10215,7 +11187,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_f_j = __pyx_f_7sklearn_4tree_5_tree_rand_int((__pyx_v_n_features - __pyx_v_f_idx), __pyx_v_random_state); - /* "sklearn/tree/_tree.pyx":1235 + /* "sklearn/tree/_tree.pyx":1315 * f_j = rand_int(n_features - f_idx, random_state) * * tmp = features[f_i] # <<<<<<<<<<<<<< @@ -10224,7 +11196,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_tmp = (__pyx_v_features[__pyx_v_f_i]); - /* "sklearn/tree/_tree.pyx":1236 + /* "sklearn/tree/_tree.pyx":1316 * * tmp = features[f_i] * features[f_i] = features[f_j] # <<<<<<<<<<<<<< @@ -10233,7 +11205,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_features[__pyx_v_f_i]) = (__pyx_v_features[__pyx_v_f_j]); - /* "sklearn/tree/_tree.pyx":1237 + /* "sklearn/tree/_tree.pyx":1317 * tmp = features[f_i] * features[f_i] = features[f_j] * features[f_j] = tmp # <<<<<<<<<<<<<< @@ -10242,7 +11214,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_features[__pyx_v_f_j]) = __pyx_v_tmp; - /* "sklearn/tree/_tree.pyx":1239 + /* "sklearn/tree/_tree.pyx":1319 * features[f_j] = tmp * * current_feature = features[f_i] # <<<<<<<<<<<<<< @@ -10251,18 +11223,18 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_current_feature = (__pyx_v_features[__pyx_v_f_i]); - /* "sklearn/tree/_tree.pyx":1244 + /* "sklearn/tree/_tree.pyx":1323 + * # Find min, max * min_feature_value = max_feature_value = \ - * X[X_sample_stride * samples[start] - * + X_fx_stride * current_feature] # <<<<<<<<<<<<<< + * X[X_sample_stride * samples[start] # <<<<<<<<<<<<<< + * + X_fx_stride * current_feature] * - * for p in range(start + 1, end): */ __pyx_t_5 = (__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_start])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]); __pyx_v_min_feature_value = __pyx_t_5; __pyx_v_max_feature_value = __pyx_t_5; - /* "sklearn/tree/_tree.pyx":1246 + /* "sklearn/tree/_tree.pyx":1326 * + X_fx_stride * current_feature] * * for p in range(start + 1, end): # <<<<<<<<<<<<<< @@ -10273,16 +11245,16 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p for (__pyx_t_7 = (__pyx_v_start + 1); __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_p = __pyx_t_7; - /* "sklearn/tree/_tree.pyx":1248 + /* "sklearn/tree/_tree.pyx":1327 + * * for p in range(start + 1, end): - * current_feature_value = X[X_sample_stride * samples[p] - * + X_fx_stride * current_feature] # <<<<<<<<<<<<<< + * current_feature_value = X[X_sample_stride * samples[p] # <<<<<<<<<<<<<< + * + X_fx_stride * current_feature] * - * if current_feature_value < min_feature_value: */ __pyx_v_current_feature_value = (__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]); - /* "sklearn/tree/_tree.pyx":1250 + /* "sklearn/tree/_tree.pyx":1330 * + X_fx_stride * current_feature] * * if current_feature_value < min_feature_value: # <<<<<<<<<<<<<< @@ -10292,7 +11264,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_8 = ((__pyx_v_current_feature_value < __pyx_v_min_feature_value) != 0); if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1251 + /* "sklearn/tree/_tree.pyx":1331 * * if current_feature_value < min_feature_value: * min_feature_value = current_feature_value # <<<<<<<<<<<<<< @@ -10303,7 +11275,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p goto __pyx_L7; } - /* "sklearn/tree/_tree.pyx":1252 + /* "sklearn/tree/_tree.pyx":1332 * if current_feature_value < min_feature_value: * min_feature_value = current_feature_value * elif current_feature_value > max_feature_value: # <<<<<<<<<<<<<< @@ -10313,7 +11285,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_8 = ((__pyx_v_current_feature_value > __pyx_v_max_feature_value) != 0); if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1253 + /* "sklearn/tree/_tree.pyx":1333 * min_feature_value = current_feature_value * elif current_feature_value > max_feature_value: * max_feature_value = current_feature_value # <<<<<<<<<<<<<< @@ -10326,7 +11298,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_L7:; } - /* "sklearn/tree/_tree.pyx":1255 + /* "sklearn/tree/_tree.pyx":1335 * max_feature_value = current_feature_value * * if min_feature_value == max_feature_value: # <<<<<<<<<<<<<< @@ -10336,7 +11308,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_8 = ((__pyx_v_min_feature_value == __pyx_v_max_feature_value) != 0); if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1256 + /* "sklearn/tree/_tree.pyx":1336 * * if min_feature_value == max_feature_value: * continue # <<<<<<<<<<<<<< @@ -10344,20 +11316,18 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p * # Draw a random threshold */ goto __pyx_L3_continue; - goto __pyx_L8; } - __pyx_L8:; - /* "sklearn/tree/_tree.pyx":1261 + /* "sklearn/tree/_tree.pyx":1340 + * # Draw a random threshold * current_threshold = (min_feature_value - * + rand_double(random_state) - * * (max_feature_value - min_feature_value)) # <<<<<<<<<<<<<< + * + rand_double(random_state) # <<<<<<<<<<<<<< + * * (max_feature_value - min_feature_value)) * - * if current_threshold == max_feature_value: */ __pyx_v_current_threshold = (__pyx_v_min_feature_value + (__pyx_f_7sklearn_4tree_5_tree_rand_double(__pyx_v_random_state) * (__pyx_v_max_feature_value - __pyx_v_min_feature_value))); - /* "sklearn/tree/_tree.pyx":1263 + /* "sklearn/tree/_tree.pyx":1343 * * (max_feature_value - min_feature_value)) * * if current_threshold == max_feature_value: # <<<<<<<<<<<<<< @@ -10367,7 +11337,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_8 = ((__pyx_v_current_threshold == __pyx_v_max_feature_value) != 0); if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1264 + /* "sklearn/tree/_tree.pyx":1344 * * if current_threshold == max_feature_value: * current_threshold = min_feature_value # <<<<<<<<<<<<<< @@ -10379,7 +11349,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p } __pyx_L9:; - /* "sklearn/tree/_tree.pyx":1267 + /* "sklearn/tree/_tree.pyx":1347 * * # Partition * partition_start = start # <<<<<<<<<<<<<< @@ -10388,7 +11358,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_partition_start = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1268 + /* "sklearn/tree/_tree.pyx":1348 * # Partition * partition_start = start * partition_end = end # <<<<<<<<<<<<<< @@ -10397,7 +11367,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_partition_end = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":1269 + /* "sklearn/tree/_tree.pyx":1349 * partition_start = start * partition_end = end * p = start # <<<<<<<<<<<<<< @@ -10406,7 +11376,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_p = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1271 + /* "sklearn/tree/_tree.pyx":1351 * p = start * * while p < partition_end: # <<<<<<<<<<<<<< @@ -10417,7 +11387,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_8 = ((__pyx_v_p < __pyx_v_partition_end) != 0); if (!__pyx_t_8) break; - /* "sklearn/tree/_tree.pyx":1273 + /* "sklearn/tree/_tree.pyx":1353 * while p < partition_end: * if X[X_sample_stride * samples[p] * + X_fx_stride * current_feature] <= current_threshold: # <<<<<<<<<<<<<< @@ -10427,7 +11397,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_8 = (((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]) <= __pyx_v_current_threshold) != 0); if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1274 + /* "sklearn/tree/_tree.pyx":1354 * if X[X_sample_stride * samples[p] * + X_fx_stride * current_feature] <= current_threshold: * p += 1 # <<<<<<<<<<<<<< @@ -10439,7 +11409,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p } /*else*/ { - /* "sklearn/tree/_tree.pyx":1277 + /* "sklearn/tree/_tree.pyx":1357 * * else: * partition_end -= 1 # <<<<<<<<<<<<<< @@ -10448,7 +11418,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_partition_end = (__pyx_v_partition_end - 1); - /* "sklearn/tree/_tree.pyx":1279 + /* "sklearn/tree/_tree.pyx":1359 * partition_end -= 1 * * tmp = samples[partition_end] # <<<<<<<<<<<<<< @@ -10457,7 +11427,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_tmp = (__pyx_v_samples[__pyx_v_partition_end]); - /* "sklearn/tree/_tree.pyx":1280 + /* "sklearn/tree/_tree.pyx":1360 * * tmp = samples[partition_end] * samples[partition_end] = samples[p] # <<<<<<<<<<<<<< @@ -10466,7 +11436,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_samples[__pyx_v_partition_end]) = (__pyx_v_samples[__pyx_v_p]); - /* "sklearn/tree/_tree.pyx":1281 + /* "sklearn/tree/_tree.pyx":1361 * tmp = samples[partition_end] * samples[partition_end] = samples[p] * samples[p] = tmp # <<<<<<<<<<<<<< @@ -10478,7 +11448,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_L12:; } - /* "sklearn/tree/_tree.pyx":1283 + /* "sklearn/tree/_tree.pyx":1363 * samples[p] = tmp * * current_pos = partition_end # <<<<<<<<<<<<<< @@ -10487,7 +11457,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_current_pos = __pyx_v_partition_end; - /* "sklearn/tree/_tree.pyx":1286 + /* "sklearn/tree/_tree.pyx":1366 * * # Reject if min_samples_leaf is not guaranteed * if (((current_pos - start) < min_samples_leaf) or # <<<<<<<<<<<<<< @@ -10497,7 +11467,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_8 = (((__pyx_v_current_pos - __pyx_v_start) < __pyx_v_min_samples_leaf) != 0); if (!__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1287 + /* "sklearn/tree/_tree.pyx":1367 * # Reject if min_samples_leaf is not guaranteed * if (((current_pos - start) < min_samples_leaf) or * ((end - current_pos) < min_samples_leaf)): # <<<<<<<<<<<<<< @@ -10511,7 +11481,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p } if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1288 + /* "sklearn/tree/_tree.pyx":1368 * if (((current_pos - start) < min_samples_leaf) or * ((end - current_pos) < min_samples_leaf)): * continue # <<<<<<<<<<<<<< @@ -10519,11 +11489,9 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p * # Evaluate split */ goto __pyx_L3_continue; - goto __pyx_L13; } - __pyx_L13:; - /* "sklearn/tree/_tree.pyx":1291 + /* "sklearn/tree/_tree.pyx":1371 * * # Evaluate split * self.criterion.reset() # <<<<<<<<<<<<<< @@ -10532,7 +11500,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->reset(__pyx_v_self->__pyx_base.criterion); - /* "sklearn/tree/_tree.pyx":1292 + /* "sklearn/tree/_tree.pyx":1372 * # Evaluate split * self.criterion.reset() * self.criterion.update(current_pos) # <<<<<<<<<<<<<< @@ -10541,7 +11509,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->update(__pyx_v_self->__pyx_base.criterion, __pyx_v_current_pos); - /* "sklearn/tree/_tree.pyx":1293 + /* "sklearn/tree/_tree.pyx":1373 * self.criterion.reset() * self.criterion.update(current_pos) * current_improvement = self.criterion.impurity_improvement(impurity) # <<<<<<<<<<<<<< @@ -10550,7 +11518,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_current_improvement = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->impurity_improvement(__pyx_v_self->__pyx_base.criterion, __pyx_v_impurity); - /* "sklearn/tree/_tree.pyx":1295 + /* "sklearn/tree/_tree.pyx":1375 * current_improvement = self.criterion.impurity_improvement(impurity) * * if current_improvement > best_improvement: # <<<<<<<<<<<<<< @@ -10560,7 +11528,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_10 = ((__pyx_v_current_improvement > __pyx_v_best_improvement) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1296 + /* "sklearn/tree/_tree.pyx":1376 * * if current_improvement > best_improvement: * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) # <<<<<<<<<<<<<< @@ -10569,7 +11537,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->children_impurity(__pyx_v_self->__pyx_base.criterion, (&__pyx_v_current_impurity_left), (&__pyx_v_current_impurity_right)); - /* "sklearn/tree/_tree.pyx":1297 + /* "sklearn/tree/_tree.pyx":1377 * if current_improvement > best_improvement: * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) * best_impurity_left = current_impurity_left # <<<<<<<<<<<<<< @@ -10578,7 +11546,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_impurity_left = __pyx_v_current_impurity_left; - /* "sklearn/tree/_tree.pyx":1298 + /* "sklearn/tree/_tree.pyx":1378 * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) * best_impurity_left = current_impurity_left * best_impurity_right = current_impurity_right # <<<<<<<<<<<<<< @@ -10587,7 +11555,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_impurity_right = __pyx_v_current_impurity_right; - /* "sklearn/tree/_tree.pyx":1299 + /* "sklearn/tree/_tree.pyx":1379 * best_impurity_left = current_impurity_left * best_impurity_right = current_impurity_right * best_improvement = current_improvement # <<<<<<<<<<<<<< @@ -10596,7 +11564,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_improvement = __pyx_v_current_improvement; - /* "sklearn/tree/_tree.pyx":1300 + /* "sklearn/tree/_tree.pyx":1380 * best_impurity_right = current_impurity_right * best_improvement = current_improvement * best_pos = current_pos # <<<<<<<<<<<<<< @@ -10605,7 +11573,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_pos = __pyx_v_current_pos; - /* "sklearn/tree/_tree.pyx":1301 + /* "sklearn/tree/_tree.pyx":1381 * best_improvement = current_improvement * best_pos = current_pos * best_feature = current_feature # <<<<<<<<<<<<<< @@ -10614,7 +11582,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_best_feature = __pyx_v_current_feature; - /* "sklearn/tree/_tree.pyx":1302 + /* "sklearn/tree/_tree.pyx":1382 * best_pos = current_pos * best_feature = current_feature * best_threshold = current_threshold # <<<<<<<<<<<<<< @@ -10626,7 +11594,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p } __pyx_L14:; - /* "sklearn/tree/_tree.pyx":1305 + /* "sklearn/tree/_tree.pyx":1385 * * # Count one more visited feature * visited_features += 1 # <<<<<<<<<<<<<< @@ -10635,7 +11603,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_visited_features = (__pyx_v_visited_features + 1); - /* "sklearn/tree/_tree.pyx":1307 + /* "sklearn/tree/_tree.pyx":1387 * visited_features += 1 * * if visited_features >= max_features: # <<<<<<<<<<<<<< @@ -10645,7 +11613,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p __pyx_t_10 = ((__pyx_v_visited_features >= __pyx_v_max_features) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1308 + /* "sklearn/tree/_tree.pyx":1388 * * if visited_features >= max_features: * break # <<<<<<<<<<<<<< @@ -10653,14 +11621,12 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p * # Reorganize into samples[start:best_pos] + samples[best_pos:end] */ goto __pyx_L4_break; - goto __pyx_L15; } - __pyx_L15:; __pyx_L3_continue:; } __pyx_L4_break:; - /* "sklearn/tree/_tree.pyx":1311 + /* "sklearn/tree/_tree.pyx":1391 * * # Reorganize into samples[start:best_pos] + samples[best_pos:end] * if best_pos < end and current_feature != best_feature: # <<<<<<<<<<<<<< @@ -10676,7 +11642,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p } if (__pyx_t_9) { - /* "sklearn/tree/_tree.pyx":1312 + /* "sklearn/tree/_tree.pyx":1392 * # Reorganize into samples[start:best_pos] + samples[best_pos:end] * if best_pos < end and current_feature != best_feature: * partition_start = start # <<<<<<<<<<<<<< @@ -10685,7 +11651,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_partition_start = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1313 + /* "sklearn/tree/_tree.pyx":1393 * if best_pos < end and current_feature != best_feature: * partition_start = start * partition_end = end # <<<<<<<<<<<<<< @@ -10694,7 +11660,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_partition_end = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":1314 + /* "sklearn/tree/_tree.pyx":1394 * partition_start = start * partition_end = end * p = start # <<<<<<<<<<<<<< @@ -10703,30 +11669,30 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_p = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1316 + /* "sklearn/tree/_tree.pyx":1396 * p = start * * while p < partition_end: # <<<<<<<<<<<<<< - * if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: - * p += 1 + * if X[X_sample_stride * samples[p] + * + X_fx_stride * best_feature] <= best_threshold: */ while (1) { __pyx_t_9 = ((__pyx_v_p < __pyx_v_partition_end) != 0); if (!__pyx_t_9) break; - /* "sklearn/tree/_tree.pyx":1317 - * + /* "sklearn/tree/_tree.pyx":1398 * while p < partition_end: - * if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: # <<<<<<<<<<<<<< + * if X[X_sample_stride * samples[p] + * + X_fx_stride * best_feature] <= best_threshold: # <<<<<<<<<<<<<< * p += 1 * */ __pyx_t_9 = (((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_best_feature))]) <= __pyx_v_best_threshold) != 0); if (__pyx_t_9) { - /* "sklearn/tree/_tree.pyx":1318 - * while p < partition_end: - * if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: + /* "sklearn/tree/_tree.pyx":1399 + * if X[X_sample_stride * samples[p] + * + X_fx_stride * best_feature] <= best_threshold: * p += 1 # <<<<<<<<<<<<<< * * else: @@ -10736,7 +11702,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p } /*else*/ { - /* "sklearn/tree/_tree.pyx":1321 + /* "sklearn/tree/_tree.pyx":1402 * * else: * partition_end -= 1 # <<<<<<<<<<<<<< @@ -10745,7 +11711,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_partition_end = (__pyx_v_partition_end - 1); - /* "sklearn/tree/_tree.pyx":1323 + /* "sklearn/tree/_tree.pyx":1404 * partition_end -= 1 * * tmp = samples[partition_end] # <<<<<<<<<<<<<< @@ -10754,7 +11720,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ __pyx_v_tmp = (__pyx_v_samples[__pyx_v_partition_end]); - /* "sklearn/tree/_tree.pyx":1324 + /* "sklearn/tree/_tree.pyx":1405 * * tmp = samples[partition_end] * samples[partition_end] = samples[p] # <<<<<<<<<<<<<< @@ -10763,7 +11729,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_samples[__pyx_v_partition_end]) = (__pyx_v_samples[__pyx_v_p]); - /* "sklearn/tree/_tree.pyx":1325 + /* "sklearn/tree/_tree.pyx":1406 * tmp = samples[partition_end] * samples[partition_end] = samples[p] * samples[p] = tmp # <<<<<<<<<<<<<< @@ -10778,7 +11744,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p } __pyx_L16:; - /* "sklearn/tree/_tree.pyx":1328 + /* "sklearn/tree/_tree.pyx":1409 * * # Return values * pos[0] = best_pos # <<<<<<<<<<<<<< @@ -10787,7 +11753,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_pos[0]) = __pyx_v_best_pos; - /* "sklearn/tree/_tree.pyx":1329 + /* "sklearn/tree/_tree.pyx":1410 * # Return values * pos[0] = best_pos * feature[0] = best_feature # <<<<<<<<<<<<<< @@ -10796,7 +11762,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_feature[0]) = __pyx_v_best_feature; - /* "sklearn/tree/_tree.pyx":1330 + /* "sklearn/tree/_tree.pyx":1411 * pos[0] = best_pos * feature[0] = best_feature * threshold[0] = best_threshold # <<<<<<<<<<<<<< @@ -10805,7 +11771,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_threshold[0]) = __pyx_v_best_threshold; - /* "sklearn/tree/_tree.pyx":1331 + /* "sklearn/tree/_tree.pyx":1412 * feature[0] = best_feature * threshold[0] = best_threshold * impurity_left[0] = best_impurity_left # <<<<<<<<<<<<<< @@ -10814,7 +11780,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_impurity_left[0]) = __pyx_v_best_impurity_left; - /* "sklearn/tree/_tree.pyx":1332 + /* "sklearn/tree/_tree.pyx":1413 * threshold[0] = best_threshold * impurity_left[0] = best_impurity_left * impurity_right[0] = best_impurity_right # <<<<<<<<<<<<<< @@ -10823,7 +11789,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_impurity_right[0]) = __pyx_v_best_impurity_right; - /* "sklearn/tree/_tree.pyx":1333 + /* "sklearn/tree/_tree.pyx":1414 * impurity_left[0] = best_impurity_left * impurity_right[0] = best_impurity_right * impurity_improvement[0] = best_improvement # <<<<<<<<<<<<<< @@ -10832,8 +11798,25 @@ static void __pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split(struct __p */ (__pyx_v_impurity_improvement[0]) = __pyx_v_best_improvement; + /* "sklearn/tree/_tree.pyx":1266 + * self.random_state), self.__getstate__()) + * + * cdef void node_split(self, double impurity, SIZE_t* pos, SIZE_t* feature, # <<<<<<<<<<<<<< + * double* threshold, double* impurity_left, + * double* impurity_right, + */ + + /* function exit code */ } +/* "sklearn/tree/_tree.pyx":1427 + * cdef unsigned char* sample_mask + * + * def __cinit__(self, Criterion criterion, # <<<<<<<<<<<<<< + * SIZE_t max_features, + * SIZE_t min_samples_leaf, + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -10848,7 +11831,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_1__cinit__(PyObj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__criterion,&__pyx_n_s__max_features,&__pyx_n_s__min_samples_leaf,&__pyx_n_s__random_state,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_criterion,&__pyx_n_s_max_features,&__pyx_n_s_min_samples_leaf,&__pyx_n_s_random_state,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -10864,26 +11847,26 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_1__cinit__(PyObj kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__criterion)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_criterion)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_features)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_samples_leaf)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_samples_leaf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__random_state)) != 0)) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -10894,20 +11877,22 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_1__cinit__(PyObj values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)values[0]); - __pyx_v_max_features = __Pyx_PyInt_from_py_Py_intptr_t(values[1]); if (unlikely((__pyx_v_max_features == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_min_samples_leaf = __Pyx_PyInt_from_py_Py_intptr_t(values[2]); if (unlikely((__pyx_v_min_samples_leaf == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_features = __Pyx_PyInt_As_Py_intptr_t(values[1]); if (unlikely((__pyx_v_max_features == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_min_samples_leaf = __Pyx_PyInt_As_Py_intptr_t(values[2]); if (unlikely((__pyx_v_min_samples_leaf == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1429; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_random_state = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree.PresortBestSplitter.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_criterion), __pyx_ptype_7sklearn_4tree_5_tree_Criterion, 1, "criterion", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_criterion), __pyx_ptype_7sklearn_4tree_5_tree_Criterion, 1, "criterion", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter___cinit__(((struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *)__pyx_v_self), __pyx_v_criterion, __pyx_v_max_features, __pyx_v_min_samples_leaf, __pyx_v_random_state); + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -10916,20 +11901,12 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_1__cinit__(PyObj return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1346 - * cdef unsigned char* sample_mask - * - * def __cinit__(self, Criterion criterion, # <<<<<<<<<<<<<< - * SIZE_t max_features, - * SIZE_t min_samples_leaf, - */ - static int __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter___cinit__(struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *__pyx_v_criterion, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_max_features, CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_min_samples_leaf, CYTHON_UNUSED PyObject *__pyx_v_random_state) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); - /* "sklearn/tree/_tree.pyx":1351 + /* "sklearn/tree/_tree.pyx":1432 * object random_state): * # Initialize pointers * self.X_old = NULL # <<<<<<<<<<<<<< @@ -10938,7 +11915,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter___cinit__(struct */ __pyx_v_self->X_old = NULL; - /* "sklearn/tree/_tree.pyx":1352 + /* "sklearn/tree/_tree.pyx":1433 * # Initialize pointers * self.X_old = NULL * self.X_argsorted_ptr = NULL # <<<<<<<<<<<<<< @@ -10947,7 +11924,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter___cinit__(struct */ __pyx_v_self->X_argsorted_ptr = NULL; - /* "sklearn/tree/_tree.pyx":1353 + /* "sklearn/tree/_tree.pyx":1434 * self.X_old = NULL * self.X_argsorted_ptr = NULL * self.X_argsorted_stride = 0 # <<<<<<<<<<<<<< @@ -10956,7 +11933,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter___cinit__(struct */ __pyx_v_self->X_argsorted_stride = 0; - /* "sklearn/tree/_tree.pyx":1354 + /* "sklearn/tree/_tree.pyx":1435 * self.X_argsorted_ptr = NULL * self.X_argsorted_stride = 0 * self.sample_mask = NULL # <<<<<<<<<<<<<< @@ -10965,33 +11942,44 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter___cinit__(struct */ __pyx_v_self->sample_mask = NULL; + /* "sklearn/tree/_tree.pyx":1427 + * cdef unsigned char* sample_mask + * + * def __cinit__(self, Criterion criterion, # <<<<<<<<<<<<<< + * SIZE_t max_features, + * SIZE_t min_samples_leaf, + */ + + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/tree/_tree.pyx":1437 + * self.sample_mask = NULL + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * free(self.sample_mask) + */ + /* Python wrapper */ static void __pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter_2__dealloc__(((struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1356 - * self.sample_mask = NULL - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * """Destructor.""" - * free(self.sample_mask) - */ - static void __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter_2__dealloc__(struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "sklearn/tree/_tree.pyx":1358 + /* "sklearn/tree/_tree.pyx":1439 * def __dealloc__(self): * """Destructor.""" * free(self.sample_mask) # <<<<<<<<<<<<<< @@ -11000,9 +11988,26 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter_2__dealloc__(st */ free(__pyx_v_self->sample_mask); + /* "sklearn/tree/_tree.pyx":1437 + * self.sample_mask = NULL + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * free(self.sample_mask) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } +/* "sklearn/tree/_tree.pyx":1441 + * free(self.sample_mask) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (PresortBestSplitter, (self.criterion, + * self.max_features, + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { @@ -11010,18 +12015,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_5__reduce_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter_4__reduce__(((struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1360 - * free(self.sample_mask) - * - * def __reduce__(self): # <<<<<<<<<<<<<< - * return (PresortBestSplitter, (self.criterion, - * self.max_features, - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter_4__reduce__(struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -11033,7 +12032,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter_4__reduce_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/tree/_tree.pyx":1361 + /* "sklearn/tree/_tree.pyx":1442 * * def __reduce__(self): * return (PresortBestSplitter, (self.criterion, # <<<<<<<<<<<<<< @@ -11042,34 +12041,34 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter_4__reduce_ */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/tree/_tree.pyx":1362 + /* "sklearn/tree/_tree.pyx":1443 * def __reduce__(self): * return (PresortBestSplitter, (self.criterion, * self.max_features, # <<<<<<<<<<<<<< * self.min_samples_leaf, * self.random_state), self.__getstate__()) */ - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->__pyx_base.max_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->__pyx_base.max_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/tree/_tree.pyx":1363 + /* "sklearn/tree/_tree.pyx":1444 * return (PresortBestSplitter, (self.criterion, * self.max_features, * self.min_samples_leaf, # <<<<<<<<<<<<<< * self.random_state), self.__getstate__()) * */ - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->__pyx_base.min_samples_leaf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->__pyx_base.min_samples_leaf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/tree/_tree.pyx":1364 + /* "sklearn/tree/_tree.pyx":1442 + * + * def __reduce__(self): + * return (PresortBestSplitter, (self.criterion, # <<<<<<<<<<<<<< * self.max_features, * self.min_samples_leaf, - * self.random_state), self.__getstate__()) # <<<<<<<<<<<<<< - * - * cdef void init(self, np.ndarray[DTYPE_t, ndim=2] X, */ - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.criterion)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->__pyx_base.criterion)); @@ -11083,28 +12082,51 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter_4__reduce_ __Pyx_GIVEREF(__pyx_v_self->__pyx_base.random_state); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":1445 + * self.max_features, + * self.min_samples_leaf, + * self.random_state), self.__getstate__()) # <<<<<<<<<<<<<< + * + * cdef void init(self, np.ndarray[DTYPE_t, ndim=2] X, + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":1442 + * + * def __reduce__(self): + * return (PresortBestSplitter, (self.criterion, # <<<<<<<<<<<<<< + * self.max_features, + * self.min_samples_leaf, + */ + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_PresortBestSplitter))); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_PresortBestSplitter))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_PresortBestSplitter))); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":1441 + * free(self.sample_mask) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (PresortBestSplitter, (self.criterion, + * self.max_features, + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -11117,7 +12139,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19PresortBestSplitter_4__reduce_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1366 +/* "sklearn/tree/_tree.pyx":1447 * self.random_state), self.__getstate__()) * * cdef void init(self, np.ndarray[DTYPE_t, ndim=2] X, # <<<<<<<<<<<<<< @@ -11154,16 +12176,16 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DOUBLE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DOUBLE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_y.diminfo[1].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_y.diminfo[1].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[1]; - /* "sklearn/tree/_tree.pyx":1369 + /* "sklearn/tree/_tree.pyx":1450 * np.ndarray[DOUBLE_t, ndim=2, mode="c"] y, * DOUBLE_t* sample_weight): * cdef void* sample_mask = NULL # <<<<<<<<<<<<<< @@ -11172,7 +12194,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py */ __pyx_v_sample_mask = NULL; - /* "sklearn/tree/_tree.pyx":1372 + /* "sklearn/tree/_tree.pyx":1453 * * # Call parent initializer * Splitter.init(self, X, y, sample_weight) # <<<<<<<<<<<<<< @@ -11181,7 +12203,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py */ __pyx_vtabptr_7sklearn_4tree_5_tree_Splitter->init(((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_y), __pyx_v_sample_weight); - /* "sklearn/tree/_tree.pyx":1375 + /* "sklearn/tree/_tree.pyx":1456 * * # Pre-sort X * if self.X_old != self.X: # <<<<<<<<<<<<<< @@ -11191,7 +12213,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py __pyx_t_1 = ((__pyx_v_self->X_old != __pyx_v_self->__pyx_base.X) != 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1376 + /* "sklearn/tree/_tree.pyx":1457 * # Pre-sort X * if self.X_old != self.X: * self.X_old = self.X # <<<<<<<<<<<<<< @@ -11201,58 +12223,58 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py __pyx_t_2 = __pyx_v_self->__pyx_base.X; __pyx_v_self->X_old = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1378 + /* "sklearn/tree/_tree.pyx":1459 * self.X_old = self.X * self.X_argsorted = \ * np.asfortranarray(np.argsort(X, axis=0), dtype=np.int32) # <<<<<<<<<<<<<< * * self.X_argsorted_ptr = self.X_argsorted.data */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__asfortranarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_asfortranarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__argsort); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_argsort); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_axis, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/tree/_tree.pyx":1377 + /* "sklearn/tree/_tree.pyx":1458 * if self.X_old != self.X: * self.X_old = self.X * self.X_argsorted = \ # <<<<<<<<<<<<<< @@ -11265,7 +12287,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py __pyx_v_self->X_argsorted = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/tree/_tree.pyx":1380 + /* "sklearn/tree/_tree.pyx":1461 * np.asfortranarray(np.argsort(X, axis=0), dtype=np.int32) * * self.X_argsorted_ptr = self.X_argsorted.data # <<<<<<<<<<<<<< @@ -11274,19 +12296,19 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py */ __pyx_v_self->X_argsorted_ptr = ((__pyx_t_7sklearn_4tree_5_tree_INT32_t *)__pyx_v_self->X_argsorted->data); - /* "sklearn/tree/_tree.pyx":1382 + /* "sklearn/tree/_tree.pyx":1463 * self.X_argsorted_ptr = self.X_argsorted.data * self.X_argsorted_stride = ( self.X_argsorted.strides[1] / * self.X_argsorted.itemsize) # <<<<<<<<<<<<<< * * self.n_total_samples = X.shape[0] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->X_argsorted), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->X_argsorted), __pyx_n_s_itemsize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_t_5); if (unlikely((__pyx_t_8 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_5); if (unlikely((__pyx_t_8 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/tree/_tree.pyx":1381 + /* "sklearn/tree/_tree.pyx":1462 * * self.X_argsorted_ptr = self.X_argsorted.data * self.X_argsorted_stride = ( self.X_argsorted.strides[1] / # <<<<<<<<<<<<<< @@ -11295,7 +12317,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py */ __pyx_v_self->X_argsorted_stride = (((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)(__pyx_v_self->X_argsorted->strides[1])) / ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)__pyx_t_8)); - /* "sklearn/tree/_tree.pyx":1384 + /* "sklearn/tree/_tree.pyx":1465 * self.X_argsorted.itemsize) * * self.n_total_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -11304,7 +12326,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py */ __pyx_v_self->n_total_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/tree/_tree.pyx":1385 + /* "sklearn/tree/_tree.pyx":1466 * * self.n_total_samples = X.shape[0] * sample_mask = realloc(self.sample_mask, self.n_total_samples) # <<<<<<<<<<<<<< @@ -11313,7 +12335,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py */ __pyx_v_sample_mask = realloc(__pyx_v_self->sample_mask, __pyx_v_self->n_total_samples); - /* "sklearn/tree/_tree.pyx":1386 + /* "sklearn/tree/_tree.pyx":1467 * self.n_total_samples = X.shape[0] * sample_mask = realloc(self.sample_mask, self.n_total_samples) * if sample_mask == NULL: # <<<<<<<<<<<<<< @@ -11323,34 +12345,40 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py __pyx_t_1 = ((__pyx_v_sample_mask == NULL) != 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1388 + /* "sklearn/tree/_tree.pyx":1469 * if sample_mask == NULL: * raise MemoryError("failed to allocate %d bytes" * % self.n_total_samples) # <<<<<<<<<<<<<< * memset(sample_mask, 0, self.n_total_samples) * self.sample_mask = sample_mask */ - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->n_total_samples); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->n_total_samples); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_d_bytes, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":1468 + * sample_mask = realloc(self.sample_mask, self.n_total_samples) + * if sample_mask == NULL: + * raise MemoryError("failed to allocate %d bytes" # <<<<<<<<<<<<<< + * % self.n_total_samples) + * memset(sample_mask, 0, self.n_total_samples) + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L4:; - /* "sklearn/tree/_tree.pyx":1389 + /* "sklearn/tree/_tree.pyx":1470 * raise MemoryError("failed to allocate %d bytes" * % self.n_total_samples) * memset(sample_mask, 0, self.n_total_samples) # <<<<<<<<<<<<<< @@ -11359,7 +12387,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py */ memset(__pyx_v_sample_mask, 0, __pyx_v_self->n_total_samples); - /* "sklearn/tree/_tree.pyx":1390 + /* "sklearn/tree/_tree.pyx":1471 * % self.n_total_samples) * memset(sample_mask, 0, self.n_total_samples) * self.sample_mask = sample_mask # <<<<<<<<<<<<<< @@ -11371,6 +12399,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py } __pyx_L3:; + /* "sklearn/tree/_tree.pyx":1447 + * self.random_state), self.__getstate__()) + * + * cdef void init(self, np.ndarray[DTYPE_t, ndim=2] X, # <<<<<<<<<<<<<< + * np.ndarray[DOUBLE_t, ndim=2, mode="c"] y, + * DOUBLE_t* sample_weight): + */ + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); @@ -11383,7 +12420,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("sklearn.tree._tree.PresortBestSplitter.init", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.tree._tree.PresortBestSplitter.init", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); @@ -11392,7 +12429,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init(struct __py __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1392 +/* "sklearn/tree/_tree.pyx":1473 * self.sample_mask = sample_mask * * cdef void node_split(self, double impurity, SIZE_t* pos, # <<<<<<<<<<<<<< @@ -11407,7 +12444,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_7sklearn_4tree_5_tree_SIZE_t *__pyx_v_features; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n_features; __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_X; - __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_X_fx; + __pyx_t_7sklearn_4tree_5_tree_DTYPE_t *__pyx_v_Xf; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_X_sample_stride; __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_X_fx_stride; __pyx_t_7sklearn_4tree_5_tree_INT32_t *__pyx_v_X_argsorted; @@ -11451,7 +12488,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc int __pyx_t_10; int __pyx_t_11; - /* "sklearn/tree/_tree.pyx":1398 + /* "sklearn/tree/_tree.pyx":1479 * """Find the best split on node samples[start:end].""" * # Find the best split * cdef SIZE_t* samples = self.samples # <<<<<<<<<<<<<< @@ -11461,7 +12498,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_1 = __pyx_v_self->__pyx_base.samples; __pyx_v_samples = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1399 + /* "sklearn/tree/_tree.pyx":1480 * # Find the best split * cdef SIZE_t* samples = self.samples * cdef SIZE_t start = self.start # <<<<<<<<<<<<<< @@ -11471,7 +12508,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_2 = __pyx_v_self->__pyx_base.start; __pyx_v_start = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1400 + /* "sklearn/tree/_tree.pyx":1481 * cdef SIZE_t* samples = self.samples * cdef SIZE_t start = self.start * cdef SIZE_t end = self.end # <<<<<<<<<<<<<< @@ -11481,7 +12518,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_2 = __pyx_v_self->__pyx_base.end; __pyx_v_end = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1402 + /* "sklearn/tree/_tree.pyx":1483 * cdef SIZE_t end = self.end * * cdef SIZE_t* features = self.features # <<<<<<<<<<<<<< @@ -11491,7 +12528,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_1 = __pyx_v_self->__pyx_base.features; __pyx_v_features = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1403 + /* "sklearn/tree/_tree.pyx":1484 * * cdef SIZE_t* features = self.features * cdef SIZE_t n_features = self.n_features # <<<<<<<<<<<<<< @@ -11501,19 +12538,29 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_2 = __pyx_v_self->__pyx_base.n_features; __pyx_v_n_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1405 + /* "sklearn/tree/_tree.pyx":1486 * cdef SIZE_t n_features = self.n_features * * cdef DTYPE_t* X = self.X # <<<<<<<<<<<<<< - * cdef DTYPE_t* X_fx + * cdef DTYPE_t* Xf = self.feature_values * cdef SIZE_t X_sample_stride = self.X_sample_stride */ __pyx_t_3 = __pyx_v_self->__pyx_base.X; __pyx_v_X = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1407 + /* "sklearn/tree/_tree.pyx":1487 + * + * cdef DTYPE_t* X = self.X + * cdef DTYPE_t* Xf = self.feature_values # <<<<<<<<<<<<<< + * cdef SIZE_t X_sample_stride = self.X_sample_stride + * cdef SIZE_t X_fx_stride = self.X_fx_stride + */ + __pyx_t_3 = __pyx_v_self->__pyx_base.feature_values; + __pyx_v_Xf = __pyx_t_3; + + /* "sklearn/tree/_tree.pyx":1488 * cdef DTYPE_t* X = self.X - * cdef DTYPE_t* X_fx + * cdef DTYPE_t* Xf = self.feature_values * cdef SIZE_t X_sample_stride = self.X_sample_stride # <<<<<<<<<<<<<< * cdef SIZE_t X_fx_stride = self.X_fx_stride * cdef INT32_t* X_argsorted = self.X_argsorted_ptr @@ -11521,8 +12568,8 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_2 = __pyx_v_self->__pyx_base.X_sample_stride; __pyx_v_X_sample_stride = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1408 - * cdef DTYPE_t* X_fx + /* "sklearn/tree/_tree.pyx":1489 + * cdef DTYPE_t* Xf = self.feature_values * cdef SIZE_t X_sample_stride = self.X_sample_stride * cdef SIZE_t X_fx_stride = self.X_fx_stride # <<<<<<<<<<<<<< * cdef INT32_t* X_argsorted = self.X_argsorted_ptr @@ -11531,7 +12578,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_2 = __pyx_v_self->__pyx_base.X_fx_stride; __pyx_v_X_fx_stride = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1409 + /* "sklearn/tree/_tree.pyx":1490 * cdef SIZE_t X_sample_stride = self.X_sample_stride * cdef SIZE_t X_fx_stride = self.X_fx_stride * cdef INT32_t* X_argsorted = self.X_argsorted_ptr # <<<<<<<<<<<<<< @@ -11541,7 +12588,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_4 = __pyx_v_self->X_argsorted_ptr; __pyx_v_X_argsorted = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1410 + /* "sklearn/tree/_tree.pyx":1491 * cdef SIZE_t X_fx_stride = self.X_fx_stride * cdef INT32_t* X_argsorted = self.X_argsorted_ptr * cdef SIZE_t X_argsorted_stride = self.X_argsorted_stride # <<<<<<<<<<<<<< @@ -11551,7 +12598,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_2 = __pyx_v_self->X_argsorted_stride; __pyx_v_X_argsorted_stride = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1411 + /* "sklearn/tree/_tree.pyx":1492 * cdef INT32_t* X_argsorted = self.X_argsorted_ptr * cdef SIZE_t X_argsorted_stride = self.X_argsorted_stride * cdef SIZE_t n_total_samples = self.n_total_samples # <<<<<<<<<<<<<< @@ -11561,7 +12608,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_2 = __pyx_v_self->n_total_samples; __pyx_v_n_total_samples = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1412 + /* "sklearn/tree/_tree.pyx":1493 * cdef SIZE_t X_argsorted_stride = self.X_argsorted_stride * cdef SIZE_t n_total_samples = self.n_total_samples * cdef unsigned char* sample_mask = self.sample_mask # <<<<<<<<<<<<<< @@ -11571,7 +12618,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_5 = __pyx_v_self->sample_mask; __pyx_v_sample_mask = __pyx_t_5; - /* "sklearn/tree/_tree.pyx":1414 + /* "sklearn/tree/_tree.pyx":1495 * cdef unsigned char* sample_mask = self.sample_mask * * cdef SIZE_t max_features = self.max_features # <<<<<<<<<<<<<< @@ -11581,7 +12628,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_2 = __pyx_v_self->__pyx_base.max_features; __pyx_v_max_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1415 + /* "sklearn/tree/_tree.pyx":1496 * * cdef SIZE_t max_features = self.max_features * cdef SIZE_t min_samples_leaf = self.min_samples_leaf # <<<<<<<<<<<<<< @@ -11591,7 +12638,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_2 = __pyx_v_self->__pyx_base.min_samples_leaf; __pyx_v_min_samples_leaf = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1416 + /* "sklearn/tree/_tree.pyx":1497 * cdef SIZE_t max_features = self.max_features * cdef SIZE_t min_samples_leaf = self.min_samples_leaf * cdef UINT32_t* random_state = &self.rand_r_state # <<<<<<<<<<<<<< @@ -11600,7 +12647,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_random_state = (&__pyx_v_self->__pyx_base.rand_r_state); - /* "sklearn/tree/_tree.pyx":1418 + /* "sklearn/tree/_tree.pyx":1499 * cdef UINT32_t* random_state = &self.rand_r_state * * cdef double best_impurity_left = INFINITY # <<<<<<<<<<<<<< @@ -11609,7 +12656,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_impurity_left = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1419 + /* "sklearn/tree/_tree.pyx":1500 * * cdef double best_impurity_left = INFINITY * cdef double best_impurity_right = INFINITY # <<<<<<<<<<<<<< @@ -11618,7 +12665,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_impurity_right = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1420 + /* "sklearn/tree/_tree.pyx":1501 * cdef double best_impurity_left = INFINITY * cdef double best_impurity_right = INFINITY * cdef SIZE_t best_pos = end # <<<<<<<<<<<<<< @@ -11627,7 +12674,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_pos = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":1421 + /* "sklearn/tree/_tree.pyx":1502 * cdef double best_impurity_right = INFINITY * cdef SIZE_t best_pos = end * cdef SIZE_t best_feature = 0 # <<<<<<<<<<<<<< @@ -11636,7 +12683,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_feature = 0; - /* "sklearn/tree/_tree.pyx":1422 + /* "sklearn/tree/_tree.pyx":1503 * cdef SIZE_t best_pos = end * cdef SIZE_t best_feature = 0 * cdef double best_threshold = 0. # <<<<<<<<<<<<<< @@ -11645,7 +12692,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_threshold = 0.; - /* "sklearn/tree/_tree.pyx":1423 + /* "sklearn/tree/_tree.pyx":1504 * cdef SIZE_t best_feature = 0 * cdef double best_threshold = 0. * cdef double best_improvement = -INFINITY # <<<<<<<<<<<<<< @@ -11654,7 +12701,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_improvement = (-__pyx_v_7sklearn_4tree_5_tree_INFINITY); - /* "sklearn/tree/_tree.pyx":1434 + /* "sklearn/tree/_tree.pyx":1515 * * cdef SIZE_t f_idx, f_i, f_j, p, tmp * cdef SIZE_t visited_features = 0 # <<<<<<<<<<<<<< @@ -11663,7 +12710,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_visited_features = 0; - /* "sklearn/tree/_tree.pyx":1442 + /* "sklearn/tree/_tree.pyx":1523 * * # Set sample mask * for p in range(start, end): # <<<<<<<<<<<<<< @@ -11674,7 +12721,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) { __pyx_v_p = __pyx_t_6; - /* "sklearn/tree/_tree.pyx":1443 + /* "sklearn/tree/_tree.pyx":1524 * # Set sample mask * for p in range(start, end): * sample_mask[samples[p]] = 1 # <<<<<<<<<<<<<< @@ -11684,7 +12731,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc (__pyx_v_sample_mask[(__pyx_v_samples[__pyx_v_p])]) = 1; } - /* "sklearn/tree/_tree.pyx":1446 + /* "sklearn/tree/_tree.pyx":1527 * * # Look for splits * for f_idx in range(n_features): # <<<<<<<<<<<<<< @@ -11695,7 +12742,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) { __pyx_v_f_idx = __pyx_t_6; - /* "sklearn/tree/_tree.pyx":1448 + /* "sklearn/tree/_tree.pyx":1529 * for f_idx in range(n_features): * # Draw a feature at random * f_i = n_features - f_idx - 1 # <<<<<<<<<<<<<< @@ -11704,7 +12751,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_f_i = ((__pyx_v_n_features - __pyx_v_f_idx) - 1); - /* "sklearn/tree/_tree.pyx":1449 + /* "sklearn/tree/_tree.pyx":1530 * # Draw a feature at random * f_i = n_features - f_idx - 1 * f_j = rand_int(n_features - f_idx, random_state) # <<<<<<<<<<<<<< @@ -11713,7 +12760,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_f_j = __pyx_f_7sklearn_4tree_5_tree_rand_int((__pyx_v_n_features - __pyx_v_f_idx), __pyx_v_random_state); - /* "sklearn/tree/_tree.pyx":1451 + /* "sklearn/tree/_tree.pyx":1532 * f_j = rand_int(n_features - f_idx, random_state) * * tmp = features[f_i] # <<<<<<<<<<<<<< @@ -11722,7 +12769,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_tmp = (__pyx_v_features[__pyx_v_f_i]); - /* "sklearn/tree/_tree.pyx":1452 + /* "sklearn/tree/_tree.pyx":1533 * * tmp = features[f_i] * features[f_i] = features[f_j] # <<<<<<<<<<<<<< @@ -11731,7 +12778,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ (__pyx_v_features[__pyx_v_f_i]) = (__pyx_v_features[__pyx_v_f_j]); - /* "sklearn/tree/_tree.pyx":1453 + /* "sklearn/tree/_tree.pyx":1534 * tmp = features[f_i] * features[f_i] = features[f_j] * features[f_j] = tmp # <<<<<<<<<<<<<< @@ -11740,25 +12787,16 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ (__pyx_v_features[__pyx_v_f_j]) = __pyx_v_tmp; - /* "sklearn/tree/_tree.pyx":1455 + /* "sklearn/tree/_tree.pyx":1536 * features[f_j] = tmp * * current_feature = features[f_i] # <<<<<<<<<<<<<< * - * X_fx = X + (X_fx_stride * current_feature) - */ - __pyx_v_current_feature = (__pyx_v_features[__pyx_v_f_i]); - - /* "sklearn/tree/_tree.pyx":1457 - * current_feature = features[f_i] - * - * X_fx = X + (X_fx_stride * current_feature) # <<<<<<<<<<<<<< - * * # Extract ordering from X_argsorted */ - __pyx_v_X_fx = (__pyx_v_X + (__pyx_v_X_fx_stride * __pyx_v_current_feature)); + __pyx_v_current_feature = (__pyx_v_features[__pyx_v_f_i]); - /* "sklearn/tree/_tree.pyx":1460 + /* "sklearn/tree/_tree.pyx":1539 * * # Extract ordering from X_argsorted * p = start # <<<<<<<<<<<<<< @@ -11767,7 +12805,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_p = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1462 + /* "sklearn/tree/_tree.pyx":1541 * p = start * * for i in range(n_total_samples): # <<<<<<<<<<<<<< @@ -11778,7 +12816,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "sklearn/tree/_tree.pyx":1463 + /* "sklearn/tree/_tree.pyx":1542 * * for i in range(n_total_samples): * j = X_argsorted[X_argsorted_stride * current_feature + i] # <<<<<<<<<<<<<< @@ -11787,28 +12825,37 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_j = (__pyx_v_X_argsorted[((__pyx_v_X_argsorted_stride * __pyx_v_current_feature) + __pyx_v_i)]); - /* "sklearn/tree/_tree.pyx":1464 + /* "sklearn/tree/_tree.pyx":1543 * for i in range(n_total_samples): * j = X_argsorted[X_argsorted_stride * current_feature + i] * if sample_mask[j] == 1: # <<<<<<<<<<<<<< * samples[p] = j - * p += 1 + * Xf[p] = X[X_sample_stride * j */ __pyx_t_9 = (((__pyx_v_sample_mask[__pyx_v_j]) == 1) != 0); if (__pyx_t_9) { - /* "sklearn/tree/_tree.pyx":1465 + /* "sklearn/tree/_tree.pyx":1544 * j = X_argsorted[X_argsorted_stride * current_feature + i] * if sample_mask[j] == 1: * samples[p] = j # <<<<<<<<<<<<<< - * p += 1 - * + * Xf[p] = X[X_sample_stride * j + * + X_fx_stride * current_feature] */ (__pyx_v_samples[__pyx_v_p]) = __pyx_v_j; - /* "sklearn/tree/_tree.pyx":1466 + /* "sklearn/tree/_tree.pyx":1545 * if sample_mask[j] == 1: * samples[p] = j + * Xf[p] = X[X_sample_stride * j # <<<<<<<<<<<<<< + * + X_fx_stride * current_feature] + * p += 1 + */ + (__pyx_v_Xf[__pyx_v_p]) = (__pyx_v_X[((__pyx_v_X_sample_stride * __pyx_v_j) + (__pyx_v_X_fx_stride * __pyx_v_current_feature))]); + + /* "sklearn/tree/_tree.pyx":1547 + * Xf[p] = X[X_sample_stride * j + * + X_fx_stride * current_feature] * p += 1 # <<<<<<<<<<<<<< * * # Evaluate all splits @@ -11819,7 +12866,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_L9:; } - /* "sklearn/tree/_tree.pyx":1469 + /* "sklearn/tree/_tree.pyx":1550 * * # Evaluate all splits * self.criterion.reset() # <<<<<<<<<<<<<< @@ -11828,7 +12875,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->reset(__pyx_v_self->__pyx_base.criterion); - /* "sklearn/tree/_tree.pyx":1470 + /* "sklearn/tree/_tree.pyx":1551 * # Evaluate all splits * self.criterion.reset() * p = start # <<<<<<<<<<<<<< @@ -11837,45 +12884,37 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_p = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1472 + /* "sklearn/tree/_tree.pyx":1553 * p = start * * while p < end: # <<<<<<<<<<<<<< - * while ((p + 1 < end) and - * (X_fx[X_sample_stride * samples[p + 1]] <= + * while p + 1 < end and Xf[p + 1] <= Xf[p] + EPSILON_FLT: + * p += 1 */ while (1) { __pyx_t_9 = ((__pyx_v_p < __pyx_v_end) != 0); if (!__pyx_t_9) break; - /* "sklearn/tree/_tree.pyx":1473 + /* "sklearn/tree/_tree.pyx":1554 * * while p < end: - * while ((p + 1 < end) and # <<<<<<<<<<<<<< - * (X_fx[X_sample_stride * samples[p + 1]] <= - * X_fx[X_sample_stride * samples[p]] + EPSILON_FLT)): + * while p + 1 < end and Xf[p + 1] <= Xf[p] + EPSILON_FLT: # <<<<<<<<<<<<<< + * p += 1 + * */ while (1) { __pyx_t_9 = (((__pyx_v_p + 1) < __pyx_v_end) != 0); if (__pyx_t_9) { - - /* "sklearn/tree/_tree.pyx":1475 - * while ((p + 1 < end) and - * (X_fx[X_sample_stride * samples[p + 1]] <= - * X_fx[X_sample_stride * samples[p]] + EPSILON_FLT)): # <<<<<<<<<<<<<< - * p += 1 - * - */ - __pyx_t_10 = (((__pyx_v_X_fx[(__pyx_v_X_sample_stride * (__pyx_v_samples[(__pyx_v_p + 1)]))]) <= ((__pyx_v_X_fx[(__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p]))]) + __pyx_v_7sklearn_4tree_5_tree_EPSILON_FLT)) != 0); + __pyx_t_10 = (((__pyx_v_Xf[(__pyx_v_p + 1)]) <= ((__pyx_v_Xf[__pyx_v_p]) + __pyx_v_7sklearn_4tree_5_tree_EPSILON_FLT)) != 0); __pyx_t_11 = __pyx_t_10; } else { __pyx_t_11 = __pyx_t_9; } if (!__pyx_t_11) break; - /* "sklearn/tree/_tree.pyx":1476 - * (X_fx[X_sample_stride * samples[p + 1]] <= - * X_fx[X_sample_stride * samples[p]] + EPSILON_FLT)): + /* "sklearn/tree/_tree.pyx":1555 + * while p < end: + * while p + 1 < end and Xf[p + 1] <= Xf[p] + EPSILON_FLT: * p += 1 # <<<<<<<<<<<<<< * * # (p + 1 >= end) or (X[samples[p + 1], current_feature] > @@ -11883,7 +12922,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_v_p = (__pyx_v_p + 1); } - /* "sklearn/tree/_tree.pyx":1480 + /* "sklearn/tree/_tree.pyx":1559 * # (p + 1 >= end) or (X[samples[p + 1], current_feature] > * # X[samples[p], current_feature]) * p += 1 # <<<<<<<<<<<<<< @@ -11892,7 +12931,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_p = (__pyx_v_p + 1); - /* "sklearn/tree/_tree.pyx":1484 + /* "sklearn/tree/_tree.pyx":1563 * # X[samples[p - 1], current_feature]) * * if p < end: # <<<<<<<<<<<<<< @@ -11902,7 +12941,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_11 = ((__pyx_v_p < __pyx_v_end) != 0); if (__pyx_t_11) { - /* "sklearn/tree/_tree.pyx":1485 + /* "sklearn/tree/_tree.pyx":1564 * * if p < end: * current_pos = p # <<<<<<<<<<<<<< @@ -11911,21 +12950,21 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_current_pos = __pyx_v_p; - /* "sklearn/tree/_tree.pyx":1488 + /* "sklearn/tree/_tree.pyx":1567 * * # Reject if min_samples_leaf is not guaranteed * if (((current_pos - start) < min_samples_leaf) or # <<<<<<<<<<<<<< * ((end - current_pos) < min_samples_leaf)): - * continue + * continue */ __pyx_t_11 = (((__pyx_v_current_pos - __pyx_v_start) < __pyx_v_min_samples_leaf) != 0); if (!__pyx_t_11) { - /* "sklearn/tree/_tree.pyx":1489 + /* "sklearn/tree/_tree.pyx":1568 * # Reject if min_samples_leaf is not guaranteed * if (((current_pos - start) < min_samples_leaf) or * ((end - current_pos) < min_samples_leaf)): # <<<<<<<<<<<<<< - * continue + * continue * */ __pyx_t_9 = (((__pyx_v_end - __pyx_v_current_pos) < __pyx_v_min_samples_leaf) != 0); @@ -11935,20 +12974,18 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc } if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1490 + /* "sklearn/tree/_tree.pyx":1569 * if (((current_pos - start) < min_samples_leaf) or * ((end - current_pos) < min_samples_leaf)): - * continue # <<<<<<<<<<<<<< + * continue # <<<<<<<<<<<<<< * * self.criterion.update(current_pos) */ goto __pyx_L10_continue; - goto __pyx_L15; } - __pyx_L15:; - /* "sklearn/tree/_tree.pyx":1492 - * continue + /* "sklearn/tree/_tree.pyx":1571 + * continue * * self.criterion.update(current_pos) # <<<<<<<<<<<<<< * current_improvement = self.criterion.impurity_improvement(impurity) @@ -11956,7 +12993,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->update(__pyx_v_self->__pyx_base.criterion, __pyx_v_current_pos); - /* "sklearn/tree/_tree.pyx":1493 + /* "sklearn/tree/_tree.pyx":1572 * * self.criterion.update(current_pos) * current_improvement = self.criterion.impurity_improvement(impurity) # <<<<<<<<<<<<<< @@ -11965,7 +13002,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_current_improvement = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->impurity_improvement(__pyx_v_self->__pyx_base.criterion, __pyx_v_impurity); - /* "sklearn/tree/_tree.pyx":1495 + /* "sklearn/tree/_tree.pyx":1574 * current_improvement = self.criterion.impurity_improvement(impurity) * * if current_improvement > best_improvement: # <<<<<<<<<<<<<< @@ -11975,7 +13012,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_10 = ((__pyx_v_current_improvement > __pyx_v_best_improvement) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1496 + /* "sklearn/tree/_tree.pyx":1575 * * if current_improvement > best_improvement: * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) # <<<<<<<<<<<<<< @@ -11984,7 +13021,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_self->__pyx_base.criterion->__pyx_vtab)->children_impurity(__pyx_v_self->__pyx_base.criterion, (&__pyx_v_current_impurity_left), (&__pyx_v_current_impurity_right)); - /* "sklearn/tree/_tree.pyx":1497 + /* "sklearn/tree/_tree.pyx":1576 * if current_improvement > best_improvement: * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) * best_impurity_left = current_impurity_left # <<<<<<<<<<<<<< @@ -11993,7 +13030,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_impurity_left = __pyx_v_current_impurity_left; - /* "sklearn/tree/_tree.pyx":1498 + /* "sklearn/tree/_tree.pyx":1577 * self.criterion.children_impurity(¤t_impurity_left, ¤t_impurity_right) * best_impurity_left = current_impurity_left * best_impurity_right = current_impurity_right # <<<<<<<<<<<<<< @@ -12002,7 +13039,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_impurity_right = __pyx_v_current_impurity_right; - /* "sklearn/tree/_tree.pyx":1499 + /* "sklearn/tree/_tree.pyx":1578 * best_impurity_left = current_impurity_left * best_impurity_right = current_impurity_right * best_improvement = current_improvement # <<<<<<<<<<<<<< @@ -12011,7 +13048,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_improvement = __pyx_v_current_improvement; - /* "sklearn/tree/_tree.pyx":1500 + /* "sklearn/tree/_tree.pyx":1579 * best_impurity_right = current_impurity_right * best_improvement = current_improvement * best_pos = current_pos # <<<<<<<<<<<<<< @@ -12020,48 +13057,48 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_best_pos = __pyx_v_current_pos; - /* "sklearn/tree/_tree.pyx":1501 + /* "sklearn/tree/_tree.pyx":1580 * best_improvement = current_improvement * best_pos = current_pos * best_feature = current_feature # <<<<<<<<<<<<<< * - * current_threshold = (X_fx[X_sample_stride * samples[p - 1]] + + * current_threshold = (Xf[p - 1] + Xf[p]) / 2.0 */ __pyx_v_best_feature = __pyx_v_current_feature; - /* "sklearn/tree/_tree.pyx":1504 + /* "sklearn/tree/_tree.pyx":1582 + * best_feature = current_feature * - * current_threshold = (X_fx[X_sample_stride * samples[p - 1]] + - * X_fx[X_sample_stride * samples[p]]) / 2.0 # <<<<<<<<<<<<<< + * current_threshold = (Xf[p - 1] + Xf[p]) / 2.0 # <<<<<<<<<<<<<< * - * if current_threshold == X_fx[X_sample_stride * samples[p]]: + * if current_threshold == Xf[p]: */ - __pyx_v_current_threshold = (((__pyx_v_X_fx[(__pyx_v_X_sample_stride * (__pyx_v_samples[(__pyx_v_p - 1)]))]) + (__pyx_v_X_fx[(__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p]))])) / 2.0); + __pyx_v_current_threshold = (((__pyx_v_Xf[(__pyx_v_p - 1)]) + (__pyx_v_Xf[__pyx_v_p])) / 2.0); - /* "sklearn/tree/_tree.pyx":1506 - * X_fx[X_sample_stride * samples[p]]) / 2.0 + /* "sklearn/tree/_tree.pyx":1584 + * current_threshold = (Xf[p - 1] + Xf[p]) / 2.0 * - * if current_threshold == X_fx[X_sample_stride * samples[p]]: # <<<<<<<<<<<<<< - * current_threshold = X_fx[X_sample_stride * samples[p - 1]] + * if current_threshold == Xf[p]: # <<<<<<<<<<<<<< + * current_threshold = Xf[p - 1] * */ - __pyx_t_10 = ((__pyx_v_current_threshold == (__pyx_v_X_fx[(__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p]))])) != 0); + __pyx_t_10 = ((__pyx_v_current_threshold == (__pyx_v_Xf[__pyx_v_p])) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1507 + /* "sklearn/tree/_tree.pyx":1585 * - * if current_threshold == X_fx[X_sample_stride * samples[p]]: - * current_threshold = X_fx[X_sample_stride * samples[p - 1]] # <<<<<<<<<<<<<< + * if current_threshold == Xf[p]: + * current_threshold = Xf[p - 1] # <<<<<<<<<<<<<< * * best_threshold = current_threshold */ - __pyx_v_current_threshold = (__pyx_v_X_fx[(__pyx_v_X_sample_stride * (__pyx_v_samples[(__pyx_v_p - 1)]))]); + __pyx_v_current_threshold = (__pyx_v_Xf[(__pyx_v_p - 1)]); goto __pyx_L17; } __pyx_L17:; - /* "sklearn/tree/_tree.pyx":1509 - * current_threshold = X_fx[X_sample_stride * samples[p - 1]] + /* "sklearn/tree/_tree.pyx":1587 + * current_threshold = Xf[p - 1] * * best_threshold = current_threshold # <<<<<<<<<<<<<< * @@ -12077,7 +13114,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_L10_continue:; } - /* "sklearn/tree/_tree.pyx":1511 + /* "sklearn/tree/_tree.pyx":1589 * best_threshold = current_threshold * * if best_pos == end: # No valid split was ever found # <<<<<<<<<<<<<< @@ -12087,7 +13124,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_10 = ((__pyx_v_best_pos == __pyx_v_end) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1512 + /* "sklearn/tree/_tree.pyx":1590 * * if best_pos == end: # No valid split was ever found * continue # <<<<<<<<<<<<<< @@ -12095,11 +13132,9 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc * # Count one more visited feature */ goto __pyx_L5_continue; - goto __pyx_L18; } - __pyx_L18:; - /* "sklearn/tree/_tree.pyx":1515 + /* "sklearn/tree/_tree.pyx":1593 * * # Count one more visited feature * visited_features += 1 # <<<<<<<<<<<<<< @@ -12108,7 +13143,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_visited_features = (__pyx_v_visited_features + 1); - /* "sklearn/tree/_tree.pyx":1517 + /* "sklearn/tree/_tree.pyx":1595 * visited_features += 1 * * if visited_features >= max_features: # <<<<<<<<<<<<<< @@ -12118,7 +13153,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_10 = ((__pyx_v_visited_features >= __pyx_v_max_features) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1518 + /* "sklearn/tree/_tree.pyx":1596 * * if visited_features >= max_features: * break # <<<<<<<<<<<<<< @@ -12126,14 +13161,12 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc * # Reorganize into samples[start:best_pos] + samples[best_pos:end] */ goto __pyx_L6_break; - goto __pyx_L19; } - __pyx_L19:; __pyx_L5_continue:; } __pyx_L6_break:; - /* "sklearn/tree/_tree.pyx":1521 + /* "sklearn/tree/_tree.pyx":1599 * * # Reorganize into samples[start:best_pos] + samples[best_pos:end] * if best_pos < end: # <<<<<<<<<<<<<< @@ -12143,7 +13176,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc __pyx_t_10 = ((__pyx_v_best_pos < __pyx_v_end) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1522 + /* "sklearn/tree/_tree.pyx":1600 * # Reorganize into samples[start:best_pos] + samples[best_pos:end] * if best_pos < end: * partition_start = start # <<<<<<<<<<<<<< @@ -12152,7 +13185,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_partition_start = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1523 + /* "sklearn/tree/_tree.pyx":1601 * if best_pos < end: * partition_start = start * partition_end = end # <<<<<<<<<<<<<< @@ -12161,7 +13194,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_partition_end = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":1524 + /* "sklearn/tree/_tree.pyx":1602 * partition_start = start * partition_end = end * p = start # <<<<<<<<<<<<<< @@ -12170,30 +13203,30 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_p = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1526 + /* "sklearn/tree/_tree.pyx":1604 * p = start * * while p < partition_end: # <<<<<<<<<<<<<< - * if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: - * p += 1 + * if X[X_sample_stride * samples[p] + * + X_fx_stride * best_feature] <= best_threshold: */ while (1) { __pyx_t_10 = ((__pyx_v_p < __pyx_v_partition_end) != 0); if (!__pyx_t_10) break; - /* "sklearn/tree/_tree.pyx":1527 - * + /* "sklearn/tree/_tree.pyx":1606 * while p < partition_end: - * if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: # <<<<<<<<<<<<<< + * if X[X_sample_stride * samples[p] + * + X_fx_stride * best_feature] <= best_threshold: # <<<<<<<<<<<<<< * p += 1 * */ __pyx_t_10 = (((__pyx_v_X[((__pyx_v_X_sample_stride * (__pyx_v_samples[__pyx_v_p])) + (__pyx_v_X_fx_stride * __pyx_v_best_feature))]) <= __pyx_v_best_threshold) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1528 - * while p < partition_end: - * if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: + /* "sklearn/tree/_tree.pyx":1607 + * if X[X_sample_stride * samples[p] + * + X_fx_stride * best_feature] <= best_threshold: * p += 1 # <<<<<<<<<<<<<< * * else: @@ -12203,7 +13236,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc } /*else*/ { - /* "sklearn/tree/_tree.pyx":1531 + /* "sklearn/tree/_tree.pyx":1610 * * else: * partition_end -= 1 # <<<<<<<<<<<<<< @@ -12212,7 +13245,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_partition_end = (__pyx_v_partition_end - 1); - /* "sklearn/tree/_tree.pyx":1533 + /* "sklearn/tree/_tree.pyx":1612 * partition_end -= 1 * * tmp = samples[partition_end] # <<<<<<<<<<<<<< @@ -12221,7 +13254,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ __pyx_v_tmp = (__pyx_v_samples[__pyx_v_partition_end]); - /* "sklearn/tree/_tree.pyx":1534 + /* "sklearn/tree/_tree.pyx":1613 * * tmp = samples[partition_end] * samples[partition_end] = samples[p] # <<<<<<<<<<<<<< @@ -12230,7 +13263,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ (__pyx_v_samples[__pyx_v_partition_end]) = (__pyx_v_samples[__pyx_v_p]); - /* "sklearn/tree/_tree.pyx":1535 + /* "sklearn/tree/_tree.pyx":1614 * tmp = samples[partition_end] * samples[partition_end] = samples[p] * samples[p] = tmp # <<<<<<<<<<<<<< @@ -12245,7 +13278,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc } __pyx_L20:; - /* "sklearn/tree/_tree.pyx":1538 + /* "sklearn/tree/_tree.pyx":1617 * * # Reset sample mask * for p in range(start, end): # <<<<<<<<<<<<<< @@ -12256,7 +13289,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc for (__pyx_t_6 = __pyx_v_start; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) { __pyx_v_p = __pyx_t_6; - /* "sklearn/tree/_tree.pyx":1539 + /* "sklearn/tree/_tree.pyx":1618 * # Reset sample mask * for p in range(start, end): * sample_mask[samples[p]] = 0 # <<<<<<<<<<<<<< @@ -12266,7 +13299,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc (__pyx_v_sample_mask[(__pyx_v_samples[__pyx_v_p])]) = 0; } - /* "sklearn/tree/_tree.pyx":1542 + /* "sklearn/tree/_tree.pyx":1621 * * # Return values * pos[0] = best_pos # <<<<<<<<<<<<<< @@ -12275,7 +13308,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ (__pyx_v_pos[0]) = __pyx_v_best_pos; - /* "sklearn/tree/_tree.pyx":1543 + /* "sklearn/tree/_tree.pyx":1622 * # Return values * pos[0] = best_pos * feature[0] = best_feature # <<<<<<<<<<<<<< @@ -12284,7 +13317,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ (__pyx_v_feature[0]) = __pyx_v_best_feature; - /* "sklearn/tree/_tree.pyx":1544 + /* "sklearn/tree/_tree.pyx":1623 * pos[0] = best_pos * feature[0] = best_feature * threshold[0] = best_threshold # <<<<<<<<<<<<<< @@ -12293,7 +13326,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ (__pyx_v_threshold[0]) = __pyx_v_best_threshold; - /* "sklearn/tree/_tree.pyx":1545 + /* "sklearn/tree/_tree.pyx":1624 * feature[0] = best_feature * threshold[0] = best_threshold * impurity_left[0] = best_impurity_left # <<<<<<<<<<<<<< @@ -12302,7 +13335,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ (__pyx_v_impurity_left[0]) = __pyx_v_best_impurity_left; - /* "sklearn/tree/_tree.pyx":1546 + /* "sklearn/tree/_tree.pyx":1625 * threshold[0] = best_threshold * impurity_left[0] = best_impurity_left * impurity_right[0] = best_impurity_right # <<<<<<<<<<<<<< @@ -12311,7 +13344,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ (__pyx_v_impurity_right[0]) = __pyx_v_best_impurity_right; - /* "sklearn/tree/_tree.pyx":1547 + /* "sklearn/tree/_tree.pyx":1626 * impurity_left[0] = best_impurity_left * impurity_right[0] = best_impurity_right * impurity_improvement[0] = best_improvement # <<<<<<<<<<<<<< @@ -12320,9 +13353,18 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc */ (__pyx_v_impurity_improvement[0]) = __pyx_v_best_improvement; + /* "sklearn/tree/_tree.pyx":1473 + * self.sample_mask = sample_mask + * + * cdef void node_split(self, double impurity, SIZE_t* pos, # <<<<<<<<<<<<<< + * SIZE_t* feature, double* threshold, + * double* impurity_left, double* impurity_right, + */ + + /* function exit code */ } -/* "sklearn/tree/_tree.pyx":1557 +/* "sklearn/tree/_tree.pyx":1636 * """Interface for different tree building strategies. """ * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -12333,7 +13375,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split(struc static PyObject *__pyx_pw_7sklearn_4tree_5_tree_11TreeBuilder_1build(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7sklearn_4tree_5_tree_11TreeBuilder_build(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_tree, CYTHON_UNUSED PyArrayObject *__pyx_v_X, CYTHON_UNUSED PyArrayObject *__pyx_v_y, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_4tree_5_tree_11TreeBuilder_build *__pyx_optional_args) { - /* "sklearn/tree/_tree.pyx":1558 + /* "sklearn/tree/_tree.pyx":1637 * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, * np.ndarray sample_weight=None): # <<<<<<<<<<<<<< @@ -12356,7 +13398,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_11TreeBuilder_build(CYTHON_UNUSED } } - /* "sklearn/tree/_tree.pyx":1557 + /* "sklearn/tree/_tree.pyx":1636 * """Interface for different tree building strategies. """ * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -12367,11 +13409,11 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_11TreeBuilder_build(CYTHON_UNUSED if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__build); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_build); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_4tree_5_tree_11TreeBuilder_1build)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_tree)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_tree)); @@ -12385,9 +13427,9 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_11TreeBuilder_build(CYTHON_UNUSED __Pyx_INCREF(((PyObject *)__pyx_v_sample_weight)); PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sample_weight)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -12396,14 +13438,15 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_11TreeBuilder_build(CYTHON_UNUSED __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/tree/_tree.pyx":1560 + /* "sklearn/tree/_tree.pyx":1638 + * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, * np.ndarray sample_weight=None): - * """Build a decision tree from the training set (X, y).""" - * pass # <<<<<<<<<<<<<< - * + * """Build a decision tree from the training set (X, y).""" # <<<<<<<<<<<<<< + * pass * */ + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -12418,6 +13461,14 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_11TreeBuilder_build(CYTHON_UNUSED return __pyx_r; } +/* "sklearn/tree/_tree.pyx":1636 + * """Interface for different tree building strategies. """ + * + * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< + * np.ndarray sample_weight=None): + * """Build a decision tree from the training set (X, y).""" + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_11TreeBuilder_1build(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7sklearn_4tree_5_tree_11TreeBuilder_build[] = "Build a decision tree from the training set (X, y)."; @@ -12433,10 +13484,10 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_11TreeBuilder_1build(PyObject *_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("build (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__sample_weight,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree,&__pyx_n_s_X,&__pyx_n_s_y,&__pyx_n_s_sample_weight,0}; PyObject* values[4] = {0,0,0,0}; - /* "sklearn/tree/_tree.pyx":1558 + /* "sklearn/tree/_tree.pyx":1637 * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, * np.ndarray sample_weight=None): # <<<<<<<<<<<<<< @@ -12458,26 +13509,26 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_11TreeBuilder_1build(PyObject *_ kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_weight); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample_weight); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "build") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "build") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -12496,26 +13547,19 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_11TreeBuilder_1build(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree.TreeBuilder.build", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_7sklearn_4tree_5_tree_Tree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_weight), __pyx_ptype_5numpy_ndarray, 1, "sample_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_7sklearn_4tree_5_tree_Tree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_weight), __pyx_ptype_5numpy_ndarray, 1, "sample_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_11TreeBuilder_build(((struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *)__pyx_v_self), __pyx_v_tree, __pyx_v_X, __pyx_v_y, __pyx_v_sample_weight); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -/* "sklearn/tree/_tree.pyx":1557 + /* "sklearn/tree/_tree.pyx":1636 * """Interface for different tree building strategies. """ * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -12523,6 +13567,15 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_11TreeBuilder_1build(PyObject *_ * """Build a decision tree from the training set (X, y).""" */ + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + static PyObject *__pyx_pf_7sklearn_4tree_5_tree_11TreeBuilder_build(struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *__pyx_v_self, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_tree, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_sample_weight) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -12535,14 +13588,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_11TreeBuilder_build(struct __pyx __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.sample_weight = __pyx_v_sample_weight; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_TreeBuilder *)__pyx_v_self->__pyx_vtab)->build(__pyx_v_self, __pyx_v_tree, __pyx_v_X, __pyx_v_y, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_TreeBuilder *)__pyx_v_self->__pyx_vtab)->build(__pyx_v_self, __pyx_v_tree, __pyx_v_X, __pyx_v_y, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.TreeBuilder.build", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -12553,7 +13605,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_11TreeBuilder_build(struct __pyx return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1568 +/* "sklearn/tree/_tree.pyx":1647 * """Build a decision tree in depth-first fashion.""" * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -12564,7 +13616,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_11TreeBuilder_build(struct __pyx static PyObject *__pyx_pw_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_1build(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_DepthFirstTreeBuilder *__pyx_v_self, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_tree, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build *__pyx_optional_args) { - /* "sklearn/tree/_tree.pyx":1569 + /* "sklearn/tree/_tree.pyx":1648 * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, * np.ndarray sample_weight=None): # <<<<<<<<<<<<<< @@ -12623,7 +13675,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __Pyx_INCREF((PyObject *)__pyx_v_y); __Pyx_INCREF((PyObject *)__pyx_v_sample_weight); - /* "sklearn/tree/_tree.pyx":1568 + /* "sklearn/tree/_tree.pyx":1647 * """Build a decision tree in depth-first fashion.""" * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -12634,11 +13686,11 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__build); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_build); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_1build)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_tree)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_tree)); @@ -12652,9 +13704,9 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __Pyx_INCREF(((PyObject *)__pyx_v_sample_weight)); PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sample_weight)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -12663,82 +13715,82 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/tree/_tree.pyx":1572 + /* "sklearn/tree/_tree.pyx":1651 * """Build a decision tree from the training set (X, y).""" * # check if dtype is correct * if X.dtype != DTYPE: # <<<<<<<<<<<<<< * # since we have to copy we will make it fortran for efficiency * X = np.asfortranarray(X, dtype=DTYPE) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X), __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1574 + /* "sklearn/tree/_tree.pyx":1653 * if X.dtype != DTYPE: * # since we have to copy we will make it fortran for efficiency * X = np.asfortranarray(X, dtype=DTYPE) # <<<<<<<<<<<<<< * * if y.dtype != DOUBLE or not y.flags.contiguous: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__asfortranarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asfortranarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_X, ((PyArrayObject *)__pyx_t_5)); __pyx_t_5 = 0; goto __pyx_L3; } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":1576 + /* "sklearn/tree/_tree.pyx":1655 * X = np.asfortranarray(X, dtype=DTYPE) * * if y.dtype != DOUBLE or not y.flags.contiguous: # <<<<<<<<<<<<<< * y = np.ascontiguousarray(y, dtype=DOUBLE) * */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s_dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__contiguous); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_contiguous); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = (!__pyx_t_6); __pyx_t_6 = __pyx_t_7; @@ -12747,42 +13799,42 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1577 + /* "sklearn/tree/_tree.pyx":1656 * * if y.dtype != DOUBLE or not y.flags.contiguous: * y = np.ascontiguousarray(y, dtype=DOUBLE) # <<<<<<<<<<<<<< * * cdef DOUBLE_t* sample_weight_ptr = NULL */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_y, ((PyArrayObject *)__pyx_t_3)); __pyx_t_3 = 0; goto __pyx_L4; } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":1579 + /* "sklearn/tree/_tree.pyx":1658 * y = np.ascontiguousarray(y, dtype=DOUBLE) * * cdef DOUBLE_t* sample_weight_ptr = NULL # <<<<<<<<<<<<<< @@ -12791,7 +13843,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_sample_weight_ptr = NULL; - /* "sklearn/tree/_tree.pyx":1580 + /* "sklearn/tree/_tree.pyx":1659 * * cdef DOUBLE_t* sample_weight_ptr = NULL * if sample_weight is not None: # <<<<<<<<<<<<<< @@ -12802,37 +13854,37 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = (__pyx_t_6 != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1581 + /* "sklearn/tree/_tree.pyx":1660 * cdef DOUBLE_t* sample_weight_ptr = NULL * if sample_weight is not None: * if ((sample_weight.dtype != DOUBLE) or # <<<<<<<<<<<<<< * (not sample_weight.flags.contiguous)): * sample_weight = np.asarray(sample_weight, */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1582 + /* "sklearn/tree/_tree.pyx":1661 * if sample_weight is not None: * if ((sample_weight.dtype != DOUBLE) or * (not sample_weight.flags.contiguous)): # <<<<<<<<<<<<<< * sample_weight = np.asarray(sample_weight, * dtype=DOUBLE, order="C") */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__contiguous); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_contiguous); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = (!__pyx_t_6); __pyx_t_6 = __pyx_t_7; @@ -12841,51 +13893,59 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1583 + /* "sklearn/tree/_tree.pyx":1662 * if ((sample_weight.dtype != DOUBLE) or * (not sample_weight.flags.contiguous)): * sample_weight = np.asarray(sample_weight, # <<<<<<<<<<<<<< * dtype=DOUBLE, order="C") * sample_weight_ptr = sample_weight.data */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_sample_weight)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sample_weight)); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); - /* "sklearn/tree/_tree.pyx":1584 + /* "sklearn/tree/_tree.pyx":1663 * (not sample_weight.flags.contiguous)): * sample_weight = np.asarray(sample_weight, * dtype=DOUBLE, order="C") # <<<<<<<<<<<<<< * sample_weight_ptr = sample_weight.data * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_s_C) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":1662 + * if ((sample_weight.dtype != DOUBLE) or + * (not sample_weight.flags.contiguous)): + * sample_weight = np.asarray(sample_weight, # <<<<<<<<<<<<<< + * dtype=DOUBLE, order="C") + * sample_weight_ptr = sample_weight.data + */ + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_sample_weight, ((PyArrayObject *)__pyx_t_2)); __pyx_t_2 = 0; goto __pyx_L6; } __pyx_L6:; - /* "sklearn/tree/_tree.pyx":1585 + /* "sklearn/tree/_tree.pyx":1664 * sample_weight = np.asarray(sample_weight, * dtype=DOUBLE, order="C") * sample_weight_ptr = sample_weight.data # <<<<<<<<<<<<<< @@ -12897,7 +13957,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } __pyx_L5:; - /* "sklearn/tree/_tree.pyx":1590 + /* "sklearn/tree/_tree.pyx":1669 * cdef int init_capacity * * if tree.max_depth <= 10: # <<<<<<<<<<<<<< @@ -12907,7 +13967,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_6 = ((__pyx_v_tree->max_depth <= 10) != 0); if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1591 + /* "sklearn/tree/_tree.pyx":1670 * * if tree.max_depth <= 10: * init_capacity = (2 ** (tree.max_depth + 1)) - 1 # <<<<<<<<<<<<<< @@ -12919,7 +13979,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } /*else*/ { - /* "sklearn/tree/_tree.pyx":1593 + /* "sklearn/tree/_tree.pyx":1672 * init_capacity = (2 ** (tree.max_depth + 1)) - 1 * else: * init_capacity = 2047 # <<<<<<<<<<<<<< @@ -12930,7 +13990,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } __pyx_L7:; - /* "sklearn/tree/_tree.pyx":1595 + /* "sklearn/tree/_tree.pyx":1674 * init_capacity = 2047 * * tree._resize(init_capacity) # <<<<<<<<<<<<<< @@ -12939,7 +13999,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_tree->__pyx_vtab)->_resize(__pyx_v_tree, __pyx_v_init_capacity); - /* "sklearn/tree/_tree.pyx":1598 + /* "sklearn/tree/_tree.pyx":1677 * * # Recursive partition (without actual recursion) * cdef Splitter splitter = tree.splitter # <<<<<<<<<<<<<< @@ -12951,7 +14011,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_v_splitter = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":1599 + /* "sklearn/tree/_tree.pyx":1678 * # Recursive partition (without actual recursion) * cdef Splitter splitter = tree.splitter * splitter.init(X, y, sample_weight_ptr) # <<<<<<<<<<<<<< @@ -12960,7 +14020,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *)__pyx_v_splitter->__pyx_vtab)->init(__pyx_v_splitter, __pyx_v_X, __pyx_v_y, __pyx_v_sample_weight_ptr); - /* "sklearn/tree/_tree.pyx":1606 + /* "sklearn/tree/_tree.pyx":1685 * cdef SIZE_t parent * cdef bint is_left * cdef SIZE_t n_node_samples = splitter.n_samples # <<<<<<<<<<<<<< @@ -12970,7 +14030,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_8 = __pyx_v_splitter->n_samples; __pyx_v_n_node_samples = __pyx_t_8; - /* "sklearn/tree/_tree.pyx":1612 + /* "sklearn/tree/_tree.pyx":1691 * * cdef double threshold * cdef double impurity = INFINITY # <<<<<<<<<<<<<< @@ -12979,7 +14039,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_impurity = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1613 + /* "sklearn/tree/_tree.pyx":1692 * cdef double threshold * cdef double impurity = INFINITY * cdef double split_impurity_left = INFINITY # <<<<<<<<<<<<<< @@ -12988,7 +14048,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_split_impurity_left = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1614 + /* "sklearn/tree/_tree.pyx":1693 * cdef double impurity = INFINITY * cdef double split_impurity_left = INFINITY * cdef double split_impurity_right = INFINITY # <<<<<<<<<<<<<< @@ -12997,7 +14057,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_split_impurity_right = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1615 + /* "sklearn/tree/_tree.pyx":1694 * cdef double split_impurity_left = INFINITY * cdef double split_impurity_right = INFINITY * cdef double split_improvement = INFINITY # <<<<<<<<<<<<<< @@ -13006,7 +14066,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_split_improvement = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":1617 + /* "sklearn/tree/_tree.pyx":1696 * cdef double split_improvement = INFINITY * cdef bint is_leaf * cdef bint first = 1 # <<<<<<<<<<<<<< @@ -13015,7 +14075,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_first = 1; - /* "sklearn/tree/_tree.pyx":1618 + /* "sklearn/tree/_tree.pyx":1697 * cdef bint is_leaf * cdef bint first = 1 * cdef SIZE_t max_depth_seen = -1 # <<<<<<<<<<<<<< @@ -13024,7 +14084,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_max_depth_seen = -1; - /* "sklearn/tree/_tree.pyx":1619 + /* "sklearn/tree/_tree.pyx":1698 * cdef bint first = 1 * cdef SIZE_t max_depth_seen = -1 * cdef int rc = 0 # <<<<<<<<<<<<<< @@ -13033,27 +14093,27 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_rc = 0; - /* "sklearn/tree/_tree.pyx":1621 + /* "sklearn/tree/_tree.pyx":1700 * cdef int rc = 0 * * cdef Stack stack = Stack(INITIAL_STACK_SIZE) # <<<<<<<<<<<<<< * cdef StackRecord stack_record * */ - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_7sklearn_4tree_5_tree_INITIAL_STACK_SIZE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_7sklearn_4tree_5_tree_INITIAL_STACK_SIZE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_6_utils_Stack)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_6_utils_Stack)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_stack = ((struct __pyx_obj_7sklearn_4tree_6_utils_Stack *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":1625 + /* "sklearn/tree/_tree.pyx":1704 * * # push root node onto stack * rc = stack.push(0, n_node_samples, 0, _TREE_UNDEFINED, 0, INFINITY) # <<<<<<<<<<<<<< @@ -13062,7 +14122,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_rc = ((struct __pyx_vtabstruct_7sklearn_4tree_6_utils_Stack *)__pyx_v_stack->__pyx_vtab)->push(__pyx_v_stack, 0, __pyx_v_n_node_samples, 0, __pyx_v_7sklearn_4tree_5_tree__TREE_UNDEFINED, 0, __pyx_v_7sklearn_4tree_5_tree_INFINITY); - /* "sklearn/tree/_tree.pyx":1626 + /* "sklearn/tree/_tree.pyx":1705 * # push root node onto stack * rc = stack.push(0, n_node_samples, 0, _TREE_UNDEFINED, 0, INFINITY) * if rc == -1: # <<<<<<<<<<<<<< @@ -13072,19 +14132,17 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_6 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1628 + /* "sklearn/tree/_tree.pyx":1707 * if rc == -1: * # got return code -1 - out-of-memory * raise MemoryError() # <<<<<<<<<<<<<< * * with nogil: */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L8:; - /* "sklearn/tree/_tree.pyx":1630 + /* "sklearn/tree/_tree.pyx":1709 * raise MemoryError() * * with nogil: # <<<<<<<<<<<<<< @@ -13098,7 +14156,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT #endif /*try:*/ { - /* "sklearn/tree/_tree.pyx":1631 + /* "sklearn/tree/_tree.pyx":1710 * * with nogil: * while not stack.is_empty(): # <<<<<<<<<<<<<< @@ -13109,7 +14167,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_6 = ((!(((struct __pyx_vtabstruct_7sklearn_4tree_6_utils_Stack *)__pyx_v_stack->__pyx_vtab)->is_empty(__pyx_v_stack) != 0)) != 0); if (!__pyx_t_6) break; - /* "sklearn/tree/_tree.pyx":1632 + /* "sklearn/tree/_tree.pyx":1711 * with nogil: * while not stack.is_empty(): * stack.pop(&stack_record) # <<<<<<<<<<<<<< @@ -13118,7 +14176,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ ((struct __pyx_vtabstruct_7sklearn_4tree_6_utils_Stack *)__pyx_v_stack->__pyx_vtab)->pop(__pyx_v_stack, (&__pyx_v_stack_record)); - /* "sklearn/tree/_tree.pyx":1634 + /* "sklearn/tree/_tree.pyx":1713 * stack.pop(&stack_record) * * start = stack_record.start # <<<<<<<<<<<<<< @@ -13128,7 +14186,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_9 = __pyx_v_stack_record.start; __pyx_v_start = __pyx_t_9; - /* "sklearn/tree/_tree.pyx":1635 + /* "sklearn/tree/_tree.pyx":1714 * * start = stack_record.start * end = stack_record.end # <<<<<<<<<<<<<< @@ -13138,7 +14196,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_9 = __pyx_v_stack_record.end; __pyx_v_end = __pyx_t_9; - /* "sklearn/tree/_tree.pyx":1636 + /* "sklearn/tree/_tree.pyx":1715 * start = stack_record.start * end = stack_record.end * depth = stack_record.depth # <<<<<<<<<<<<<< @@ -13148,7 +14206,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_9 = __pyx_v_stack_record.depth; __pyx_v_depth = __pyx_t_9; - /* "sklearn/tree/_tree.pyx":1637 + /* "sklearn/tree/_tree.pyx":1716 * end = stack_record.end * depth = stack_record.depth * parent = stack_record.parent # <<<<<<<<<<<<<< @@ -13158,7 +14216,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_9 = __pyx_v_stack_record.parent; __pyx_v_parent = __pyx_t_9; - /* "sklearn/tree/_tree.pyx":1638 + /* "sklearn/tree/_tree.pyx":1717 * depth = stack_record.depth * parent = stack_record.parent * is_left = stack_record.is_left # <<<<<<<<<<<<<< @@ -13168,7 +14226,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_6 = __pyx_v_stack_record.is_left; __pyx_v_is_left = __pyx_t_6; - /* "sklearn/tree/_tree.pyx":1639 + /* "sklearn/tree/_tree.pyx":1718 * parent = stack_record.parent * is_left = stack_record.is_left * impurity = stack_record.impurity # <<<<<<<<<<<<<< @@ -13178,7 +14236,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_10 = __pyx_v_stack_record.impurity; __pyx_v_impurity = __pyx_t_10; - /* "sklearn/tree/_tree.pyx":1641 + /* "sklearn/tree/_tree.pyx":1720 * impurity = stack_record.impurity * * n_node_samples = end - start # <<<<<<<<<<<<<< @@ -13187,7 +14245,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_n_node_samples = (__pyx_v_end - __pyx_v_start); - /* "sklearn/tree/_tree.pyx":1642 + /* "sklearn/tree/_tree.pyx":1721 * * n_node_samples = end - start * is_leaf = ((depth >= tree.max_depth) or # <<<<<<<<<<<<<< @@ -13197,7 +14255,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_6 = (__pyx_v_depth >= __pyx_v_tree->max_depth); if (!__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1643 + /* "sklearn/tree/_tree.pyx":1722 * n_node_samples = end - start * is_leaf = ((depth >= tree.max_depth) or * (n_node_samples < tree.min_samples_split) or # <<<<<<<<<<<<<< @@ -13207,7 +14265,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = (__pyx_v_n_node_samples < __pyx_v_tree->min_samples_split); if (!__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1644 + /* "sklearn/tree/_tree.pyx":1723 * is_leaf = ((depth >= tree.max_depth) or * (n_node_samples < tree.min_samples_split) or * (n_node_samples < 2 * tree.min_samples_leaf)) # <<<<<<<<<<<<<< @@ -13225,7 +14283,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } __pyx_v_is_leaf = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1646 + /* "sklearn/tree/_tree.pyx":1725 * (n_node_samples < 2 * tree.min_samples_leaf)) * * splitter.node_reset(start, end) # calls criterion.init # <<<<<<<<<<<<<< @@ -13234,7 +14292,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *)__pyx_v_splitter->__pyx_vtab)->node_reset(__pyx_v_splitter, __pyx_v_start, __pyx_v_end); - /* "sklearn/tree/_tree.pyx":1648 + /* "sklearn/tree/_tree.pyx":1727 * splitter.node_reset(start, end) # calls criterion.init * * if first: # <<<<<<<<<<<<<< @@ -13244,7 +14302,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = (__pyx_v_first != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1649 + /* "sklearn/tree/_tree.pyx":1728 * * if first: * impurity = splitter.criterion.node_impurity() # <<<<<<<<<<<<<< @@ -13253,7 +14311,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_impurity = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_splitter->criterion->__pyx_vtab)->node_impurity(__pyx_v_splitter->criterion); - /* "sklearn/tree/_tree.pyx":1650 + /* "sklearn/tree/_tree.pyx":1729 * if first: * impurity = splitter.criterion.node_impurity() * first = 0 # <<<<<<<<<<<<<< @@ -13265,7 +14323,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } __pyx_L14:; - /* "sklearn/tree/_tree.pyx":1652 + /* "sklearn/tree/_tree.pyx":1731 * first = 0 * * is_leaf = is_leaf or (impurity < EPSILON_FLT) # <<<<<<<<<<<<<< @@ -13280,7 +14338,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } __pyx_v_is_leaf = __pyx_t_6; - /* "sklearn/tree/_tree.pyx":1654 + /* "sklearn/tree/_tree.pyx":1733 * is_leaf = is_leaf or (impurity < EPSILON_FLT) * * if not is_leaf: # <<<<<<<<<<<<<< @@ -13290,16 +14348,16 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_6 = ((!(__pyx_v_is_leaf != 0)) != 0); if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1658 + /* "sklearn/tree/_tree.pyx":1734 + * + * if not is_leaf: + * splitter.node_split(impurity, &pos, &feature, &threshold, # <<<<<<<<<<<<<< * &split_impurity_left, * &split_impurity_right, - * &split_improvement) # <<<<<<<<<<<<<< - * is_leaf = is_leaf or (pos >= end) - * */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *)__pyx_v_splitter->__pyx_vtab)->node_split(__pyx_v_splitter, __pyx_v_impurity, (&__pyx_v_pos), (&__pyx_v_feature), (&__pyx_v_threshold), (&__pyx_v_split_impurity_left), (&__pyx_v_split_impurity_right), (&__pyx_v_split_improvement)); - /* "sklearn/tree/_tree.pyx":1659 + /* "sklearn/tree/_tree.pyx":1738 * &split_impurity_right, * &split_improvement) * is_leaf = is_leaf or (pos >= end) # <<<<<<<<<<<<<< @@ -13317,16 +14375,16 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } __pyx_L15:; - /* "sklearn/tree/_tree.pyx":1662 + /* "sklearn/tree/_tree.pyx":1740 + * is_leaf = is_leaf or (pos >= end) * - * node_id = tree._add_node(parent, is_left, is_leaf, feature, - * threshold, impurity, n_node_samples) # <<<<<<<<<<<<<< + * node_id = tree._add_node(parent, is_left, is_leaf, feature, # <<<<<<<<<<<<<< + * threshold, impurity, n_node_samples) * - * if is_leaf: */ __pyx_v_node_id = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_tree->__pyx_vtab)->_add_node(__pyx_v_tree, __pyx_v_parent, __pyx_v_is_left, __pyx_v_is_leaf, __pyx_v_feature, __pyx_v_threshold, __pyx_v_impurity, __pyx_v_n_node_samples); - /* "sklearn/tree/_tree.pyx":1664 + /* "sklearn/tree/_tree.pyx":1743 * threshold, impurity, n_node_samples) * * if is_leaf: # <<<<<<<<<<<<<< @@ -13336,19 +14394,19 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = (__pyx_v_is_leaf != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1667 + /* "sklearn/tree/_tree.pyx":1745 + * if is_leaf: * # Don't store value for internal nodes - * splitter.node_value(tree.value - * + node_id * tree.value_stride) # <<<<<<<<<<<<<< + * splitter.node_value(tree.value # <<<<<<<<<<<<<< + * + node_id * tree.value_stride) * - * else: */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *)__pyx_v_splitter->__pyx_vtab)->node_value(__pyx_v_splitter, (__pyx_v_tree->value + (__pyx_v_node_id * __pyx_v_tree->value_stride))); goto __pyx_L16; } /*else*/ { - /* "sklearn/tree/_tree.pyx":1671 + /* "sklearn/tree/_tree.pyx":1750 * else: * # Push right child on stack * rc = stack.push(pos, end, depth + 1, node_id, 0, split_impurity_right) # <<<<<<<<<<<<<< @@ -13357,7 +14415,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_rc = ((struct __pyx_vtabstruct_7sklearn_4tree_6_utils_Stack *)__pyx_v_stack->__pyx_vtab)->push(__pyx_v_stack, __pyx_v_pos, __pyx_v_end, (__pyx_v_depth + 1), __pyx_v_node_id, 0, __pyx_v_split_impurity_right); - /* "sklearn/tree/_tree.pyx":1672 + /* "sklearn/tree/_tree.pyx":1751 * # Push right child on stack * rc = stack.push(pos, end, depth + 1, node_id, 0, split_impurity_right) * if rc == -1: # <<<<<<<<<<<<<< @@ -13367,7 +14425,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1673 + /* "sklearn/tree/_tree.pyx":1752 * rc = stack.push(pos, end, depth + 1, node_id, 0, split_impurity_right) * if rc == -1: * break # <<<<<<<<<<<<<< @@ -13375,11 +14433,9 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT * # Push left child on stack */ goto __pyx_L13_break; - goto __pyx_L17; } - __pyx_L17:; - /* "sklearn/tree/_tree.pyx":1676 + /* "sklearn/tree/_tree.pyx":1755 * * # Push left child on stack * rc = stack.push(start, pos, depth + 1, node_id, 1, split_impurity_left) # <<<<<<<<<<<<<< @@ -13388,7 +14444,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT */ __pyx_v_rc = ((struct __pyx_vtabstruct_7sklearn_4tree_6_utils_Stack *)__pyx_v_stack->__pyx_vtab)->push(__pyx_v_stack, __pyx_v_start, __pyx_v_pos, (__pyx_v_depth + 1), __pyx_v_node_id, 1, __pyx_v_split_impurity_left); - /* "sklearn/tree/_tree.pyx":1677 + /* "sklearn/tree/_tree.pyx":1756 * # Push left child on stack * rc = stack.push(start, pos, depth + 1, node_id, 1, split_impurity_left) * if rc == -1: # <<<<<<<<<<<<<< @@ -13398,7 +14454,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1678 + /* "sklearn/tree/_tree.pyx":1757 * rc = stack.push(start, pos, depth + 1, node_id, 1, split_impurity_left) * if rc == -1: * break # <<<<<<<<<<<<<< @@ -13406,13 +14462,11 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT * if depth > max_depth_seen: */ goto __pyx_L13_break; - goto __pyx_L18; } - __pyx_L18:; } __pyx_L16:; - /* "sklearn/tree/_tree.pyx":1680 + /* "sklearn/tree/_tree.pyx":1759 * break * * if depth > max_depth_seen: # <<<<<<<<<<<<<< @@ -13422,7 +14476,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = ((__pyx_v_depth > __pyx_v_max_depth_seen) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1681 + /* "sklearn/tree/_tree.pyx":1760 * * if depth > max_depth_seen: * max_depth_seen = depth # <<<<<<<<<<<<<< @@ -13436,7 +14490,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } __pyx_L13_break:; - /* "sklearn/tree/_tree.pyx":1683 + /* "sklearn/tree/_tree.pyx":1762 * max_depth_seen = depth * * if rc >= 0: # <<<<<<<<<<<<<< @@ -13446,7 +14500,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = ((__pyx_v_rc >= 0) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1684 + /* "sklearn/tree/_tree.pyx":1763 * * if rc >= 0: * rc = tree._resize_c(tree.node_count) # <<<<<<<<<<<<<< @@ -13461,7 +14515,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT } __pyx_L20:; - /* "sklearn/tree/_tree.pyx":1685 + /* "sklearn/tree/_tree.pyx":1764 * if rc >= 0: * rc = tree._resize_c(tree.node_count) * if rc >= 0: # <<<<<<<<<<<<<< @@ -13471,7 +14525,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = ((__pyx_v_rc >= 0) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1686 + /* "sklearn/tree/_tree.pyx":1765 * rc = tree._resize_c(tree.node_count) * if rc >= 0: * tree.max_depth = max_depth_seen # <<<<<<<<<<<<<< @@ -13484,7 +14538,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_L21:; } - /* "sklearn/tree/_tree.pyx":1630 + /* "sklearn/tree/_tree.pyx":1709 * raise MemoryError() * * with nogil: # <<<<<<<<<<<<<< @@ -13492,13 +14546,17 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT * stack.pop(&stack_record) */ /*finally:*/ { - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } } - /* "sklearn/tree/_tree.pyx":1688 + /* "sklearn/tree/_tree.pyx":1767 * tree.max_depth = max_depth_seen * * if rc == -1: # <<<<<<<<<<<<<< @@ -13508,19 +14566,17 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __pyx_t_4 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1689 + /* "sklearn/tree/_tree.pyx":1768 * * if rc == -1: * raise MemoryError() # <<<<<<<<<<<<<< * * # release memory */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L22; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L22:; - /* "sklearn/tree/_tree.pyx":1692 + /* "sklearn/tree/_tree.pyx":1771 * * # release memory * tree.splitter = None # <<<<<<<<<<<<<< @@ -13533,6 +14589,15 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(CYT __Pyx_DECREF(((PyObject *)__pyx_v_tree->splitter)); __pyx_v_tree->splitter = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)Py_None); + /* "sklearn/tree/_tree.pyx":1647 + * """Build a decision tree in depth-first fashion.""" + * + * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< + * np.ndarray sample_weight=None): + * """Build a decision tree from the training set (X, y).""" + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -13568,10 +14633,10 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_1build(P __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("build (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__sample_weight,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree,&__pyx_n_s_X,&__pyx_n_s_y,&__pyx_n_s_sample_weight,0}; PyObject* values[4] = {0,0,0,0}; - /* "sklearn/tree/_tree.pyx":1569 + /* "sklearn/tree/_tree.pyx":1648 * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, * np.ndarray sample_weight=None): # <<<<<<<<<<<<<< @@ -13593,26 +14658,26 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_1build(P kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_weight); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample_weight); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "build") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "build") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -13631,26 +14696,19 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_1build(P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree.DepthFirstTreeBuilder.build", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_7sklearn_4tree_5_tree_Tree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_weight), __pyx_ptype_5numpy_ndarray, 1, "sample_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_7sklearn_4tree_5_tree_Tree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_weight), __pyx_ptype_5numpy_ndarray, 1, "sample_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(((struct __pyx_obj_7sklearn_4tree_5_tree_DepthFirstTreeBuilder *)__pyx_v_self), __pyx_v_tree, __pyx_v_X, __pyx_v_y, __pyx_v_sample_weight); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -/* "sklearn/tree/_tree.pyx":1568 + /* "sklearn/tree/_tree.pyx":1647 * """Build a decision tree in depth-first fashion.""" * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -13658,6 +14716,15 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_1build(P * """Build a decision tree from the training set (X, y).""" */ + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + static PyObject *__pyx_pf_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(struct __pyx_obj_7sklearn_4tree_5_tree_DepthFirstTreeBuilder *__pyx_v_self, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_tree, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_sample_weight) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -13670,14 +14737,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(st __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.sample_weight = __pyx_v_sample_weight; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_DepthFirstTreeBuilder *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.build(((struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *)__pyx_v_self), __pyx_v_tree, __pyx_v_X, __pyx_v_y, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_DepthFirstTreeBuilder *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.build(((struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *)__pyx_v_self), __pyx_v_tree, __pyx_v_X, __pyx_v_y, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.DepthFirstTreeBuilder.build", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -13688,7 +14754,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build(st return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1697 +/* "sklearn/tree/_tree.pyx":1776 * # Best first builder ---------------------------------------------------------- * * cdef int _add_split_node(Splitter splitter, Tree tree, # <<<<<<<<<<<<<< @@ -13711,9 +14777,9 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_t_5; + ptrdiff_t __pyx_t_5; - /* "sklearn/tree/_tree.pyx":1714 + /* "sklearn/tree/_tree.pyx":1793 * cdef double imp_diff * * splitter.node_reset(start, end) # calls criterion.init # <<<<<<<<<<<<<< @@ -13722,7 +14788,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *)__pyx_v_splitter->__pyx_vtab)->node_reset(__pyx_v_splitter, __pyx_v_start, __pyx_v_end); - /* "sklearn/tree/_tree.pyx":1715 + /* "sklearn/tree/_tree.pyx":1794 * * splitter.node_reset(start, end) # calls criterion.init * if is_first: # <<<<<<<<<<<<<< @@ -13732,7 +14798,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea __pyx_t_1 = (__pyx_v_is_first != 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1716 + /* "sklearn/tree/_tree.pyx":1795 * splitter.node_reset(start, end) # calls criterion.init * if is_first: * impurity = splitter.criterion.node_impurity() # <<<<<<<<<<<<<< @@ -13744,7 +14810,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":1718 + /* "sklearn/tree/_tree.pyx":1797 * impurity = splitter.criterion.node_impurity() * * n_node_samples = end - start # <<<<<<<<<<<<<< @@ -13753,7 +14819,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_n_node_samples = (__pyx_v_end - __pyx_v_start); - /* "sklearn/tree/_tree.pyx":1719 + /* "sklearn/tree/_tree.pyx":1798 * * n_node_samples = end - start * is_leaf = ((depth > tree.max_depth) or # <<<<<<<<<<<<<< @@ -13763,7 +14829,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea __pyx_t_1 = (__pyx_v_depth > __pyx_v_tree->max_depth); if (!__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1720 + /* "sklearn/tree/_tree.pyx":1799 * n_node_samples = end - start * is_leaf = ((depth > tree.max_depth) or * (n_node_samples < tree.min_samples_split) or # <<<<<<<<<<<<<< @@ -13773,7 +14839,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea __pyx_t_2 = (__pyx_v_n_node_samples < __pyx_v_tree->min_samples_split); if (!__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":1721 + /* "sklearn/tree/_tree.pyx":1800 * is_leaf = ((depth > tree.max_depth) or * (n_node_samples < tree.min_samples_split) or * (n_node_samples < 2 * tree.min_samples_leaf)) # <<<<<<<<<<<<<< @@ -13791,7 +14857,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea } __pyx_v_is_leaf = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1723 + /* "sklearn/tree/_tree.pyx":1802 * (n_node_samples < 2 * tree.min_samples_leaf)) * * if not is_leaf: # <<<<<<<<<<<<<< @@ -13801,16 +14867,16 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea __pyx_t_2 = ((!(__pyx_v_is_leaf != 0)) != 0); if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":1726 - * splitter.node_split(impurity, &pos, &feature, &threshold, - * &split_impurity_left, &split_impurity_right, - * &split_improvement) # <<<<<<<<<<<<<< - * is_leaf = is_leaf or (pos >= end) + /* "sklearn/tree/_tree.pyx":1803 * + * if not is_leaf: + * splitter.node_split(impurity, &pos, &feature, &threshold, # <<<<<<<<<<<<<< + * &split_impurity_left, &split_impurity_right, + * &split_improvement) */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *)__pyx_v_splitter->__pyx_vtab)->node_split(__pyx_v_splitter, __pyx_v_impurity, (&__pyx_v_pos), (&__pyx_v_feature), (&__pyx_v_threshold), (&__pyx_v_split_impurity_left), (&__pyx_v_split_impurity_right), (&__pyx_v_split_improvement)); - /* "sklearn/tree/_tree.pyx":1727 + /* "sklearn/tree/_tree.pyx":1806 * &split_impurity_left, &split_impurity_right, * &split_improvement) * is_leaf = is_leaf or (pos >= end) # <<<<<<<<<<<<<< @@ -13828,7 +14894,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":1729 + /* "sklearn/tree/_tree.pyx":1808 * is_leaf = is_leaf or (pos >= end) * * node_id = tree._add_node(parent - tree.nodes if parent != NULL # <<<<<<<<<<<<<< @@ -13839,7 +14905,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea __pyx_t_5 = (__pyx_v_parent - __pyx_v_tree->nodes); } else { - /* "sklearn/tree/_tree.pyx":1730 + /* "sklearn/tree/_tree.pyx":1809 * * node_id = tree._add_node(parent - tree.nodes if parent != NULL * else _TREE_UNDEFINED, # <<<<<<<<<<<<<< @@ -13849,16 +14915,16 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea __pyx_t_5 = __pyx_v_7sklearn_4tree_5_tree__TREE_UNDEFINED; } - /* "sklearn/tree/_tree.pyx":1732 + /* "sklearn/tree/_tree.pyx":1808 + * is_leaf = is_leaf or (pos >= end) + * + * node_id = tree._add_node(parent - tree.nodes if parent != NULL # <<<<<<<<<<<<<< * else _TREE_UNDEFINED, * is_left, is_leaf, - * feature, threshold, impurity, n_node_samples) # <<<<<<<<<<<<<< - * if node_id == (-1): - * return -1 */ __pyx_v_node_id = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_tree->__pyx_vtab)->_add_node(__pyx_v_tree, __pyx_t_5, __pyx_v_is_left, __pyx_v_is_leaf, __pyx_v_feature, __pyx_v_threshold, __pyx_v_impurity, __pyx_v_n_node_samples); - /* "sklearn/tree/_tree.pyx":1733 + /* "sklearn/tree/_tree.pyx":1812 * is_left, is_leaf, * feature, threshold, impurity, n_node_samples) * if node_id == (-1): # <<<<<<<<<<<<<< @@ -13868,7 +14934,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea __pyx_t_1 = ((__pyx_v_node_id == ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)-1)) != 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1734 + /* "sklearn/tree/_tree.pyx":1813 * feature, threshold, impurity, n_node_samples) * if node_id == (-1): * return -1 # <<<<<<<<<<<<<< @@ -13877,11 +14943,9 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_r = -1; goto __pyx_L0; - goto __pyx_L5; } - __pyx_L5:; - /* "sklearn/tree/_tree.pyx":1737 + /* "sklearn/tree/_tree.pyx":1816 * * # compute values also for split nodes (might become leafs later). * splitter.node_value(tree.value + node_id * tree.value_stride) # <<<<<<<<<<<<<< @@ -13890,7 +14954,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *)__pyx_v_splitter->__pyx_vtab)->node_value(__pyx_v_splitter, (__pyx_v_tree->value + (__pyx_v_node_id * __pyx_v_tree->value_stride))); - /* "sklearn/tree/_tree.pyx":1739 + /* "sklearn/tree/_tree.pyx":1818 * splitter.node_value(tree.value + node_id * tree.value_stride) * * res.node_id = node_id # <<<<<<<<<<<<<< @@ -13899,7 +14963,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_res->node_id = __pyx_v_node_id; - /* "sklearn/tree/_tree.pyx":1740 + /* "sklearn/tree/_tree.pyx":1819 * * res.node_id = node_id * res.start = start # <<<<<<<<<<<<<< @@ -13908,7 +14972,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_res->start = __pyx_v_start; - /* "sklearn/tree/_tree.pyx":1741 + /* "sklearn/tree/_tree.pyx":1820 * res.node_id = node_id * res.start = start * res.end = end # <<<<<<<<<<<<<< @@ -13917,7 +14981,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_res->end = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":1742 + /* "sklearn/tree/_tree.pyx":1821 * res.start = start * res.end = end * res.depth = depth # <<<<<<<<<<<<<< @@ -13926,7 +14990,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_res->depth = __pyx_v_depth; - /* "sklearn/tree/_tree.pyx":1743 + /* "sklearn/tree/_tree.pyx":1822 * res.end = end * res.depth = depth * res.impurity = impurity # <<<<<<<<<<<<<< @@ -13935,7 +14999,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_res->impurity = __pyx_v_impurity; - /* "sklearn/tree/_tree.pyx":1745 + /* "sklearn/tree/_tree.pyx":1824 * res.impurity = impurity * * if not is_leaf: # <<<<<<<<<<<<<< @@ -13945,7 +15009,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea __pyx_t_1 = ((!(__pyx_v_is_leaf != 0)) != 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1747 + /* "sklearn/tree/_tree.pyx":1826 * if not is_leaf: * # is split node * res.pos = pos # <<<<<<<<<<<<<< @@ -13954,7 +15018,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_res->pos = __pyx_v_pos; - /* "sklearn/tree/_tree.pyx":1748 + /* "sklearn/tree/_tree.pyx":1827 * # is split node * res.pos = pos * res.is_leaf = 0 # <<<<<<<<<<<<<< @@ -13963,7 +15027,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_res->is_leaf = 0; - /* "sklearn/tree/_tree.pyx":1749 + /* "sklearn/tree/_tree.pyx":1828 * res.pos = pos * res.is_leaf = 0 * res.improvement = split_improvement # <<<<<<<<<<<<<< @@ -13975,7 +15039,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea } /*else*/ { - /* "sklearn/tree/_tree.pyx":1752 + /* "sklearn/tree/_tree.pyx":1831 * else: * # is leaf => 0 improvement * res.pos = end # <<<<<<<<<<<<<< @@ -13984,7 +15048,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_res->pos = __pyx_v_end; - /* "sklearn/tree/_tree.pyx":1753 + /* "sklearn/tree/_tree.pyx":1832 * # is leaf => 0 improvement * res.pos = end * res.is_leaf = 1 # <<<<<<<<<<<<<< @@ -13993,7 +15057,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea */ __pyx_v_res->is_leaf = 1; - /* "sklearn/tree/_tree.pyx":1754 + /* "sklearn/tree/_tree.pyx":1833 * res.pos = end * res.is_leaf = 1 * res.improvement = 0.0 # <<<<<<<<<<<<<< @@ -14004,7 +15068,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea } __pyx_L6:; - /* "sklearn/tree/_tree.pyx":1756 + /* "sklearn/tree/_tree.pyx":1835 * res.improvement = 0.0 * * return 0 # <<<<<<<<<<<<<< @@ -14014,12 +15078,20 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":1776 + * # Best first builder ---------------------------------------------------------- + * + * cdef int _add_split_node(Splitter splitter, Tree tree, # <<<<<<<<<<<<<< + * SIZE_t start, SIZE_t end, double impurity, + * bint is_first, bint is_left, Node* parent, + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1759 +/* "sklearn/tree/_tree.pyx":1838 * * * cdef int _add_to_frontier(PriorityHeapRecord* rec, PriorityHeap frontier) nogil: # <<<<<<<<<<<<<< @@ -14030,22 +15102,30 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_split_node(struct __pyx_obj_7sklea static int __pyx_f_7sklearn_4tree_5_tree__add_to_frontier(struct __pyx_t_7sklearn_4tree_6_utils_PriorityHeapRecord *__pyx_v_rec, struct __pyx_obj_7sklearn_4tree_6_utils_PriorityHeap *__pyx_v_frontier) { int __pyx_r; - /* "sklearn/tree/_tree.pyx":1762 + /* "sklearn/tree/_tree.pyx":1840 + * cdef int _add_to_frontier(PriorityHeapRecord* rec, PriorityHeap frontier) nogil: * """Adds record ``rec`` to the priority queue ``frontier``; returns -1 on memory-error. """ - * return frontier.push(rec.node_id, rec.start, rec.end, rec.pos, rec.depth, - * rec.is_leaf, rec.improvement, rec.impurity) # <<<<<<<<<<<<<< - * + * return frontier.push(rec.node_id, rec.start, rec.end, rec.pos, rec.depth, # <<<<<<<<<<<<<< + * rec.is_leaf, rec.improvement, rec.impurity) * */ __pyx_r = ((struct __pyx_vtabstruct_7sklearn_4tree_6_utils_PriorityHeap *)__pyx_v_frontier->__pyx_vtab)->push(__pyx_v_frontier, __pyx_v_rec->node_id, __pyx_v_rec->start, __pyx_v_rec->end, __pyx_v_rec->pos, __pyx_v_rec->depth, __pyx_v_rec->is_leaf, __pyx_v_rec->improvement, __pyx_v_rec->impurity); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":1838 + * + * + * cdef int _add_to_frontier(PriorityHeapRecord* rec, PriorityHeap frontier) nogil: # <<<<<<<<<<<<<< + * """Adds record ``rec`` to the priority queue ``frontier``; returns -1 on memory-error. """ + * return frontier.push(rec.node_id, rec.start, rec.end, rec.pos, rec.depth, + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1775 +/* "sklearn/tree/_tree.pyx":1854 * """ * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -14056,7 +15136,7 @@ static int __pyx_f_7sklearn_4tree_5_tree__add_to_frontier(struct __pyx_t_7sklear static PyObject *__pyx_pw_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_1build(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTHON_UNUSED struct __pyx_obj_7sklearn_4tree_5_tree_BestFirstTreeBuilder *__pyx_v_self, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_tree, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build *__pyx_optional_args) { - /* "sklearn/tree/_tree.pyx":1776 + /* "sklearn/tree/_tree.pyx":1855 * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, * np.ndarray sample_weight=None): # <<<<<<<<<<<<<< @@ -14104,7 +15184,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __Pyx_INCREF((PyObject *)__pyx_v_y); __Pyx_INCREF((PyObject *)__pyx_v_sample_weight); - /* "sklearn/tree/_tree.pyx":1775 + /* "sklearn/tree/_tree.pyx":1854 * """ * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -14115,11 +15195,11 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__build); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_build); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_1build)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_tree)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_tree)); @@ -14133,9 +15213,9 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __Pyx_INCREF(((PyObject *)__pyx_v_sample_weight)); PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_v_sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sample_weight)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -14144,82 +15224,82 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/tree/_tree.pyx":1779 + /* "sklearn/tree/_tree.pyx":1858 * """Build a decision tree from the training set (X, y).""" * # Check if dtype is correct * if X.dtype != DTYPE: # <<<<<<<<<<<<<< * # since we have to copy we will make it fortran for efficiency * X = np.asfortranarray(X, dtype=DTYPE) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_X), __pyx_n_s_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1781 + /* "sklearn/tree/_tree.pyx":1860 * if X.dtype != DTYPE: * # since we have to copy we will make it fortran for efficiency * X = np.asfortranarray(X, dtype=DTYPE) # <<<<<<<<<<<<<< * * if y.dtype != DOUBLE or not y.flags.contiguous: */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__asfortranarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asfortranarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_X, ((PyArrayObject *)__pyx_t_5)); __pyx_t_5 = 0; goto __pyx_L3; } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":1783 + /* "sklearn/tree/_tree.pyx":1862 * X = np.asfortranarray(X, dtype=DTYPE) * * if y.dtype != DOUBLE or not y.flags.contiguous: # <<<<<<<<<<<<<< * y = np.ascontiguousarray(y, dtype=DOUBLE) * */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s_dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__contiguous); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_contiguous); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = (!__pyx_t_6); __pyx_t_6 = __pyx_t_7; @@ -14228,42 +15308,42 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH } if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1784 + /* "sklearn/tree/_tree.pyx":1863 * * if y.dtype != DOUBLE or not y.flags.contiguous: * y = np.ascontiguousarray(y, dtype=DOUBLE) # <<<<<<<<<<<<<< * * cdef DOUBLE_t* sample_weight_ptr = NULL */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1863; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_y, ((PyArrayObject *)__pyx_t_3)); __pyx_t_3 = 0; goto __pyx_L4; } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":1786 + /* "sklearn/tree/_tree.pyx":1865 * y = np.ascontiguousarray(y, dtype=DOUBLE) * * cdef DOUBLE_t* sample_weight_ptr = NULL # <<<<<<<<<<<<<< @@ -14272,7 +15352,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_sample_weight_ptr = NULL; - /* "sklearn/tree/_tree.pyx":1787 + /* "sklearn/tree/_tree.pyx":1866 * * cdef DOUBLE_t* sample_weight_ptr = NULL * if sample_weight is not None: # <<<<<<<<<<<<<< @@ -14283,37 +15363,37 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = (__pyx_t_6 != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1788 + /* "sklearn/tree/_tree.pyx":1867 * cdef DOUBLE_t* sample_weight_ptr = NULL * if sample_weight is not None: * if ((sample_weight.dtype != DOUBLE) or # <<<<<<<<<<<<<< * (not sample_weight.flags.contiguous)): * sample_weight = np.asarray(sample_weight, */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s_dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1789 + /* "sklearn/tree/_tree.pyx":1868 * if sample_weight is not None: * if ((sample_weight.dtype != DOUBLE) or * (not sample_weight.flags.contiguous)): # <<<<<<<<<<<<<< * sample_weight = np.asarray(sample_weight, * dtype=DOUBLE, order="C") */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__contiguous); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_contiguous); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = (!__pyx_t_6); __pyx_t_6 = __pyx_t_7; @@ -14322,51 +15402,59 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH } if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1790 + /* "sklearn/tree/_tree.pyx":1869 * if ((sample_weight.dtype != DOUBLE) or * (not sample_weight.flags.contiguous)): * sample_weight = np.asarray(sample_weight, # <<<<<<<<<<<<<< * dtype=DOUBLE, order="C") * sample_weight_ptr = sample_weight.data */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_sample_weight)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sample_weight)); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); - /* "sklearn/tree/_tree.pyx":1791 + /* "sklearn/tree/_tree.pyx":1870 * (not sample_weight.flags.contiguous)): * sample_weight = np.asarray(sample_weight, * dtype=DOUBLE, order="C") # <<<<<<<<<<<<<< * sample_weight_ptr = sample_weight.data * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_s_C) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":1869 + * if ((sample_weight.dtype != DOUBLE) or + * (not sample_weight.flags.contiguous)): + * sample_weight = np.asarray(sample_weight, # <<<<<<<<<<<<<< + * dtype=DOUBLE, order="C") + * sample_weight_ptr = sample_weight.data + */ + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_sample_weight, ((PyArrayObject *)__pyx_t_2)); __pyx_t_2 = 0; goto __pyx_L6; } __pyx_L6:; - /* "sklearn/tree/_tree.pyx":1792 + /* "sklearn/tree/_tree.pyx":1871 * sample_weight = np.asarray(sample_weight, * dtype=DOUBLE, order="C") * sample_weight_ptr = sample_weight.data # <<<<<<<<<<<<<< @@ -14378,7 +15466,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH } __pyx_L5:; - /* "sklearn/tree/_tree.pyx":1795 + /* "sklearn/tree/_tree.pyx":1874 * * # Recursive partition (without actual recursion) * cdef Splitter splitter = tree.splitter # <<<<<<<<<<<<<< @@ -14390,7 +15478,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_v_splitter = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":1796 + /* "sklearn/tree/_tree.pyx":1875 * # Recursive partition (without actual recursion) * cdef Splitter splitter = tree.splitter * splitter.init(X, y, sample_weight_ptr) # <<<<<<<<<<<<<< @@ -14399,27 +15487,27 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter *)__pyx_v_splitter->__pyx_vtab)->init(__pyx_v_splitter, __pyx_v_X, __pyx_v_y, __pyx_v_sample_weight_ptr); - /* "sklearn/tree/_tree.pyx":1798 + /* "sklearn/tree/_tree.pyx":1877 * splitter.init(X, y, sample_weight_ptr) * * cdef PriorityHeap frontier = PriorityHeap(INITIAL_STACK_SIZE) # <<<<<<<<<<<<<< * cdef PriorityHeapRecord record * cdef PriorityHeapRecord split_node_left */ - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_7sklearn_4tree_5_tree_INITIAL_STACK_SIZE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_7sklearn_4tree_5_tree_INITIAL_STACK_SIZE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_6_utils_PriorityHeap)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_6_utils_PriorityHeap)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_frontier = ((struct __pyx_obj_7sklearn_4tree_6_utils_PriorityHeap *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":1803 + /* "sklearn/tree/_tree.pyx":1882 * cdef PriorityHeapRecord split_node_right * * cdef SIZE_t n_node_samples = splitter.n_samples # <<<<<<<<<<<<<< @@ -14429,7 +15517,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_8 = __pyx_v_splitter->n_samples; __pyx_v_n_node_samples = __pyx_t_8; - /* "sklearn/tree/_tree.pyx":1804 + /* "sklearn/tree/_tree.pyx":1883 * * cdef SIZE_t n_node_samples = splitter.n_samples * cdef int max_leaf_nodes = tree.max_leaf_nodes # <<<<<<<<<<<<<< @@ -14439,7 +15527,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_9 = __pyx_v_tree->max_leaf_nodes; __pyx_v_max_leaf_nodes = __pyx_t_9; - /* "sklearn/tree/_tree.pyx":1805 + /* "sklearn/tree/_tree.pyx":1884 * cdef SIZE_t n_node_samples = splitter.n_samples * cdef int max_leaf_nodes = tree.max_leaf_nodes * cdef int max_split_nodes = max_leaf_nodes - 1 # <<<<<<<<<<<<<< @@ -14448,7 +15536,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_max_split_nodes = (__pyx_v_max_leaf_nodes - 1); - /* "sklearn/tree/_tree.pyx":1807 + /* "sklearn/tree/_tree.pyx":1886 * cdef int max_split_nodes = max_leaf_nodes - 1 * cdef bint is_leaf * cdef SIZE_t max_depth_seen = -1 # <<<<<<<<<<<<<< @@ -14457,7 +15545,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_max_depth_seen = -1; - /* "sklearn/tree/_tree.pyx":1808 + /* "sklearn/tree/_tree.pyx":1887 * cdef bint is_leaf * cdef SIZE_t max_depth_seen = -1 * cdef int rc = 0 # <<<<<<<<<<<<<< @@ -14466,7 +15554,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_rc = 0; - /* "sklearn/tree/_tree.pyx":1812 + /* "sklearn/tree/_tree.pyx":1891 * * # Initial capacity * cdef int init_capacity = max_split_nodes + max_leaf_nodes # <<<<<<<<<<<<<< @@ -14475,7 +15563,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_init_capacity = (__pyx_v_max_split_nodes + __pyx_v_max_leaf_nodes); - /* "sklearn/tree/_tree.pyx":1813 + /* "sklearn/tree/_tree.pyx":1892 * # Initial capacity * cdef int init_capacity = max_split_nodes + max_leaf_nodes * tree._resize(init_capacity) # <<<<<<<<<<<<<< @@ -14484,7 +15572,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_tree->__pyx_vtab)->_resize(__pyx_v_tree, __pyx_v_init_capacity); - /* "sklearn/tree/_tree.pyx":1815 + /* "sklearn/tree/_tree.pyx":1894 * tree._resize(init_capacity) * * with nogil: # <<<<<<<<<<<<<< @@ -14498,16 +15586,16 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH #endif /*try:*/ { - /* "sklearn/tree/_tree.pyx":1819 - * rc = _add_split_node(splitter, tree, + /* "sklearn/tree/_tree.pyx":1896 + * with nogil: + * # add root to frontier + * rc = _add_split_node(splitter, tree, # <<<<<<<<<<<<<< * 0, n_node_samples, INFINITY, IS_FIRST, - * IS_LEFT, NULL, 0, &split_node_left) # <<<<<<<<<<<<<< - * if rc >= 0: - * rc = _add_to_frontier(&split_node_left, frontier) + * IS_LEFT, NULL, 0, &split_node_left) */ __pyx_v_rc = __pyx_f_7sklearn_4tree_5_tree__add_split_node(__pyx_v_splitter, __pyx_v_tree, 0, __pyx_v_n_node_samples, __pyx_v_7sklearn_4tree_5_tree_INFINITY, __pyx_v_7sklearn_4tree_5_tree_IS_FIRST, __pyx_v_7sklearn_4tree_5_tree_IS_LEFT, NULL, 0, (&__pyx_v_split_node_left)); - /* "sklearn/tree/_tree.pyx":1820 + /* "sklearn/tree/_tree.pyx":1899 * 0, n_node_samples, INFINITY, IS_FIRST, * IS_LEFT, NULL, 0, &split_node_left) * if rc >= 0: # <<<<<<<<<<<<<< @@ -14517,7 +15605,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_6 = ((__pyx_v_rc >= 0) != 0); if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1821 + /* "sklearn/tree/_tree.pyx":1900 * IS_LEFT, NULL, 0, &split_node_left) * if rc >= 0: * rc = _add_to_frontier(&split_node_left, frontier) # <<<<<<<<<<<<<< @@ -14530,7 +15618,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_L10:; } - /* "sklearn/tree/_tree.pyx":1815 + /* "sklearn/tree/_tree.pyx":1894 * tree._resize(init_capacity) * * with nogil: # <<<<<<<<<<<<<< @@ -14538,13 +15626,17 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH * rc = _add_split_node(splitter, tree, */ /*finally:*/ { - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L9; + } + __pyx_L9:; } } - /* "sklearn/tree/_tree.pyx":1822 + /* "sklearn/tree/_tree.pyx":1901 * if rc >= 0: * rc = _add_to_frontier(&split_node_left, frontier) * if rc == -1: # <<<<<<<<<<<<<< @@ -14554,19 +15646,17 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_6 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1823 + /* "sklearn/tree/_tree.pyx":1902 * rc = _add_to_frontier(&split_node_left, frontier) * if rc == -1: * raise MemoryError() # <<<<<<<<<<<<<< * * with nogil: */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L11; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; - /* "sklearn/tree/_tree.pyx":1825 + /* "sklearn/tree/_tree.pyx":1904 * raise MemoryError() * * with nogil: # <<<<<<<<<<<<<< @@ -14580,7 +15670,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH #endif /*try:*/ { - /* "sklearn/tree/_tree.pyx":1826 + /* "sklearn/tree/_tree.pyx":1905 * * with nogil: * while not frontier.is_empty(): # <<<<<<<<<<<<<< @@ -14591,7 +15681,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_6 = ((!(((struct __pyx_vtabstruct_7sklearn_4tree_6_utils_PriorityHeap *)__pyx_v_frontier->__pyx_vtab)->is_empty(__pyx_v_frontier) != 0)) != 0); if (!__pyx_t_6) break; - /* "sklearn/tree/_tree.pyx":1827 + /* "sklearn/tree/_tree.pyx":1906 * with nogil: * while not frontier.is_empty(): * frontier.pop(&record) # <<<<<<<<<<<<<< @@ -14600,7 +15690,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ ((struct __pyx_vtabstruct_7sklearn_4tree_6_utils_PriorityHeap *)__pyx_v_frontier->__pyx_vtab)->pop(__pyx_v_frontier, (&__pyx_v_record)); - /* "sklearn/tree/_tree.pyx":1829 + /* "sklearn/tree/_tree.pyx":1908 * frontier.pop(&record) * * node = &tree.nodes[record.node_id] # <<<<<<<<<<<<<< @@ -14609,7 +15699,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_node = (&(__pyx_v_tree->nodes[__pyx_v_record.node_id])); - /* "sklearn/tree/_tree.pyx":1830 + /* "sklearn/tree/_tree.pyx":1909 * * node = &tree.nodes[record.node_id] * is_leaf = (record.is_leaf or max_split_nodes <= 0) # <<<<<<<<<<<<<< @@ -14624,7 +15714,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH } __pyx_v_is_leaf = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1832 + /* "sklearn/tree/_tree.pyx":1911 * is_leaf = (record.is_leaf or max_split_nodes <= 0) * * if is_leaf: # <<<<<<<<<<<<<< @@ -14634,7 +15724,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = (__pyx_v_is_leaf != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1834 + /* "sklearn/tree/_tree.pyx":1913 * if is_leaf: * # Node is not expandable; set node as leaf * node.left_child = _TREE_LEAF # <<<<<<<<<<<<<< @@ -14643,7 +15733,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_node->left_child = __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF; - /* "sklearn/tree/_tree.pyx":1835 + /* "sklearn/tree/_tree.pyx":1914 * # Node is not expandable; set node as leaf * node.left_child = _TREE_LEAF * node.right_child = _TREE_LEAF # <<<<<<<<<<<<<< @@ -14652,7 +15742,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_node->right_child = __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF; - /* "sklearn/tree/_tree.pyx":1836 + /* "sklearn/tree/_tree.pyx":1915 * node.left_child = _TREE_LEAF * node.right_child = _TREE_LEAF * node.feature = _TREE_UNDEFINED # <<<<<<<<<<<<<< @@ -14661,7 +15751,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_node->feature = __pyx_v_7sklearn_4tree_5_tree__TREE_UNDEFINED; - /* "sklearn/tree/_tree.pyx":1837 + /* "sklearn/tree/_tree.pyx":1916 * node.right_child = _TREE_LEAF * node.feature = _TREE_UNDEFINED * node.threshold = _TREE_UNDEFINED # <<<<<<<<<<<<<< @@ -14673,7 +15763,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH } /*else*/ { - /* "sklearn/tree/_tree.pyx":1843 + /* "sklearn/tree/_tree.pyx":1922 * * # Decrement number of split nodes available * max_split_nodes -= 1 # <<<<<<<<<<<<<< @@ -14682,16 +15772,16 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_max_split_nodes = (__pyx_v_max_split_nodes - 1); - /* "sklearn/tree/_tree.pyx":1850 + /* "sklearn/tree/_tree.pyx":1925 + * + * # Compute left split node + * rc = _add_split_node(splitter, tree, # <<<<<<<<<<<<<< + * record.start, record.pos, * record.impurity, IS_NOT_FIRST, - * IS_LEFT, node, record.depth + 1, - * &split_node_left) # <<<<<<<<<<<<<< - * if rc == -1: - * break */ __pyx_v_rc = __pyx_f_7sklearn_4tree_5_tree__add_split_node(__pyx_v_splitter, __pyx_v_tree, __pyx_v_record.start, __pyx_v_record.pos, __pyx_v_record.impurity, __pyx_v_7sklearn_4tree_5_tree_IS_NOT_FIRST, __pyx_v_7sklearn_4tree_5_tree_IS_LEFT, __pyx_v_node, (__pyx_v_record.depth + 1), (&__pyx_v_split_node_left)); - /* "sklearn/tree/_tree.pyx":1851 + /* "sklearn/tree/_tree.pyx":1930 * IS_LEFT, node, record.depth + 1, * &split_node_left) * if rc == -1: # <<<<<<<<<<<<<< @@ -14701,7 +15791,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1852 + /* "sklearn/tree/_tree.pyx":1931 * &split_node_left) * if rc == -1: * break # <<<<<<<<<<<<<< @@ -14709,11 +15799,9 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH * # tree.nodes may have changed */ goto __pyx_L16_break; - goto __pyx_L18; } - __pyx_L18:; - /* "sklearn/tree/_tree.pyx":1855 + /* "sklearn/tree/_tree.pyx":1934 * * # tree.nodes may have changed * node = &tree.nodes[record.node_id] # <<<<<<<<<<<<<< @@ -14722,16 +15810,16 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_node = (&(__pyx_v_tree->nodes[__pyx_v_record.node_id])); - /* "sklearn/tree/_tree.pyx":1861 + /* "sklearn/tree/_tree.pyx":1937 + * + * # Compute right split node + * rc = _add_split_node(splitter, tree, record.pos, # <<<<<<<<<<<<<< * record.end, record.impurity, * IS_NOT_FIRST, IS_NOT_LEFT, node, - * record.depth + 1, &split_node_right) # <<<<<<<<<<<<<< - * if rc == -1: - * break */ __pyx_v_rc = __pyx_f_7sklearn_4tree_5_tree__add_split_node(__pyx_v_splitter, __pyx_v_tree, __pyx_v_record.pos, __pyx_v_record.end, __pyx_v_record.impurity, __pyx_v_7sklearn_4tree_5_tree_IS_NOT_FIRST, __pyx_v_7sklearn_4tree_5_tree_IS_NOT_LEFT, __pyx_v_node, (__pyx_v_record.depth + 1), (&__pyx_v_split_node_right)); - /* "sklearn/tree/_tree.pyx":1862 + /* "sklearn/tree/_tree.pyx":1941 * IS_NOT_FIRST, IS_NOT_LEFT, node, * record.depth + 1, &split_node_right) * if rc == -1: # <<<<<<<<<<<<<< @@ -14741,7 +15829,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1863 + /* "sklearn/tree/_tree.pyx":1942 * record.depth + 1, &split_node_right) * if rc == -1: * break # <<<<<<<<<<<<<< @@ -14749,11 +15837,9 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH * # Add nodes to queue */ goto __pyx_L16_break; - goto __pyx_L19; } - __pyx_L19:; - /* "sklearn/tree/_tree.pyx":1866 + /* "sklearn/tree/_tree.pyx":1945 * * # Add nodes to queue * rc = _add_to_frontier(&split_node_left, frontier) # <<<<<<<<<<<<<< @@ -14762,7 +15848,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_rc = __pyx_f_7sklearn_4tree_5_tree__add_to_frontier((&__pyx_v_split_node_left), __pyx_v_frontier); - /* "sklearn/tree/_tree.pyx":1867 + /* "sklearn/tree/_tree.pyx":1946 * # Add nodes to queue * rc = _add_to_frontier(&split_node_left, frontier) * if rc == -1: # <<<<<<<<<<<<<< @@ -14772,7 +15858,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1868 + /* "sklearn/tree/_tree.pyx":1947 * rc = _add_to_frontier(&split_node_left, frontier) * if rc == -1: * break # <<<<<<<<<<<<<< @@ -14780,11 +15866,9 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH * rc = _add_to_frontier(&split_node_right, frontier) */ goto __pyx_L16_break; - goto __pyx_L20; } - __pyx_L20:; - /* "sklearn/tree/_tree.pyx":1870 + /* "sklearn/tree/_tree.pyx":1949 * break * * rc = _add_to_frontier(&split_node_right, frontier) # <<<<<<<<<<<<<< @@ -14793,7 +15877,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH */ __pyx_v_rc = __pyx_f_7sklearn_4tree_5_tree__add_to_frontier((&__pyx_v_split_node_right), __pyx_v_frontier); - /* "sklearn/tree/_tree.pyx":1871 + /* "sklearn/tree/_tree.pyx":1950 * * rc = _add_to_frontier(&split_node_right, frontier) * if rc == -1: # <<<<<<<<<<<<<< @@ -14803,7 +15887,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1872 + /* "sklearn/tree/_tree.pyx":1951 * rc = _add_to_frontier(&split_node_right, frontier) * if rc == -1: * break # <<<<<<<<<<<<<< @@ -14811,13 +15895,11 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH * if record.depth > max_depth_seen: */ goto __pyx_L16_break; - goto __pyx_L21; } - __pyx_L21:; } __pyx_L17:; - /* "sklearn/tree/_tree.pyx":1874 + /* "sklearn/tree/_tree.pyx":1953 * break * * if record.depth > max_depth_seen: # <<<<<<<<<<<<<< @@ -14827,7 +15909,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = ((__pyx_v_record.depth > __pyx_v_max_depth_seen) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1875 + /* "sklearn/tree/_tree.pyx":1954 * * if record.depth > max_depth_seen: * max_depth_seen = record.depth # <<<<<<<<<<<<<< @@ -14842,7 +15924,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH } __pyx_L16_break:; - /* "sklearn/tree/_tree.pyx":1877 + /* "sklearn/tree/_tree.pyx":1956 * max_depth_seen = record.depth * * if rc >= 0: # <<<<<<<<<<<<<< @@ -14852,7 +15934,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = ((__pyx_v_rc >= 0) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1878 + /* "sklearn/tree/_tree.pyx":1957 * * if rc >= 0: * rc = tree._resize_c(tree.node_count) # <<<<<<<<<<<<<< @@ -14867,7 +15949,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH } __pyx_L23:; - /* "sklearn/tree/_tree.pyx":1879 + /* "sklearn/tree/_tree.pyx":1958 * if rc >= 0: * rc = tree._resize_c(tree.node_count) * if rc >= 0: # <<<<<<<<<<<<<< @@ -14877,7 +15959,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = ((__pyx_v_rc >= 0) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1880 + /* "sklearn/tree/_tree.pyx":1959 * rc = tree._resize_c(tree.node_count) * if rc >= 0: * tree.max_depth = max_depth_seen # <<<<<<<<<<<<<< @@ -14890,7 +15972,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_L24:; } - /* "sklearn/tree/_tree.pyx":1825 + /* "sklearn/tree/_tree.pyx":1904 * raise MemoryError() * * with nogil: # <<<<<<<<<<<<<< @@ -14898,13 +15980,17 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH * frontier.pop(&record) */ /*finally:*/ { - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L14; + } + __pyx_L14:; } } - /* "sklearn/tree/_tree.pyx":1882 + /* "sklearn/tree/_tree.pyx":1961 * tree.max_depth = max_depth_seen * * if rc == -1: # <<<<<<<<<<<<<< @@ -14914,19 +16000,17 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __pyx_t_4 = ((__pyx_v_rc == -1) != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1883 + /* "sklearn/tree/_tree.pyx":1962 * * if rc == -1: * raise MemoryError() # <<<<<<<<<<<<<< * * # release memory */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L25; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L25:; - /* "sklearn/tree/_tree.pyx":1886 + /* "sklearn/tree/_tree.pyx":1965 * * # release memory * tree.splitter = None # <<<<<<<<<<<<<< @@ -14939,6 +16023,15 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(CYTH __Pyx_DECREF(((PyObject *)__pyx_v_tree->splitter)); __pyx_v_tree->splitter = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)Py_None); + /* "sklearn/tree/_tree.pyx":1854 + * """ + * + * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< + * np.ndarray sample_weight=None): + * """Build a decision tree from the training set (X, y).""" + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -14974,10 +16067,10 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_1build(Py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("build (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__tree,&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__sample_weight,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tree,&__pyx_n_s_X,&__pyx_n_s_y,&__pyx_n_s_sample_weight,0}; PyObject* values[4] = {0,0,0,0}; - /* "sklearn/tree/_tree.pyx":1776 + /* "sklearn/tree/_tree.pyx":1855 * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, * np.ndarray sample_weight=None): # <<<<<<<<<<<<<< @@ -14999,26 +16092,26 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_1build(Py kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tree)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tree)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_weight); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample_weight); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "build") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "build") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -15037,26 +16130,19 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_1build(Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree.BestFirstTreeBuilder.build", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_7sklearn_4tree_5_tree_Tree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_weight), __pyx_ptype_5numpy_ndarray, 1, "sample_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_7sklearn_4tree_5_tree_Tree, 1, "tree", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_weight), __pyx_ptype_5numpy_ndarray, 1, "sample_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(((struct __pyx_obj_7sklearn_4tree_5_tree_BestFirstTreeBuilder *)__pyx_v_self), __pyx_v_tree, __pyx_v_X, __pyx_v_y, __pyx_v_sample_weight); - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} -/* "sklearn/tree/_tree.pyx":1775 + /* "sklearn/tree/_tree.pyx":1854 * """ * * cpdef build(self, Tree tree, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -15064,6 +16150,15 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_1build(Py * """Build a decision tree from the training set (X, y).""" */ + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + static PyObject *__pyx_pf_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(struct __pyx_obj_7sklearn_4tree_5_tree_BestFirstTreeBuilder *__pyx_v_self, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_tree, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_sample_weight) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15076,14 +16171,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(str __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.sample_weight = __pyx_v_sample_weight; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_BestFirstTreeBuilder *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.build(((struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *)__pyx_v_self), __pyx_v_tree, __pyx_v_X, __pyx_v_y, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_BestFirstTreeBuilder *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.build(((struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *)__pyx_v_self), __pyx_v_tree, __pyx_v_X, __pyx_v_y, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.BestFirstTreeBuilder.build", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -15094,6 +16188,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build(str return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2024 + * # (i.e. through `_resize` or `__setstate__`) + * property n_classes: + * def __get__(self): # <<<<<<<<<<<<<< + * # it's small; copy for memory safety + * return sizet_ptr_to_ndarray(self.n_classes, self.n_outputs).copy() + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9n_classes_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9n_classes_1__get__(PyObject *__pyx_v_self) { @@ -15101,18 +16203,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9n_classes_1__get__(PyObje __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_classes___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1945 - * # (i.e. through `_resize` or `__setstate__`) - * property n_classes: - * def __get__(self): # <<<<<<<<<<<<<< - * # it's small; copy for memory safety - * return sizet_ptr_to_ndarray(self.n_classes, self.n_outputs).copy() - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_classes___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15123,7 +16219,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_classes___get__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":1947 + /* "sklearn/tree/_tree.pyx":2026 * def __get__(self): * # it's small; copy for memory safety * return sizet_ptr_to_ndarray(self.n_classes, self.n_outputs).copy() # <<<<<<<<<<<<<< @@ -15131,20 +16227,27 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_classes___get__(struct * property children_left: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_ndarray(__pyx_v_self->n_classes, __pyx_v_self->n_outputs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_ndarray(__pyx_v_self->n_classes, __pyx_v_self->n_outputs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2024 + * # (i.e. through `_resize` or `__setstate__`) + * property n_classes: + * def __get__(self): # <<<<<<<<<<<<<< + * # it's small; copy for memory safety + * return sizet_ptr_to_ndarray(self.n_classes, self.n_outputs).copy() + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -15156,6 +16259,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_classes___get__(struct return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2029 + * + * property children_left: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['left_child'][:self.node_count] + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13children_left_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13children_left_1__get__(PyObject *__pyx_v_self) { @@ -15163,18 +16274,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13children_left_1__get__(P __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_13children_left___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1950 - * - * property children_left: - * def __get__(self): # <<<<<<<<<<<<<< - * return self._get_node_ndarray()['left_child'][:self.node_count] - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_13children_left___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15185,7 +16290,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_13children_left___get__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":1951 + /* "sklearn/tree/_tree.pyx":2030 * property children_left: * def __get__(self): * return self._get_node_ndarray()['left_child'][:self.node_count] # <<<<<<<<<<<<<< @@ -15193,20 +16298,27 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_13children_left___get__(st * property children_right: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__left_child)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_left_child); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2029 + * + * property children_left: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['left_child'][:self.node_count] + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -15218,6 +16330,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_13children_left___get__(st return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2033 + * + * property children_right: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['right_child'][:self.node_count] + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14children_right_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14children_right_1__get__(PyObject *__pyx_v_self) { @@ -15225,18 +16345,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14children_right_1__get__( __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_14children_right___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1954 - * - * property children_right: - * def __get__(self): # <<<<<<<<<<<<<< - * return self._get_node_ndarray()['right_child'][:self.node_count] - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14children_right___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15247,7 +16361,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14children_right___get__(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":1955 + /* "sklearn/tree/_tree.pyx":2034 * property children_right: * def __get__(self): * return self._get_node_ndarray()['right_child'][:self.node_count] # <<<<<<<<<<<<<< @@ -15255,20 +16369,27 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14children_right___get__(s * property feature: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__right_child)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_right_child); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1955; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2033 + * + * property children_right: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['right_child'][:self.node_count] + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -15280,6 +16401,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14children_right___get__(s return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2037 + * + * property feature: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['feature'][:self.node_count] + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_7feature_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_7feature_1__get__(PyObject *__pyx_v_self) { @@ -15287,18 +16416,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_7feature_1__get__(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_7feature___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1958 - * - * property feature: - * def __get__(self): # <<<<<<<<<<<<<< - * return self._get_node_ndarray()['feature'][:self.node_count] - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_7feature___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15309,7 +16432,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_7feature___get__(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":1959 + /* "sklearn/tree/_tree.pyx":2038 * property feature: * def __get__(self): * return self._get_node_ndarray()['feature'][:self.node_count] # <<<<<<<<<<<<<< @@ -15317,20 +16440,27 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_7feature___get__(struct __ * property threshold: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__feature)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_feature); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2037 + * + * property feature: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['feature'][:self.node_count] + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -15342,6 +16472,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_7feature___get__(struct __ return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2041 + * + * property threshold: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['threshold'][:self.node_count] + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9threshold_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9threshold_1__get__(PyObject *__pyx_v_self) { @@ -15349,18 +16487,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9threshold_1__get__(PyObje __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_9threshold___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1962 - * - * property threshold: - * def __get__(self): # <<<<<<<<<<<<<< - * return self._get_node_ndarray()['threshold'][:self.node_count] - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9threshold___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15371,7 +16503,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9threshold___get__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":1963 + /* "sklearn/tree/_tree.pyx":2042 * property threshold: * def __get__(self): * return self._get_node_ndarray()['threshold'][:self.node_count] # <<<<<<<<<<<<<< @@ -15379,20 +16511,27 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9threshold___get__(struct * property impurity: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__threshold)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_threshold); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1963; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2041 + * + * property threshold: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['threshold'][:self.node_count] + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -15404,6 +16543,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9threshold___get__(struct return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2045 + * + * property impurity: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['impurity'][:self.node_count] + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_8impurity_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_8impurity_1__get__(PyObject *__pyx_v_self) { @@ -15411,18 +16558,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_8impurity_1__get__(PyObjec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_8impurity___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1966 - * - * property impurity: - * def __get__(self): # <<<<<<<<<<<<<< - * return self._get_node_ndarray()['impurity'][:self.node_count] - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8impurity___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15433,7 +16574,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8impurity___get__(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":1967 + /* "sklearn/tree/_tree.pyx":2046 * property impurity: * def __get__(self): * return self._get_node_ndarray()['impurity'][:self.node_count] # <<<<<<<<<<<<<< @@ -15441,24 +16582,31 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8impurity___get__(struct _ * property n_node_samples: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__impurity)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_impurity); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("sklearn.tree._tree.Tree.impurity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + /* "sklearn/tree/_tree.pyx":2045 + * + * property impurity: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['impurity'][:self.node_count] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("sklearn.tree._tree.Tree.impurity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -15466,6 +16614,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8impurity___get__(struct _ return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2049 + * + * property n_node_samples: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['n_samples'][:self.node_count] + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14n_node_samples_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14n_node_samples_1__get__(PyObject *__pyx_v_self) { @@ -15473,18 +16629,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14n_node_samples_1__get__( __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_14n_node_samples___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1970 - * - * property n_node_samples: - * def __get__(self): # <<<<<<<<<<<<<< - * return self._get_node_ndarray()['n_samples'][:self.node_count] - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14n_node_samples___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15495,7 +16645,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14n_node_samples___get__(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":1971 + /* "sklearn/tree/_tree.pyx":2050 * property n_node_samples: * def __get__(self): * return self._get_node_ndarray()['n_samples'][:self.node_count] # <<<<<<<<<<<<<< @@ -15503,20 +16653,27 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14n_node_samples___get__(s * property value: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__n_samples)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_n_samples); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1971; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2049 + * + * property n_node_samples: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_node_ndarray()['n_samples'][:self.node_count] + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -15528,6 +16685,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14n_node_samples___get__(s return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2053 + * + * property value: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_value_ndarray()[:self.node_count] + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_5value_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_5value_1__get__(PyObject *__pyx_v_self) { @@ -15535,18 +16700,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_5value_1__get__(PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_5value___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1974 - * - * property value: - * def __get__(self): # <<<<<<<<<<<<<< - * return self._get_value_ndarray()[:self.node_count] - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_5value___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -15557,7 +16716,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_5value___get__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":1975 + /* "sklearn/tree/_tree.pyx":2054 * property value: * def __get__(self): * return self._get_value_ndarray()[:self.node_count] # <<<<<<<<<<<<<< @@ -15565,17 +16724,24 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_5value___get__(struct __py * def __cinit__(self, int n_features, np.ndarray[SIZE_t, ndim=1] n_classes, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_value_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_value_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_t_1, 0, __pyx_v_self->node_count, NULL, NULL, NULL, 0, 1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2053 + * + * property value: + * def __get__(self): # <<<<<<<<<<<<<< + * return self._get_value_ndarray()[:self.node_count] + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -15587,6 +16753,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_5value___get__(struct __py return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2056 + * return self._get_value_ndarray()[:self.node_count] + * + * def __cinit__(self, int n_features, np.ndarray[SIZE_t, ndim=1] n_classes, # <<<<<<<<<<<<<< + * int n_outputs, Splitter splitter, SIZE_t max_depth, + * SIZE_t min_samples_split, SIZE_t min_samples_leaf, + */ + /* Python wrapper */ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { @@ -15606,7 +16780,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_1__cinit__(PyObject *__pyx_v_sel __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_features,&__pyx_n_s__n_classes,&__pyx_n_s__n_outputs,&__pyx_n_s__splitter,&__pyx_n_s__max_depth,&__pyx_n_s__min_samples_split,&__pyx_n_s__min_samples_leaf,&__pyx_n_s__max_leaf_nodes,&__pyx_n_s__random_state,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n_features,&__pyx_n_s_n_classes,&__pyx_n_s_n_outputs,&__pyx_n_s_splitter,&__pyx_n_s_max_depth,&__pyx_n_s_min_samples_split,&__pyx_n_s_min_samples_leaf,&__pyx_n_s_max_leaf_nodes,&__pyx_n_s_random_state,0}; PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -15627,51 +16801,51 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_1__cinit__(PyObject *__pyx_v_sel kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_features)) != 0)) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n_features)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_classes)) != 0)) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n_classes)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_outputs)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n_outputs)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__splitter)) != 0)) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_splitter)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_depth)) != 0)) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_depth)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_samples_split)) != 0)) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_samples_split)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: - if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_samples_leaf)) != 0)) kw_args--; + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_samples_leaf)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: - if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_leaf_nodes)) != 0)) kw_args--; + if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_leaf_nodes)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: - if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__random_state)) != 0)) kw_args--; + if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { goto __pyx_L5_argtuple_error; @@ -15686,27 +16860,29 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_1__cinit__(PyObject *__pyx_v_sel values[7] = PyTuple_GET_ITEM(__pyx_args, 7); values[8] = PyTuple_GET_ITEM(__pyx_args, 8); } - __pyx_v_n_features = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_features = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_n_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_n_classes = ((PyArrayObject *)values[1]); - __pyx_v_n_outputs = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_n_outputs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_outputs = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_n_outputs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_splitter = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)values[3]); - __pyx_v_max_depth = __Pyx_PyInt_from_py_Py_intptr_t(values[4]); if (unlikely((__pyx_v_max_depth == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_min_samples_split = __Pyx_PyInt_from_py_Py_intptr_t(values[5]); if (unlikely((__pyx_v_min_samples_split == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_min_samples_leaf = __Pyx_PyInt_from_py_Py_intptr_t(values[6]); if (unlikely((__pyx_v_min_samples_leaf == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1979; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_max_leaf_nodes = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_max_leaf_nodes == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1980; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_depth = __Pyx_PyInt_As_Py_intptr_t(values[4]); if (unlikely((__pyx_v_max_depth == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_min_samples_split = __Pyx_PyInt_As_Py_intptr_t(values[5]); if (unlikely((__pyx_v_min_samples_split == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_min_samples_leaf = __Pyx_PyInt_As_Py_intptr_t(values[6]); if (unlikely((__pyx_v_min_samples_leaf == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_leaf_nodes = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_max_leaf_nodes == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_random_state = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree.Tree.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n_classes), __pyx_ptype_5numpy_ndarray, 1, "n_classes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_splitter), __pyx_ptype_7sklearn_4tree_5_tree_Splitter, 1, "splitter", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n_classes), __pyx_ptype_5numpy_ndarray, 1, "n_classes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_splitter), __pyx_ptype_7sklearn_4tree_5_tree_Splitter, 1, "splitter", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), __pyx_v_n_features, __pyx_v_n_classes, __pyx_v_n_outputs, __pyx_v_splitter, __pyx_v_max_depth, __pyx_v_min_samples_split, __pyx_v_min_samples_leaf, __pyx_v_max_leaf_nodes, __pyx_v_random_state); + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -15715,14 +16891,6 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_1__cinit__(PyObject *__pyx_v_sel return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1977 - * return self._get_value_ndarray()[:self.node_count] - * - * def __cinit__(self, int n_features, np.ndarray[SIZE_t, ndim=1] n_classes, # <<<<<<<<<<<<<< - * int n_outputs, Splitter splitter, SIZE_t max_depth, - * SIZE_t min_samples_split, SIZE_t min_samples_leaf, - */ - static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self, int __pyx_v_n_features, PyArrayObject *__pyx_v_n_classes, int __pyx_v_n_outputs, struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *__pyx_v_splitter, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_max_depth, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_min_samples_split, __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_min_samples_leaf, int __pyx_v_max_leaf_nodes, PyObject *__pyx_v_random_state) { __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_k; __Pyx_LocalBuf_ND __pyx_pybuffernd_n_classes; @@ -15746,11 +16914,11 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle __pyx_pybuffernd_n_classes.rcbuffer = &__pyx_pybuffer_n_classes; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n_classes.rcbuffer->pybuffer, (PyObject*)__pyx_v_n_classes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_SIZE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n_classes.rcbuffer->pybuffer, (PyObject*)__pyx_v_n_classes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_SIZE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_n_classes.diminfo[0].strides = __pyx_pybuffernd_n_classes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n_classes.diminfo[0].shape = __pyx_pybuffernd_n_classes.rcbuffer->pybuffer.shape[0]; - /* "sklearn/tree/_tree.pyx":1983 + /* "sklearn/tree/_tree.pyx":2062 * """Constructor.""" * # Inner structures * self.node_count = 0 # <<<<<<<<<<<<<< @@ -15759,7 +16927,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->node_count = 0; - /* "sklearn/tree/_tree.pyx":1984 + /* "sklearn/tree/_tree.pyx":2063 * # Inner structures * self.node_count = 0 * self.capacity = 0 # <<<<<<<<<<<<<< @@ -15768,7 +16936,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->capacity = 0; - /* "sklearn/tree/_tree.pyx":1985 + /* "sklearn/tree/_tree.pyx":2064 * self.node_count = 0 * self.capacity = 0 * self.value = NULL # <<<<<<<<<<<<<< @@ -15777,7 +16945,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->value = NULL; - /* "sklearn/tree/_tree.pyx":1988 + /* "sklearn/tree/_tree.pyx":2067 * * # Input/Output layout * self.n_features = n_features # <<<<<<<<<<<<<< @@ -15786,7 +16954,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->n_features = __pyx_v_n_features; - /* "sklearn/tree/_tree.pyx":1989 + /* "sklearn/tree/_tree.pyx":2068 * # Input/Output layout * self.n_features = n_features * self.n_outputs = n_outputs # <<<<<<<<<<<<<< @@ -15795,7 +16963,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->n_outputs = __pyx_v_n_outputs; - /* "sklearn/tree/_tree.pyx":1990 + /* "sklearn/tree/_tree.pyx":2069 * self.n_features = n_features * self.n_outputs = n_outputs * self.n_classes = malloc(n_outputs * sizeof(SIZE_t)) # <<<<<<<<<<<<<< @@ -15804,7 +16972,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->n_classes = ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t *)malloc((__pyx_v_n_outputs * (sizeof(__pyx_t_7sklearn_4tree_5_tree_SIZE_t))))); - /* "sklearn/tree/_tree.pyx":1992 + /* "sklearn/tree/_tree.pyx":2071 * self.n_classes = malloc(n_outputs * sizeof(SIZE_t)) * * if self.n_classes == NULL: # <<<<<<<<<<<<<< @@ -15814,44 +16982,42 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle __pyx_t_1 = ((__pyx_v_self->n_classes == NULL) != 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1993 + /* "sklearn/tree/_tree.pyx":2072 * * if self.n_classes == NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * self.max_n_classes = np.max(n_classes) */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1993; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/tree/_tree.pyx":1995 + /* "sklearn/tree/_tree.pyx":2074 * raise MemoryError() * * self.max_n_classes = np.max(n_classes) # <<<<<<<<<<<<<< * self.value_stride = n_outputs * self.max_n_classes * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_n_classes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_n_classes)); __Pyx_GIVEREF(((PyObject *)__pyx_v_n_classes)); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1995; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_self->max_n_classes = __pyx_t_5; - /* "sklearn/tree/_tree.pyx":1996 + /* "sklearn/tree/_tree.pyx":2075 * * self.max_n_classes = np.max(n_classes) * self.value_stride = n_outputs * self.max_n_classes # <<<<<<<<<<<<<< @@ -15860,7 +17026,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->value_stride = (__pyx_v_n_outputs * __pyx_v_self->max_n_classes); - /* "sklearn/tree/_tree.pyx":2000 + /* "sklearn/tree/_tree.pyx":2079 * cdef SIZE_t k * * for k in range(n_outputs): # <<<<<<<<<<<<<< @@ -15871,7 +17037,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5+=1) { __pyx_v_k = __pyx_t_5; - /* "sklearn/tree/_tree.pyx":2001 + /* "sklearn/tree/_tree.pyx":2080 * * for k in range(n_outputs): * self.n_classes[k] = n_classes[k] # <<<<<<<<<<<<<< @@ -15882,7 +17048,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle (__pyx_v_self->n_classes[__pyx_v_k]) = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_pybuffernd_n_classes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_n_classes.diminfo[0].strides)); } - /* "sklearn/tree/_tree.pyx":2004 + /* "sklearn/tree/_tree.pyx":2083 * * # Parameters * self.splitter = splitter # <<<<<<<<<<<<<< @@ -15895,7 +17061,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle __Pyx_DECREF(((PyObject *)__pyx_v_self->splitter)); __pyx_v_self->splitter = __pyx_v_splitter; - /* "sklearn/tree/_tree.pyx":2005 + /* "sklearn/tree/_tree.pyx":2084 * # Parameters * self.splitter = splitter * self.max_depth = max_depth # <<<<<<<<<<<<<< @@ -15904,7 +17070,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->max_depth = __pyx_v_max_depth; - /* "sklearn/tree/_tree.pyx":2006 + /* "sklearn/tree/_tree.pyx":2085 * self.splitter = splitter * self.max_depth = max_depth * self.min_samples_split = min_samples_split # <<<<<<<<<<<<<< @@ -15913,7 +17079,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->min_samples_split = __pyx_v_min_samples_split; - /* "sklearn/tree/_tree.pyx":2007 + /* "sklearn/tree/_tree.pyx":2086 * self.max_depth = max_depth * self.min_samples_split = min_samples_split * self.min_samples_leaf = min_samples_leaf # <<<<<<<<<<<<<< @@ -15922,7 +17088,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->min_samples_leaf = __pyx_v_min_samples_leaf; - /* "sklearn/tree/_tree.pyx":2008 + /* "sklearn/tree/_tree.pyx":2087 * self.min_samples_split = min_samples_split * self.min_samples_leaf = min_samples_leaf * self.random_state = random_state # <<<<<<<<<<<<<< @@ -15935,7 +17101,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle __Pyx_DECREF(__pyx_v_self->random_state); __pyx_v_self->random_state = __pyx_v_random_state; - /* "sklearn/tree/_tree.pyx":2009 + /* "sklearn/tree/_tree.pyx":2088 * self.min_samples_leaf = min_samples_leaf * self.random_state = random_state * self.max_leaf_nodes = max_leaf_nodes # <<<<<<<<<<<<<< @@ -15944,7 +17110,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->max_leaf_nodes = __pyx_v_max_leaf_nodes; - /* "sklearn/tree/_tree.pyx":2012 + /* "sklearn/tree/_tree.pyx":2091 * * # Inner structures * self.node_count = 0 # <<<<<<<<<<<<<< @@ -15953,7 +17119,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->node_count = 0; - /* "sklearn/tree/_tree.pyx":2013 + /* "sklearn/tree/_tree.pyx":2092 * # Inner structures * self.node_count = 0 * self.capacity = 0 # <<<<<<<<<<<<<< @@ -15962,7 +17128,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->capacity = 0; - /* "sklearn/tree/_tree.pyx":2014 + /* "sklearn/tree/_tree.pyx":2093 * self.node_count = 0 * self.capacity = 0 * self.value = NULL # <<<<<<<<<<<<<< @@ -15971,7 +17137,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->value = NULL; - /* "sklearn/tree/_tree.pyx":2015 + /* "sklearn/tree/_tree.pyx":2094 * self.capacity = 0 * self.value = NULL * self.nodes = NULL # <<<<<<<<<<<<<< @@ -15980,6 +17146,15 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->nodes = NULL; + /* "sklearn/tree/_tree.pyx":2056 + * return self._get_value_ndarray()[:self.node_count] + * + * def __cinit__(self, int n_features, np.ndarray[SIZE_t, ndim=1] n_classes, # <<<<<<<<<<<<<< + * int n_outputs, Splitter splitter, SIZE_t max_depth, + * SIZE_t min_samples_split, SIZE_t min_samples_leaf, + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -16000,28 +17175,30 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2096 + * self.nodes = NULL + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * # Free all inner structures + */ + /* Python wrapper */ static void __pyx_pw_7sklearn_4tree_5_tree_4Tree_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7sklearn_4tree_5_tree_4Tree_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":2017 - * self.nodes = NULL - * - * def __dealloc__(self): # <<<<<<<<<<<<<< - * """Destructor.""" - * # Free all inner structures - */ - static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "sklearn/tree/_tree.pyx":2020 + /* "sklearn/tree/_tree.pyx":2099 * """Destructor.""" * # Free all inner structures * free(self.n_classes) # <<<<<<<<<<<<<< @@ -16030,7 +17207,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 */ free(__pyx_v_self->n_classes); - /* "sklearn/tree/_tree.pyx":2021 + /* "sklearn/tree/_tree.pyx":2100 * # Free all inner structures * free(self.n_classes) * free(self.value) # <<<<<<<<<<<<<< @@ -16039,7 +17216,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 */ free(__pyx_v_self->value); - /* "sklearn/tree/_tree.pyx":2022 + /* "sklearn/tree/_tree.pyx":2101 * free(self.n_classes) * free(self.value) * free(self.nodes) # <<<<<<<<<<<<<< @@ -16048,9 +17225,26 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 */ free(__pyx_v_self->nodes); + /* "sklearn/tree/_tree.pyx":2096 + * self.nodes = NULL + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * """Destructor.""" + * # Free all inner structures + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } +/* "sklearn/tree/_tree.pyx":2103 + * free(self.nodes) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * """Reduce re-implementation, for pickling.""" + * return (Tree, (self.n_features, + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7sklearn_4tree_5_tree_4Tree_4__reduce__[] = "Reduce re-implementation, for pickling."; @@ -16059,18 +17253,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_5__reduce__(PyObject *__py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_4__reduce__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2024 - * free(self.nodes) - * - * def __reduce__(self): # <<<<<<<<<<<<<< - * """Reduce re-implementation, for pickling.""" - * return (Tree, (self.n_features, - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_4__reduce__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -16087,7 +17275,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_4__reduce__(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/tree/_tree.pyx":2026 + /* "sklearn/tree/_tree.pyx":2105 * def __reduce__(self): * """Reduce re-implementation, for pickling.""" * return (Tree, (self.n_features, # <<<<<<<<<<<<<< @@ -16095,77 +17283,77 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_4__reduce__(struct __pyx_o * self.n_outputs, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/tree/_tree.pyx":2027 + /* "sklearn/tree/_tree.pyx":2106 * """Reduce re-implementation, for pickling.""" * return (Tree, (self.n_features, * sizet_ptr_to_ndarray(self.n_classes, self.n_outputs), # <<<<<<<<<<<<<< * self.n_outputs, * self.splitter, */ - __pyx_t_2 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_ndarray(__pyx_v_self->n_classes, __pyx_v_self->n_outputs)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_ndarray(__pyx_v_self->n_classes, __pyx_v_self->n_outputs)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/tree/_tree.pyx":2028 + /* "sklearn/tree/_tree.pyx":2107 * return (Tree, (self.n_features, * sizet_ptr_to_ndarray(self.n_classes, self.n_outputs), * self.n_outputs, # <<<<<<<<<<<<<< * self.splitter, * self.max_depth, */ - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - /* "sklearn/tree/_tree.pyx":2030 + /* "sklearn/tree/_tree.pyx":2109 * self.n_outputs, * self.splitter, * self.max_depth, # <<<<<<<<<<<<<< * self.min_samples_split, * self.min_samples_leaf, */ - __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->max_depth); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2030; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->max_depth); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - /* "sklearn/tree/_tree.pyx":2031 + /* "sklearn/tree/_tree.pyx":2110 * self.splitter, * self.max_depth, * self.min_samples_split, # <<<<<<<<<<<<<< * self.min_samples_leaf, * self.max_leaf_nodes, */ - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->min_samples_split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2031; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->min_samples_split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - /* "sklearn/tree/_tree.pyx":2032 + /* "sklearn/tree/_tree.pyx":2111 * self.max_depth, * self.min_samples_split, * self.min_samples_leaf, # <<<<<<<<<<<<<< * self.max_leaf_nodes, * self.random_state), self.__getstate__()) */ - __pyx_t_6 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->min_samples_leaf); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->min_samples_leaf); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - /* "sklearn/tree/_tree.pyx":2033 + /* "sklearn/tree/_tree.pyx":2112 * self.min_samples_split, * self.min_samples_leaf, * self.max_leaf_nodes, # <<<<<<<<<<<<<< * self.random_state), self.__getstate__()) * */ - __pyx_t_7 = PyInt_FromLong(__pyx_v_self->max_leaf_nodes); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->max_leaf_nodes); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - /* "sklearn/tree/_tree.pyx":2034 - * self.min_samples_leaf, - * self.max_leaf_nodes, - * self.random_state), self.__getstate__()) # <<<<<<<<<<<<<< - * - * def __getstate__(self): + /* "sklearn/tree/_tree.pyx":2105 + * def __reduce__(self): + * """Reduce re-implementation, for pickling.""" + * return (Tree, (self.n_features, # <<<<<<<<<<<<<< + * sizet_ptr_to_ndarray(self.n_classes, self.n_outputs), + * self.n_outputs, */ - __pyx_t_8 = PyTuple_New(9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -16194,28 +17382,51 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_4__reduce__(struct __pyx_o __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":2113 + * self.min_samples_leaf, + * self.max_leaf_nodes, + * self.random_state), self.__getstate__()) # <<<<<<<<<<<<<< + * + * def __getstate__(self): + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_getstate); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2034; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_7, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2026; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":2105 + * def __reduce__(self): + * """Reduce re-implementation, for pickling.""" + * return (Tree, (self.n_features, # <<<<<<<<<<<<<< + * sizet_ptr_to_ndarray(self.n_classes, self.n_outputs), + * self.n_outputs, + */ + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_Tree))); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_Tree))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_Tree))); - PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_8 = 0; __pyx_t_6 = 0; - __pyx_r = ((PyObject *)__pyx_t_7); + __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2103 + * free(self.nodes) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * """Reduce re-implementation, for pickling.""" + * return (Tree, (self.n_features, + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -16233,6 +17444,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_4__reduce__(struct __pyx_o return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2115 + * self.random_state), self.__getstate__()) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * """Getstate re-implementation, for pickling.""" + * d = {} + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_7__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7sklearn_4tree_5_tree_4Tree_6__getstate__[] = "Getstate re-implementation, for pickling."; @@ -16241,18 +17460,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_7__getstate__(PyObject *__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_6__getstate__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2036 - * self.random_state), self.__getstate__()) - * - * def __getstate__(self): # <<<<<<<<<<<<<< - * """Getstate re-implementation, for pickling.""" - * d = {} - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_6__getstate__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_v_d = NULL; PyObject *__pyx_r = NULL; @@ -16263,55 +17476,55 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_6__getstate__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getstate__", 0); - /* "sklearn/tree/_tree.pyx":2038 + /* "sklearn/tree/_tree.pyx":2117 * def __getstate__(self): * """Getstate re-implementation, for pickling.""" * d = {} # <<<<<<<<<<<<<< * d["node_count"] = self.node_count * d["nodes"] = self._get_node_ndarray() */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_v_d = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":2039 + /* "sklearn/tree/_tree.pyx":2118 * """Getstate re-implementation, for pickling.""" * d = {} * d["node_count"] = self.node_count # <<<<<<<<<<<<<< * d["nodes"] = self._get_node_ndarray() * d["values"] = self._get_value_ndarray() */ - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->node_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->node_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__node_count), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2039; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_n_s_node_count, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":2040 + /* "sklearn/tree/_tree.pyx":2119 * d = {} * d["node_count"] = self.node_count * d["nodes"] = self._get_node_ndarray() # <<<<<<<<<<<<<< * d["values"] = self._get_value_ndarray() * return d */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_node_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__nodes), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2040; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_n_s_nodes, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":2041 + /* "sklearn/tree/_tree.pyx":2120 * d["node_count"] = self.node_count * d["nodes"] = self._get_node_ndarray() * d["values"] = self._get_value_ndarray() # <<<<<<<<<<<<<< * return d * */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_value_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_value_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__values), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2041; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_n_s_values, __pyx_t_1) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":2042 + /* "sklearn/tree/_tree.pyx":2121 * d["nodes"] = self._get_node_ndarray() * d["values"] = self._get_value_ndarray() * return d # <<<<<<<<<<<<<< @@ -16319,12 +17532,19 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_6__getstate__(struct __pyx * def __setstate__(self, d): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_d)); - __pyx_r = ((PyObject *)__pyx_v_d); + __Pyx_INCREF(__pyx_v_d); + __pyx_r = __pyx_v_d; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2115 + * self.random_state), self.__getstate__()) + * + * def __getstate__(self): # <<<<<<<<<<<<<< + * """Getstate re-implementation, for pickling.""" + * d = {} + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -16336,6 +17556,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_6__getstate__(struct __pyx return __pyx_r; } +/* "sklearn/tree/_tree.pyx":2123 + * return d + * + * def __setstate__(self, d): # <<<<<<<<<<<<<< + * """Setstate re-implementation, for unpickling.""" + * self.node_count = d["node_count"] + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_d); /*proto*/ static char __pyx_doc_7sklearn_4tree_5_tree_4Tree_8__setstate__[] = "Setstate re-implementation, for unpickling."; @@ -16344,18 +17572,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9__setstate__(PyObject *__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_d)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2044 - * return d - * - * def __setstate__(self, d): # <<<<<<<<<<<<<< - * """Setstate re-implementation, for unpickling.""" - * self.node_count = d["node_count"] - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self, PyObject *__pyx_v_d) { PyObject *__pyx_v_node_ndarray = NULL; PyObject *__pyx_v_value_ndarray = NULL; @@ -16383,87 +17605,85 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/tree/_tree.pyx":2046 + /* "sklearn/tree/_tree.pyx":2125 * def __setstate__(self, d): * """Setstate re-implementation, for unpickling.""" * self.node_count = d["node_count"] # <<<<<<<<<<<<<< * * if 'nodes' not in d: */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__node_count)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_s_node_count); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->node_count = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":2048 + /* "sklearn/tree/_tree.pyx":2127 * self.node_count = d["node_count"] * * if 'nodes' not in d: # <<<<<<<<<<<<<< * raise ValueError('You have loaded Tree version which ' * 'cannot be imported') */ - __pyx_t_3 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__nodes), __pyx_v_d, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_n_s_nodes, __pyx_v_d, Py_NE)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":2049 + /* "sklearn/tree/_tree.pyx":2128 * * if 'nodes' not in d: * raise ValueError('You have loaded Tree version which ' # <<<<<<<<<<<<<< * 'cannot be imported') * */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; - /* "sklearn/tree/_tree.pyx":2052 + /* "sklearn/tree/_tree.pyx":2131 * 'cannot be imported') * * node_ndarray = d['nodes'] # <<<<<<<<<<<<<< * value_ndarray = d['values'] * */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__nodes)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_s_nodes); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_1); __pyx_v_node_ndarray = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":2053 + /* "sklearn/tree/_tree.pyx":2132 * * node_ndarray = d['nodes'] * value_ndarray = d['values'] # <<<<<<<<<<<<<< * * value_shape = (node_ndarray.shape[0], self.n_outputs, self.max_n_classes) */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__values)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, __pyx_n_s_values); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_1); __pyx_v_value_ndarray = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":2055 + /* "sklearn/tree/_tree.pyx":2134 * value_ndarray = d['values'] * * value_shape = (node_ndarray.shape[0], self.n_outputs, self.max_n_classes) # <<<<<<<<<<<<<< * if (node_ndarray.ndim != 1 * or node_ndarray.dtype != NODE_DTYPE */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->max_n_classes); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->max_n_classes); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); @@ -16477,106 +17697,138 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx __pyx_v_value_shape = ((PyObject*)__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/tree/_tree.pyx":2056 + /* "sklearn/tree/_tree.pyx":2135 * * value_shape = (node_ndarray.shape[0], self.n_outputs, self.max_n_classes) * if (node_ndarray.ndim != 1 # <<<<<<<<<<<<<< * or node_ndarray.dtype != NODE_DTYPE * or not node_ndarray.flags.c_contiguous */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s__ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s_ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_1, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_int_1, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (!__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":2057 + /* "sklearn/tree/_tree.pyx":2136 * value_shape = (node_ndarray.shape[0], self.n_outputs, self.max_n_classes) * if (node_ndarray.ndim != 1 * or node_ndarray.dtype != NODE_DTYPE # <<<<<<<<<<<<<< * or not node_ndarray.flags.c_contiguous * or value_ndarray.shape != value_shape */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s_dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - /* "sklearn/tree/_tree.pyx":2058 + /* "sklearn/tree/_tree.pyx":2137 * if (node_ndarray.ndim != 1 * or node_ndarray.dtype != NODE_DTYPE * or not node_ndarray.flags.c_contiguous # <<<<<<<<<<<<<< * or value_ndarray.shape != value_shape * or not value_ndarray.flags.c_contiguous */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__NODE_DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_NODE_DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":2136 + * value_shape = (node_ndarray.shape[0], self.n_outputs, self.max_n_classes) + * if (node_ndarray.ndim != 1 + * or node_ndarray.dtype != NODE_DTYPE # <<<<<<<<<<<<<< + * or not node_ndarray.flags.c_contiguous + * or value_ndarray.shape != value_shape + */ + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2059 + /* "sklearn/tree/_tree.pyx":2137 + * if (node_ndarray.ndim != 1 * or node_ndarray.dtype != NODE_DTYPE - * or not node_ndarray.flags.c_contiguous - * or value_ndarray.shape != value_shape # <<<<<<<<<<<<<< + * or not node_ndarray.flags.c_contiguous # <<<<<<<<<<<<<< + * or value_ndarray.shape != value_shape * or not value_ndarray.flags.c_contiguous - * or value_ndarray.dtype != np.float64): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__c_contiguous); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_c_contiguous); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_9 = (!__pyx_t_8); if (!__pyx_t_9) { - /* "sklearn/tree/_tree.pyx":2060 + /* "sklearn/tree/_tree.pyx":2138 + * or node_ndarray.dtype != NODE_DTYPE + * or not node_ndarray.flags.c_contiguous + * or value_ndarray.shape != value_shape # <<<<<<<<<<<<<< + * or not value_ndarray.flags.c_contiguous + * or value_ndarray.dtype != np.float64): + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_value_ndarray, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + + /* "sklearn/tree/_tree.pyx":2139 * or not node_ndarray.flags.c_contiguous * or value_ndarray.shape != value_shape * or not value_ndarray.flags.c_contiguous # <<<<<<<<<<<<<< * or value_ndarray.dtype != np.float64): * raise ValueError('Did not recognise loaded array layout') */ - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_value_ndarray, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_v_value_shape), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_v_value_shape, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":2138 + * or node_ndarray.dtype != NODE_DTYPE + * or not node_ndarray.flags.c_contiguous + * or value_ndarray.shape != value_shape # <<<<<<<<<<<<<< + * or not value_ndarray.flags.c_contiguous + * or value_ndarray.dtype != np.float64): + */ + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":2061 + /* "sklearn/tree/_tree.pyx":2139 + * or not node_ndarray.flags.c_contiguous * or value_ndarray.shape != value_shape - * or not value_ndarray.flags.c_contiguous - * or value_ndarray.dtype != np.float64): # <<<<<<<<<<<<<< + * or not value_ndarray.flags.c_contiguous # <<<<<<<<<<<<<< + * or value_ndarray.dtype != np.float64): * raise ValueError('Did not recognise loaded array layout') - * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_value_ndarray, __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_value_ndarray, __pyx_n_s_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__c_contiguous); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_c_contiguous); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_11 = (!__pyx_t_10); if (!__pyx_t_11) { - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_value_ndarray, __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":2140 + * or value_ndarray.shape != value_shape + * or not value_ndarray.flags.c_contiguous + * or value_ndarray.dtype != np.float64): # <<<<<<<<<<<<<< + * raise ValueError('Did not recognise loaded array layout') + * + */ + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_value_ndarray, __pyx_n_s_dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_12 = __pyx_t_10; } else { @@ -16600,39 +17852,37 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx } if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2062 + /* "sklearn/tree/_tree.pyx":2141 * or not value_ndarray.flags.c_contiguous * or value_ndarray.dtype != np.float64): * raise ValueError('Did not recognise loaded array layout') # <<<<<<<<<<<<<< * * self.capacity = node_ndarray.shape[0] */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L4; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L4:; - /* "sklearn/tree/_tree.pyx":2064 + /* "sklearn/tree/_tree.pyx":2143 * raise ValueError('Did not recognise loaded array layout') * * self.capacity = node_ndarray.shape[0] # <<<<<<<<<<<<<< * self._resize_c(self.capacity) * nodes = memcpy(self.nodes, ( node_ndarray).data, self.capacity * sizeof(Node)) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_node_ndarray, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_t_6); if (unlikely((__pyx_t_2 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2064; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_6); if (unlikely((__pyx_t_2 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_self->capacity = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":2065 + /* "sklearn/tree/_tree.pyx":2144 * * self.capacity = node_ndarray.shape[0] * self._resize_c(self.capacity) # <<<<<<<<<<<<<< @@ -16643,7 +17893,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx __pyx_t_14.capacity = __pyx_v_self->capacity; __pyx_t_13 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_resize_c(__pyx_v_self, &__pyx_t_14); - /* "sklearn/tree/_tree.pyx":2066 + /* "sklearn/tree/_tree.pyx":2145 * self.capacity = node_ndarray.shape[0] * self._resize_c(self.capacity) * nodes = memcpy(self.nodes, ( node_ndarray).data, self.capacity * sizeof(Node)) # <<<<<<<<<<<<<< @@ -16652,7 +17902,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx */ __pyx_v_nodes = memcpy(__pyx_v_self->nodes, ((PyArrayObject *)__pyx_v_node_ndarray)->data, (__pyx_v_self->capacity * (sizeof(struct __pyx_t_7sklearn_4tree_5_tree_Node)))); - /* "sklearn/tree/_tree.pyx":2067 + /* "sklearn/tree/_tree.pyx":2146 * self._resize_c(self.capacity) * nodes = memcpy(self.nodes, ( node_ndarray).data, self.capacity * sizeof(Node)) * value = memcpy(self.value, ( value_ndarray).data, self.capacity * self.value_stride * sizeof(double)) # <<<<<<<<<<<<<< @@ -16661,6 +17911,15 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx */ __pyx_v_value = memcpy(__pyx_v_self->value, ((PyArrayObject *)__pyx_v_value_ndarray)->data, ((__pyx_v_self->capacity * __pyx_v_self->value_stride) * (sizeof(double)))); + /* "sklearn/tree/_tree.pyx":2123 + * return d + * + * def __setstate__(self, d): # <<<<<<<<<<<<<< + * """Setstate re-implementation, for unpickling.""" + * self.node_count = d["node_count"] + */ + + /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; @@ -16679,7 +17938,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2069 +/* "sklearn/tree/_tree.pyx":2148 * value = memcpy(self.value, ( value_ndarray).data, self.capacity * self.value_stride * sizeof(double)) * * cdef void _resize(self, SIZE_t capacity): # <<<<<<<<<<<<<< @@ -16697,7 +17956,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree__resize(struct __pyx_obj_7sklear int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_resize", 0); - /* "sklearn/tree/_tree.pyx":2072 + /* "sklearn/tree/_tree.pyx":2151 * """Resize all inner arrays to `capacity`, if `capacity` == -1, then * double the size of the inner arrays.""" * if self._resize_c(capacity)!= 0: # <<<<<<<<<<<<<< @@ -16710,26 +17969,33 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree__resize(struct __pyx_obj_7sklear __pyx_t_3 = ((__pyx_t_1 != 0) != 0); if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2073 + /* "sklearn/tree/_tree.pyx":2152 * double the size of the inner arrays.""" * if self._resize_c(capacity)!= 0: * raise MemoryError() # <<<<<<<<<<<<<< * * # XXX using (size_t)(-1) is ugly, but SIZE_MAX is not available in C89 */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L3; + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; + /* "sklearn/tree/_tree.pyx":2148 + * value = memcpy(self.value, ( value_ndarray).data, self.capacity * self.value_stride * sizeof(double)) + * + * cdef void _resize(self, SIZE_t capacity): # <<<<<<<<<<<<<< + * """Resize all inner arrays to `capacity`, if `capacity` == -1, then + * double the size of the inner arrays.""" + */ + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; - __Pyx_WriteUnraisable("sklearn.tree._tree.Tree._resize", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.tree._tree.Tree._resize", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":2077 +/* "sklearn/tree/_tree.pyx":2156 * # XXX using (size_t)(-1) is ugly, but SIZE_MAX is not available in C89 * # (i.e., older MSVC). * cdef int _resize_c(self, SIZE_t capacity=(-1)) nogil: # <<<<<<<<<<<<<< @@ -16738,7 +18004,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree__resize(struct __pyx_obj_7sklear */ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self, struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree__resize_c *__pyx_optional_args) { - __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_capacity = __pyx_k_6; + __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_capacity = __pyx_k__3; void *__pyx_v_ptr; int __pyx_r; int __pyx_t_1; @@ -16750,7 +18016,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea } } - /* "sklearn/tree/_tree.pyx":2079 + /* "sklearn/tree/_tree.pyx":2158 * cdef int _resize_c(self, SIZE_t capacity=(-1)) nogil: * """Guts of _resize. Returns 0 for success, -1 for error.""" * if capacity == self.capacity and self.nodes != NULL: # <<<<<<<<<<<<<< @@ -16766,7 +18032,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea } if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2080 + /* "sklearn/tree/_tree.pyx":2159 * """Guts of _resize. Returns 0 for success, -1 for error.""" * if capacity == self.capacity and self.nodes != NULL: * return 0 # <<<<<<<<<<<<<< @@ -16775,11 +18041,9 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "sklearn/tree/_tree.pyx":2082 + /* "sklearn/tree/_tree.pyx":2161 * return 0 * * if capacity == (-1): # <<<<<<<<<<<<<< @@ -16789,7 +18053,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea __pyx_t_3 = ((__pyx_v_capacity == ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)-1)) != 0); if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2083 + /* "sklearn/tree/_tree.pyx":2162 * * if capacity == (-1): * if self.capacity == 0: # <<<<<<<<<<<<<< @@ -16799,7 +18063,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea __pyx_t_3 = ((__pyx_v_self->capacity == 0) != 0); if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2084 + /* "sklearn/tree/_tree.pyx":2163 * if capacity == (-1): * if self.capacity == 0: * capacity = 3 # default initial value # <<<<<<<<<<<<<< @@ -16811,7 +18075,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea } /*else*/ { - /* "sklearn/tree/_tree.pyx":2086 + /* "sklearn/tree/_tree.pyx":2165 * capacity = 3 # default initial value * else: * capacity = 2 * self.capacity # <<<<<<<<<<<<<< @@ -16825,7 +18089,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":2088 + /* "sklearn/tree/_tree.pyx":2167 * capacity = 2 * self.capacity * * cdef void* ptr = realloc(self.nodes, capacity * sizeof(Node)) # <<<<<<<<<<<<<< @@ -16834,7 +18098,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea */ __pyx_v_ptr = realloc(__pyx_v_self->nodes, (__pyx_v_capacity * (sizeof(struct __pyx_t_7sklearn_4tree_5_tree_Node)))); - /* "sklearn/tree/_tree.pyx":2089 + /* "sklearn/tree/_tree.pyx":2168 * * cdef void* ptr = realloc(self.nodes, capacity * sizeof(Node)) * if ptr == NULL: # <<<<<<<<<<<<<< @@ -16844,7 +18108,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea __pyx_t_3 = ((__pyx_v_ptr == NULL) != 0); if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2090 + /* "sklearn/tree/_tree.pyx":2169 * cdef void* ptr = realloc(self.nodes, capacity * sizeof(Node)) * if ptr == NULL: * return -1 # <<<<<<<<<<<<<< @@ -16853,11 +18117,9 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea */ __pyx_r = -1; goto __pyx_L0; - goto __pyx_L6; } - __pyx_L6:; - /* "sklearn/tree/_tree.pyx":2091 + /* "sklearn/tree/_tree.pyx":2170 * if ptr == NULL: * return -1 * self.nodes = ptr # <<<<<<<<<<<<<< @@ -16866,16 +18128,16 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea */ __pyx_v_self->nodes = ((struct __pyx_t_7sklearn_4tree_5_tree_Node *)__pyx_v_ptr); - /* "sklearn/tree/_tree.pyx":2093 + /* "sklearn/tree/_tree.pyx":2171 + * return -1 * self.nodes = ptr - * ptr = realloc(self.value, - * capacity * self.value_stride * sizeof(double)) # <<<<<<<<<<<<<< + * ptr = realloc(self.value, # <<<<<<<<<<<<<< + * capacity * self.value_stride * sizeof(double)) * if ptr == NULL: - * return -1 */ __pyx_v_ptr = realloc(__pyx_v_self->value, ((__pyx_v_capacity * __pyx_v_self->value_stride) * (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":2094 + /* "sklearn/tree/_tree.pyx":2173 * ptr = realloc(self.value, * capacity * self.value_stride * sizeof(double)) * if ptr == NULL: # <<<<<<<<<<<<<< @@ -16885,7 +18147,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea __pyx_t_3 = ((__pyx_v_ptr == NULL) != 0); if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2095 + /* "sklearn/tree/_tree.pyx":2174 * capacity * self.value_stride * sizeof(double)) * if ptr == NULL: * return -1 # <<<<<<<<<<<<<< @@ -16894,11 +18156,9 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea */ __pyx_r = -1; goto __pyx_L0; - goto __pyx_L7; } - __pyx_L7:; - /* "sklearn/tree/_tree.pyx":2096 + /* "sklearn/tree/_tree.pyx":2175 * if ptr == NULL: * return -1 * self.value = ptr # <<<<<<<<<<<<<< @@ -16907,7 +18167,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea */ __pyx_v_self->value = ((double *)__pyx_v_ptr); - /* "sklearn/tree/_tree.pyx":2099 + /* "sklearn/tree/_tree.pyx":2178 * * # value memory is initialised to 0 to enable classifier argmax * if capacity > self.capacity: # <<<<<<<<<<<<<< @@ -16917,19 +18177,19 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea __pyx_t_3 = ((__pyx_v_capacity > __pyx_v_self->capacity) != 0); if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2101 + /* "sklearn/tree/_tree.pyx":2179 + * # value memory is initialised to 0 to enable classifier argmax * if capacity > self.capacity: - * memset(( self.value) + self.capacity * self.value_stride * sizeof(double), 0, - * (capacity - self.capacity) * self.value_stride * sizeof(double)) # <<<<<<<<<<<<<< + * memset(( self.value) + self.capacity * self.value_stride * sizeof(double), 0, # <<<<<<<<<<<<<< + * (capacity - self.capacity) * self.value_stride * sizeof(double)) * - * # if capacity smaller than node_count, adjust the counter */ memset((((void *)__pyx_v_self->value) + ((__pyx_v_self->capacity * __pyx_v_self->value_stride) * (sizeof(double)))), 0, (((__pyx_v_capacity - __pyx_v_self->capacity) * __pyx_v_self->value_stride) * (sizeof(double)))); goto __pyx_L8; } __pyx_L8:; - /* "sklearn/tree/_tree.pyx":2104 + /* "sklearn/tree/_tree.pyx":2183 * * # if capacity smaller than node_count, adjust the counter * if capacity < self.node_count: # <<<<<<<<<<<<<< @@ -16939,7 +18199,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea __pyx_t_3 = ((__pyx_v_capacity < __pyx_v_self->node_count) != 0); if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":2105 + /* "sklearn/tree/_tree.pyx":2184 * # if capacity smaller than node_count, adjust the counter * if capacity < self.node_count: * self.node_count = capacity # <<<<<<<<<<<<<< @@ -16951,7 +18211,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea } __pyx_L9:; - /* "sklearn/tree/_tree.pyx":2107 + /* "sklearn/tree/_tree.pyx":2186 * self.node_count = capacity * * self.capacity = capacity # <<<<<<<<<<<<<< @@ -16960,7 +18220,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea */ __pyx_v_self->capacity = __pyx_v_capacity; - /* "sklearn/tree/_tree.pyx":2108 + /* "sklearn/tree/_tree.pyx":2187 * * self.capacity = capacity * return 0 # <<<<<<<<<<<<<< @@ -16970,12 +18230,20 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree__resize_c(struct __pyx_obj_7sklea __pyx_r = 0; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":2156 + * # XXX using (size_t)(-1) is ugly, but SIZE_MAX is not available in C89 + * # (i.e., older MSVC). + * cdef int _resize_c(self, SIZE_t capacity=(-1)) nogil: # <<<<<<<<<<<<<< + * """Guts of _resize. Returns 0 for success, -1 for error.""" + * if capacity == self.capacity and self.nodes != NULL: + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2110 +/* "sklearn/tree/_tree.pyx":2189 * return 0 * * cdef SIZE_t _add_node(self, SIZE_t parent, # <<<<<<<<<<<<<< @@ -16990,7 +18258,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_t_1; int __pyx_t_2; - /* "sklearn/tree/_tree.pyx":2123 + /* "sklearn/tree/_tree.pyx":2202 * Returns (size_t)(-1) on error. * """ * cdef SIZE_t node_id = self.node_count # <<<<<<<<<<<<<< @@ -17000,7 +18268,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ __pyx_t_1 = __pyx_v_self->node_count; __pyx_v_node_id = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":2125 + /* "sklearn/tree/_tree.pyx":2204 * cdef SIZE_t node_id = self.node_count * * if node_id >= self.capacity: # <<<<<<<<<<<<<< @@ -17010,7 +18278,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ __pyx_t_2 = ((__pyx_v_node_id >= __pyx_v_self->capacity) != 0); if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":2126 + /* "sklearn/tree/_tree.pyx":2205 * * if node_id >= self.capacity: * if self._resize_c() != 0: # <<<<<<<<<<<<<< @@ -17020,7 +18288,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ __pyx_t_2 = ((((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_resize_c(__pyx_v_self, NULL) != 0) != 0); if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":2127 + /* "sklearn/tree/_tree.pyx":2206 * if node_id >= self.capacity: * if self._resize_c() != 0: * return (-1) # <<<<<<<<<<<<<< @@ -17029,14 +18297,12 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ */ __pyx_r = ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)-1); goto __pyx_L0; - goto __pyx_L4; } - __pyx_L4:; goto __pyx_L3; } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":2129 + /* "sklearn/tree/_tree.pyx":2208 * return (-1) * * cdef Node* node = &self.nodes[node_id] # <<<<<<<<<<<<<< @@ -17045,7 +18311,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ */ __pyx_v_node = (&(__pyx_v_self->nodes[__pyx_v_node_id])); - /* "sklearn/tree/_tree.pyx":2130 + /* "sklearn/tree/_tree.pyx":2209 * * cdef Node* node = &self.nodes[node_id] * node.impurity = impurity # <<<<<<<<<<<<<< @@ -17054,7 +18320,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ */ __pyx_v_node->impurity = __pyx_v_impurity; - /* "sklearn/tree/_tree.pyx":2131 + /* "sklearn/tree/_tree.pyx":2210 * cdef Node* node = &self.nodes[node_id] * node.impurity = impurity * node.n_samples = n_node_samples # <<<<<<<<<<<<<< @@ -17063,7 +18329,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ */ __pyx_v_node->n_samples = __pyx_v_n_node_samples; - /* "sklearn/tree/_tree.pyx":2133 + /* "sklearn/tree/_tree.pyx":2212 * node.n_samples = n_node_samples * * if parent != _TREE_UNDEFINED: # <<<<<<<<<<<<<< @@ -17073,7 +18339,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ __pyx_t_2 = ((__pyx_v_parent != __pyx_v_7sklearn_4tree_5_tree__TREE_UNDEFINED) != 0); if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":2134 + /* "sklearn/tree/_tree.pyx":2213 * * if parent != _TREE_UNDEFINED: * if is_left: # <<<<<<<<<<<<<< @@ -17083,7 +18349,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ __pyx_t_2 = (__pyx_v_is_left != 0); if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":2135 + /* "sklearn/tree/_tree.pyx":2214 * if parent != _TREE_UNDEFINED: * if is_left: * self.nodes[parent].left_child = node_id # <<<<<<<<<<<<<< @@ -17095,7 +18361,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ } /*else*/ { - /* "sklearn/tree/_tree.pyx":2137 + /* "sklearn/tree/_tree.pyx":2216 * self.nodes[parent].left_child = node_id * else: * self.nodes[parent].right_child = node_id # <<<<<<<<<<<<<< @@ -17109,7 +18375,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ } __pyx_L5:; - /* "sklearn/tree/_tree.pyx":2139 + /* "sklearn/tree/_tree.pyx":2218 * self.nodes[parent].right_child = node_id * * if is_leaf: # <<<<<<<<<<<<<< @@ -17119,7 +18385,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ __pyx_t_2 = (__pyx_v_is_leaf != 0); if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":2140 + /* "sklearn/tree/_tree.pyx":2219 * * if is_leaf: * node.left_child = _TREE_LEAF # <<<<<<<<<<<<<< @@ -17128,7 +18394,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ */ __pyx_v_node->left_child = __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF; - /* "sklearn/tree/_tree.pyx":2141 + /* "sklearn/tree/_tree.pyx":2220 * if is_leaf: * node.left_child = _TREE_LEAF * node.right_child = _TREE_LEAF # <<<<<<<<<<<<<< @@ -17137,7 +18403,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ */ __pyx_v_node->right_child = __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF; - /* "sklearn/tree/_tree.pyx":2142 + /* "sklearn/tree/_tree.pyx":2221 * node.left_child = _TREE_LEAF * node.right_child = _TREE_LEAF * node.feature = _TREE_UNDEFINED # <<<<<<<<<<<<<< @@ -17146,7 +18412,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ */ __pyx_v_node->feature = __pyx_v_7sklearn_4tree_5_tree__TREE_UNDEFINED; - /* "sklearn/tree/_tree.pyx":2143 + /* "sklearn/tree/_tree.pyx":2222 * node.right_child = _TREE_LEAF * node.feature = _TREE_UNDEFINED * node.threshold = _TREE_UNDEFINED # <<<<<<<<<<<<<< @@ -17158,7 +18424,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ } /*else*/ { - /* "sklearn/tree/_tree.pyx":2147 + /* "sklearn/tree/_tree.pyx":2226 * else: * # left_child and right_child will be set later * node.feature = feature # <<<<<<<<<<<<<< @@ -17167,7 +18433,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ */ __pyx_v_node->feature = __pyx_v_feature; - /* "sklearn/tree/_tree.pyx":2148 + /* "sklearn/tree/_tree.pyx":2227 * # left_child and right_child will be set later * node.feature = feature * node.threshold = threshold # <<<<<<<<<<<<<< @@ -17178,7 +18444,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ } __pyx_L7:; - /* "sklearn/tree/_tree.pyx":2150 + /* "sklearn/tree/_tree.pyx":2229 * node.threshold = threshold * * self.node_count += 1 # <<<<<<<<<<<<<< @@ -17187,7 +18453,7 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ */ __pyx_v_self->node_count = (__pyx_v_self->node_count + 1); - /* "sklearn/tree/_tree.pyx":2152 + /* "sklearn/tree/_tree.pyx":2231 * self.node_count += 1 * * return node_id # <<<<<<<<<<<<<< @@ -17197,12 +18463,20 @@ static __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_4Tree_ __pyx_r = __pyx_v_node_id; goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":2189 + * return 0 + * + * cdef SIZE_t _add_node(self, SIZE_t parent, # <<<<<<<<<<<<<< + * bint is_left, + * bint is_leaf, + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2154 +/* "sklearn/tree/_tree.pyx":2233 * return node_id * * cpdef np.ndarray predict(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< @@ -17232,26 +18506,26 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_o __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__predict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_predict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_4tree_5_tree_4Tree_11predict)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17260,38 +18534,38 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/tree/_tree.pyx":2156 + /* "sklearn/tree/_tree.pyx":2235 * cpdef np.ndarray predict(self, np.ndarray[DTYPE_t, ndim=2] X): * """Predict target for X.""" * out = self._get_value_ndarray().take(self.apply(X), axis=0, mode='clip') # <<<<<<<<<<<<<< * if self.n_outputs == 1: * out = out.reshape(X.shape[0], self.max_n_classes) */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_value_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->_get_value_ndarray(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__take); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_take); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->apply(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->apply(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__clip)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_mode, __pyx_n_s_clip) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_out = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/tree/_tree.pyx":2157 + /* "sklearn/tree/_tree.pyx":2236 * """Predict target for X.""" * out = self._get_value_ndarray().take(self.apply(X), axis=0, mode='clip') * if self.n_outputs == 1: # <<<<<<<<<<<<<< @@ -17301,20 +18575,20 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_o __pyx_t_5 = ((__pyx_v_self->n_outputs == 1) != 0); if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":2158 + /* "sklearn/tree/_tree.pyx":2237 * out = self._get_value_ndarray().take(self.apply(X), axis=0, mode='clip') * if self.n_outputs == 1: * out = out.reshape(X.shape[0], self.max_n_classes) # <<<<<<<<<<<<<< * return out * */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->max_n_classes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->max_n_classes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -17322,17 +18596,17 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_o __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":2159 + /* "sklearn/tree/_tree.pyx":2238 * if self.n_outputs == 1: * out = out.reshape(X.shape[0], self.max_n_classes) * return out # <<<<<<<<<<<<<< @@ -17340,13 +18614,20 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_o * cpdef np.ndarray apply(self, np.ndarray[DTYPE_t, ndim=2] X): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_out); __pyx_r = ((PyArrayObject *)__pyx_v_out); goto __pyx_L0; - __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2233 + * return node_id + * + * cpdef np.ndarray predict(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< + * """Predict target for X.""" + * out = self._get_value_ndarray().take(self.apply(X), axis=0, mode='clip') + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -17378,8 +18659,10 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11predict(PyObject *__pyx_ PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("predict (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_10predict(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X)); + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -17388,14 +18671,6 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11predict(PyObject *__pyx_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2154 - * return node_id - * - * cpdef np.ndarray predict(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< - * """Predict target for X.""" - * out = self._get_value_ndarray().take(self.apply(X), axis=0, mode='clip') - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10predict(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self, PyArrayObject *__pyx_v_X) { __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; @@ -17412,18 +18687,17 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10predict(struct __pyx_obj __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->predict(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->predict(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; @@ -17441,7 +18715,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10predict(struct __pyx_obj return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2161 +/* "sklearn/tree/_tree.pyx":2240 * return out * * cpdef np.ndarray apply(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< @@ -17488,26 +18762,26 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_4tree_5_tree_4Tree_13apply)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17516,7 +18790,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/tree/_tree.pyx":2163 + /* "sklearn/tree/_tree.pyx":2242 * cpdef np.ndarray apply(self, np.ndarray[DTYPE_t, ndim=2] X): * """Finds the terminal region (=leaf node) for each sample in X.""" * cdef SIZE_t n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -17525,7 +18799,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/tree/_tree.pyx":2164 + /* "sklearn/tree/_tree.pyx":2243 * """Finds the terminal region (=leaf node) for each sample in X.""" * cdef SIZE_t n_samples = X.shape[0] * cdef Node* node = NULL # <<<<<<<<<<<<<< @@ -17534,7 +18808,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj */ __pyx_v_node = NULL; - /* "sklearn/tree/_tree.pyx":2165 + /* "sklearn/tree/_tree.pyx":2244 * cdef SIZE_t n_samples = X.shape[0] * cdef Node* node = NULL * cdef SIZE_t i = 0 # <<<<<<<<<<<<<< @@ -17543,51 +18817,51 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj */ __pyx_v_i = 0; - /* "sklearn/tree/_tree.pyx":2167 + /* "sklearn/tree/_tree.pyx":2246 * cdef SIZE_t i = 0 * * cdef np.ndarray[SIZE_t] out = np.zeros((n_samples,), dtype=np.intp) # <<<<<<<<<<<<<< * cdef SIZE_t* out_data = out.data * */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_n_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__intp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_SIZE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_out.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_out.diminfo[0].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_out.diminfo[0].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[0]; } } @@ -17595,7 +18869,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj __pyx_v_out = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/tree/_tree.pyx":2168 + /* "sklearn/tree/_tree.pyx":2247 * * cdef np.ndarray[SIZE_t] out = np.zeros((n_samples,), dtype=np.intp) * cdef SIZE_t* out_data = out.data # <<<<<<<<<<<<<< @@ -17604,7 +18878,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj */ __pyx_v_out_data = ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t *)__pyx_v_out->data); - /* "sklearn/tree/_tree.pyx":2170 + /* "sklearn/tree/_tree.pyx":2249 * cdef SIZE_t* out_data = out.data * * with nogil: # <<<<<<<<<<<<<< @@ -17618,7 +18892,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj #endif /*try:*/ { - /* "sklearn/tree/_tree.pyx":2171 + /* "sklearn/tree/_tree.pyx":2250 * * with nogil: * for i in range(n_samples): # <<<<<<<<<<<<<< @@ -17629,7 +18903,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "sklearn/tree/_tree.pyx":2172 + /* "sklearn/tree/_tree.pyx":2251 * with nogil: * for i in range(n_samples): * node = self.nodes # <<<<<<<<<<<<<< @@ -17639,7 +18913,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj __pyx_t_9 = __pyx_v_self->nodes; __pyx_v_node = __pyx_t_9; - /* "sklearn/tree/_tree.pyx":2175 + /* "sklearn/tree/_tree.pyx":2254 * * # While node not a leaf * while node.left_child != _TREE_LEAF: # <<<<<<<<<<<<<< @@ -17650,7 +18924,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj __pyx_t_10 = ((__pyx_v_node->left_child != __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF) != 0); if (!__pyx_t_10) break; - /* "sklearn/tree/_tree.pyx":2177 + /* "sklearn/tree/_tree.pyx":2256 * while node.left_child != _TREE_LEAF: * # ... and node.right_child != _TREE_LEAF: * if X[i, node.feature] <= node.threshold: # <<<<<<<<<<<<<< @@ -17662,7 +18936,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj __pyx_t_10 = (((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_X.diminfo[1].strides)) <= __pyx_v_node->threshold) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":2178 + /* "sklearn/tree/_tree.pyx":2257 * # ... and node.right_child != _TREE_LEAF: * if X[i, node.feature] <= node.threshold: * node = &self.nodes[node.left_child] # <<<<<<<<<<<<<< @@ -17674,7 +18948,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj } /*else*/ { - /* "sklearn/tree/_tree.pyx":2180 + /* "sklearn/tree/_tree.pyx":2259 * node = &self.nodes[node.left_child] * else: * node = &self.nodes[node.right_child] # <<<<<<<<<<<<<< @@ -17686,7 +18960,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj __pyx_L10:; } - /* "sklearn/tree/_tree.pyx":2182 + /* "sklearn/tree/_tree.pyx":2261 * node = &self.nodes[node.right_child] * * out_data[i] = (node - self.nodes) # node offset # <<<<<<<<<<<<<< @@ -17697,7 +18971,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj } } - /* "sklearn/tree/_tree.pyx":2170 + /* "sklearn/tree/_tree.pyx":2249 * cdef SIZE_t* out_data = out.data * * with nogil: # <<<<<<<<<<<<<< @@ -17705,13 +18979,17 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj * node = self.nodes */ /*finally:*/ { - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif + /*normal exit:*/{ + #ifdef WITH_THREAD + Py_BLOCK_THREADS + #endif + goto __pyx_L5; + } + __pyx_L5:; } } - /* "sklearn/tree/_tree.pyx":2184 + /* "sklearn/tree/_tree.pyx":2263 * out_data[i] = (node - self.nodes) # node offset * * return out # <<<<<<<<<<<<<< @@ -17723,8 +19001,15 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj __pyx_r = ((PyArrayObject *)__pyx_v_out); goto __pyx_L0; - __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2240 + * return out + * + * cpdef np.ndarray apply(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< + * """Finds the terminal region (=leaf node) for each sample in X.""" + * cdef SIZE_t n_samples = X.shape[0] + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -17759,8 +19044,10 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13apply(PyObject *__pyx_v_ PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("apply (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_12apply(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X)); + + /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -17769,14 +19056,6 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13apply(PyObject *__pyx_v_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2161 - * return out - * - * cpdef np.ndarray apply(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< - * """Finds the terminal region (=leaf node) for each sample in X.""" - * cdef SIZE_t n_samples = X.shape[0] - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_12apply(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self, PyArrayObject *__pyx_v_X) { __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; @@ -17793,18 +19072,17 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_12apply(struct __pyx_obj_7 __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->apply(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->apply(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; @@ -17822,7 +19100,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_12apply(struct __pyx_obj_7 return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2186 +/* "sklearn/tree/_tree.pyx":2265 * return out * * cpdef compute_feature_importances(self, normalize=True): # <<<<<<<<<<<<<< @@ -17832,7 +19110,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_12apply(struct __pyx_obj_7 static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_15compute_feature_importances(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_compute_feature_importances *__pyx_optional_args) { - PyObject *__pyx_v_normalize = __pyx_k_7; + PyObject *__pyx_v_normalize = ((PyObject *)Py_True); CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n_left; CYTHON_UNUSED __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_n_right; struct __pyx_t_7sklearn_4tree_5_tree_Node *__pyx_v_left; @@ -17875,18 +19153,18 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_compute_feature_importances); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_4tree_5_tree_4Tree_15compute_feature_importances)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_normalize); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_normalize); __Pyx_GIVEREF(__pyx_v_normalize); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17895,7 +19173,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/tree/_tree.pyx":2192 + /* "sklearn/tree/_tree.pyx":2271 * cdef Node* left * cdef Node* right * cdef Node* nodes = self.nodes # <<<<<<<<<<<<<< @@ -17905,7 +19183,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_4 = __pyx_v_self->nodes; __pyx_v_nodes = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":2193 + /* "sklearn/tree/_tree.pyx":2272 * cdef Node* right * cdef Node* nodes = self.nodes * cdef Node* node = nodes # <<<<<<<<<<<<<< @@ -17914,7 +19192,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances */ __pyx_v_node = __pyx_v_nodes; - /* "sklearn/tree/_tree.pyx":2194 + /* "sklearn/tree/_tree.pyx":2273 * cdef Node* nodes = self.nodes * cdef Node* node = nodes * cdef Node* end_node = node + self.node_count # <<<<<<<<<<<<<< @@ -17923,35 +19201,35 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances */ __pyx_v_end_node = (__pyx_v_node + __pyx_v_self->node_count); - /* "sklearn/tree/_tree.pyx":2197 + /* "sklearn/tree/_tree.pyx":2276 * * cdef np.ndarray[np.float64_t, ndim=1] importances * importances = np.zeros((self.n_features,)) # <<<<<<<<<<<<<< * * while node != end_node: */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -17967,13 +19245,13 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances } } __pyx_pybuffernd_importances.diminfo[0].strides = __pyx_pybuffernd_importances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_importances.diminfo[0].shape = __pyx_pybuffernd_importances.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __pyx_v_importances = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":2199 + /* "sklearn/tree/_tree.pyx":2278 * importances = np.zeros((self.n_features,)) * * while node != end_node: # <<<<<<<<<<<<<< @@ -17984,7 +19262,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_10 = ((__pyx_v_node != __pyx_v_end_node) != 0); if (!__pyx_t_10) break; - /* "sklearn/tree/_tree.pyx":2200 + /* "sklearn/tree/_tree.pyx":2279 * * while node != end_node: * if node.left_child != _TREE_LEAF: # <<<<<<<<<<<<<< @@ -17994,7 +19272,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_10 = ((__pyx_v_node->left_child != __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":2202 + /* "sklearn/tree/_tree.pyx":2281 * if node.left_child != _TREE_LEAF: * # ... and node.right_child != _TREE_LEAF: * left = &nodes[node.left_child] # <<<<<<<<<<<<<< @@ -18003,7 +19281,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances */ __pyx_v_left = (&(__pyx_v_nodes[__pyx_v_node->left_child])); - /* "sklearn/tree/_tree.pyx":2203 + /* "sklearn/tree/_tree.pyx":2282 * # ... and node.right_child != _TREE_LEAF: * left = &nodes[node.left_child] * right = &nodes[node.right_child] # <<<<<<<<<<<<<< @@ -18012,7 +19290,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances */ __pyx_v_right = (&(__pyx_v_nodes[__pyx_v_node->right_child])); - /* "sklearn/tree/_tree.pyx":2204 + /* "sklearn/tree/_tree.pyx":2283 * left = &nodes[node.left_child] * right = &nodes[node.right_child] * n_left = left.n_samples # <<<<<<<<<<<<<< @@ -18022,7 +19300,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_11 = __pyx_v_left->n_samples; __pyx_v_n_left = __pyx_t_11; - /* "sklearn/tree/_tree.pyx":2205 + /* "sklearn/tree/_tree.pyx":2284 * right = &nodes[node.right_child] * n_left = left.n_samples * n_right = right.n_samples # <<<<<<<<<<<<<< @@ -18032,7 +19310,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_11 = __pyx_v_right->n_samples; __pyx_v_n_right = __pyx_t_11; - /* "sklearn/tree/_tree.pyx":2207 + /* "sklearn/tree/_tree.pyx":2286 * n_right = right.n_samples * * importances[node.feature] += (node.n_samples * node.impurity - # <<<<<<<<<<<<<< @@ -18045,7 +19323,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances } __pyx_L5:; - /* "sklearn/tree/_tree.pyx":2210 + /* "sklearn/tree/_tree.pyx":2289 * left.n_samples * left.impurity - * right.n_samples * right.impurity) * node += 1 # <<<<<<<<<<<<<< @@ -18055,19 +19333,19 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_v_node = (__pyx_v_node + 1); } - /* "sklearn/tree/_tree.pyx":2212 + /* "sklearn/tree/_tree.pyx":2291 * node += 1 * * importances = importances / nodes[0].n_samples # <<<<<<<<<<<<<< * cdef double normalizer * */ - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_nodes[0]).n_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_nodes[0]).n_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_importances), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyNumber_Divide(((PyObject *)__pyx_v_importances), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -18083,48 +19361,48 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances } } __pyx_pybuffernd_importances.diminfo[0].strides = __pyx_pybuffernd_importances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_importances.diminfo[0].shape = __pyx_pybuffernd_importances.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_importances, ((PyArrayObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":2215 + /* "sklearn/tree/_tree.pyx":2294 * cdef double normalizer * * if normalize: # <<<<<<<<<<<<<< * normalizer = np.sum(importances) * */ - __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_normalize); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_normalize); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":2216 + /* "sklearn/tree/_tree.pyx":2295 * * if normalize: * normalizer = np.sum(importances) # <<<<<<<<<<<<<< * * if normalizer > 0.0: */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_importances)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_importances)); __Pyx_GIVEREF(((PyObject *)__pyx_v_importances)); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_normalizer = __pyx_t_12; - /* "sklearn/tree/_tree.pyx":2218 + /* "sklearn/tree/_tree.pyx":2297 * normalizer = np.sum(importances) * * if normalizer > 0.0: # <<<<<<<<<<<<<< @@ -18134,19 +19412,19 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_10 = ((__pyx_v_normalizer > 0.0) != 0); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":2220 + /* "sklearn/tree/_tree.pyx":2299 * if normalizer > 0.0: * # Avoid dividing by zero (e.g., when root is pure) * importances /= normalizer # <<<<<<<<<<<<<< * * return importances */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_normalizer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_normalizer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_importances), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_importances), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -18162,7 +19440,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances } } __pyx_pybuffernd_importances.diminfo[0].strides = __pyx_pybuffernd_importances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_importances.diminfo[0].shape = __pyx_pybuffernd_importances.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF_SET(__pyx_v_importances, ((PyArrayObject *)__pyx_t_1)); @@ -18174,7 +19452,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances } __pyx_L6:; - /* "sklearn/tree/_tree.pyx":2222 + /* "sklearn/tree/_tree.pyx":2301 * importances /= normalizer * * return importances # <<<<<<<<<<<<<< @@ -18186,8 +19464,15 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_r = ((PyObject *)__pyx_v_importances); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2265 + * return out + * + * cpdef compute_feature_importances(self, normalize=True): # <<<<<<<<<<<<<< + * """Computes the importance of each feature (aka variable).""" + * cdef SIZE_t n_left + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -18220,9 +19505,9 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_15compute_feature_importan __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("compute_feature_importances (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__normalize,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_normalize,0}; PyObject* values[1] = {0}; - values[0] = __pyx_k_7; + values[0] = ((PyObject *)Py_True); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); @@ -18235,12 +19520,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_15compute_feature_importan switch (pos_args) { case 0: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__normalize); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_normalize); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute_feature_importances") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute_feature_importances") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2265; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -18253,25 +19538,19 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_15compute_feature_importan } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("compute_feature_importances", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("compute_feature_importances", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2265; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree.Tree.compute_feature_importances", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_14compute_feature_importances(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), __pyx_v_normalize); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2186 - * return out - * - * cpdef compute_feature_importances(self, normalize=True): # <<<<<<<<<<<<<< - * """Computes the importance of each feature (aka variable).""" - * cdef SIZE_t n_left - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14compute_feature_importances(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self, PyObject *__pyx_v_normalize) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18284,14 +19563,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14compute_feature_importan __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.normalize = __pyx_v_normalize; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->compute_feature_importances(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->compute_feature_importances(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.compute_feature_importances", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -18302,7 +19580,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14compute_feature_importan return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2224 +/* "sklearn/tree/_tree.pyx":2303 * return importances * * cdef np.ndarray _get_value_ndarray(self): # <<<<<<<<<<<<<< @@ -18321,7 +19599,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_value_ndarray(str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_get_value_ndarray", 0); - /* "sklearn/tree/_tree.pyx":2231 + /* "sklearn/tree/_tree.pyx":2310 * """ * cdef np.npy_intp shape[3] * shape[0] = self.node_count # <<<<<<<<<<<<<< @@ -18330,7 +19608,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_value_ndarray(str */ (__pyx_v_shape[0]) = ((npy_intp)__pyx_v_self->node_count); - /* "sklearn/tree/_tree.pyx":2232 + /* "sklearn/tree/_tree.pyx":2311 * cdef np.npy_intp shape[3] * shape[0] = self.node_count * shape[1] = self.n_outputs # <<<<<<<<<<<<<< @@ -18339,7 +19617,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_value_ndarray(str */ (__pyx_v_shape[1]) = ((npy_intp)__pyx_v_self->n_outputs); - /* "sklearn/tree/_tree.pyx":2233 + /* "sklearn/tree/_tree.pyx":2312 * shape[0] = self.node_count * shape[1] = self.n_outputs * shape[2] = self.max_n_classes # <<<<<<<<<<<<<< @@ -18348,20 +19626,20 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_value_ndarray(str */ (__pyx_v_shape[2]) = ((npy_intp)__pyx_v_self->max_n_classes); - /* "sklearn/tree/_tree.pyx":2235 + /* "sklearn/tree/_tree.pyx":2314 * shape[2] = self.max_n_classes * cdef np.ndarray arr * arr = np.PyArray_SimpleNewFromData(3, shape, np.NPY_DOUBLE, self.value) # <<<<<<<<<<<<<< * Py_INCREF(self) * arr.base = self */ - __pyx_t_1 = PyArray_SimpleNewFromData(3, __pyx_v_shape, NPY_DOUBLE, __pyx_v_self->value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_SimpleNewFromData(3, __pyx_v_shape, NPY_DOUBLE, __pyx_v_self->value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_arr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":2236 + /* "sklearn/tree/_tree.pyx":2315 * cdef np.ndarray arr * arr = np.PyArray_SimpleNewFromData(3, shape, np.NPY_DOUBLE, self.value) * Py_INCREF(self) # <<<<<<<<<<<<<< @@ -18370,7 +19648,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_value_ndarray(str */ Py_INCREF(((PyObject *)__pyx_v_self)); - /* "sklearn/tree/_tree.pyx":2237 + /* "sklearn/tree/_tree.pyx":2316 * arr = np.PyArray_SimpleNewFromData(3, shape, np.NPY_DOUBLE, self.value) * Py_INCREF(self) * arr.base = self # <<<<<<<<<<<<<< @@ -18379,7 +19657,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_value_ndarray(str */ __pyx_v_arr->base = ((PyObject *)__pyx_v_self); - /* "sklearn/tree/_tree.pyx":2238 + /* "sklearn/tree/_tree.pyx":2317 * Py_INCREF(self) * arr.base = self * return arr # <<<<<<<<<<<<<< @@ -18391,8 +19669,15 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_value_ndarray(str __pyx_r = __pyx_v_arr; goto __pyx_L0; - __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2303 + * return importances + * + * cdef np.ndarray _get_value_ndarray(self): # <<<<<<<<<<<<<< + * """Wraps value as a 3-d NumPy array + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree._get_value_ndarray", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -18404,7 +19689,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_value_ndarray(str return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2240 +/* "sklearn/tree/_tree.pyx":2319 * return arr * * cdef np.ndarray _get_node_ndarray(self): # <<<<<<<<<<<<<< @@ -18425,7 +19710,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_node_ndarray(stru int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_get_node_ndarray", 0); - /* "sklearn/tree/_tree.pyx":2248 + /* "sklearn/tree/_tree.pyx":2327 * """ * cdef np.npy_intp shape[1] * shape[0] = self.node_count # <<<<<<<<<<<<<< @@ -18434,7 +19719,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_node_ndarray(stru */ (__pyx_v_shape[0]) = ((npy_intp)__pyx_v_self->node_count); - /* "sklearn/tree/_tree.pyx":2250 + /* "sklearn/tree/_tree.pyx":2329 * shape[0] = self.node_count * cdef np.npy_intp strides[1] * strides[0] = sizeof(Node) # <<<<<<<<<<<<<< @@ -18443,43 +19728,51 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_node_ndarray(stru */ (__pyx_v_strides[0]) = (sizeof(struct __pyx_t_7sklearn_4tree_5_tree_Node)); - /* "sklearn/tree/_tree.pyx":2252 + /* "sklearn/tree/_tree.pyx":2331 * strides[0] = sizeof(Node) * cdef np.ndarray arr * Py_INCREF(NODE_DTYPE) # <<<<<<<<<<<<<< * arr = PyArray_NewFromDescr(np.ndarray, NODE_DTYPE, 1, shape, * strides, self.nodes, */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__NODE_DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NODE_DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); Py_INCREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":2253 + /* "sklearn/tree/_tree.pyx":2332 * cdef np.ndarray arr * Py_INCREF(NODE_DTYPE) * arr = PyArray_NewFromDescr(np.ndarray, NODE_DTYPE, 1, shape, # <<<<<<<<<<<<<< * strides, self.nodes, * np.NPY_DEFAULT, None) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__NODE_DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_NODE_DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/tree/_tree.pyx":2255 + /* "sklearn/tree/_tree.pyx":2334 * arr = PyArray_NewFromDescr(np.ndarray, NODE_DTYPE, 1, shape, * strides, self.nodes, * np.NPY_DEFAULT, None) # <<<<<<<<<<<<<< * Py_INCREF(self) * arr.base = self */ - __pyx_t_2 = PyArray_NewFromDescr(((PyObject *)((PyObject*)__pyx_ptype_5numpy_ndarray)), ((PyArray_Descr *)__pyx_t_1), 1, __pyx_v_shape, __pyx_v_strides, ((void *)__pyx_v_self->nodes), NPY_DEFAULT, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyArray_NewFromDescr(((PyObject *)((PyObject*)__pyx_ptype_5numpy_ndarray)), ((PyArray_Descr *)__pyx_t_1), 1, __pyx_v_shape, __pyx_v_strides, ((void *)__pyx_v_self->nodes), NPY_DEFAULT, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/tree/_tree.pyx":2332 + * cdef np.ndarray arr + * Py_INCREF(NODE_DTYPE) + * arr = PyArray_NewFromDescr(np.ndarray, NODE_DTYPE, 1, shape, # <<<<<<<<<<<<<< + * strides, self.nodes, + * np.NPY_DEFAULT, None) + */ + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":2256 + /* "sklearn/tree/_tree.pyx":2335 * strides, self.nodes, * np.NPY_DEFAULT, None) * Py_INCREF(self) # <<<<<<<<<<<<<< @@ -18488,7 +19781,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_node_ndarray(stru */ Py_INCREF(((PyObject *)__pyx_v_self)); - /* "sklearn/tree/_tree.pyx":2257 + /* "sklearn/tree/_tree.pyx":2336 * np.NPY_DEFAULT, None) * Py_INCREF(self) * arr.base = self # <<<<<<<<<<<<<< @@ -18497,7 +19790,7 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_node_ndarray(stru */ __pyx_v_arr->base = ((PyObject *)__pyx_v_self); - /* "sklearn/tree/_tree.pyx":2258 + /* "sklearn/tree/_tree.pyx":2337 * Py_INCREF(self) * arr.base = self * return arr # <<<<<<<<<<<<<< @@ -18509,8 +19802,15 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_node_ndarray(stru __pyx_r = __pyx_v_arr; goto __pyx_L0; - __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2319 + * return arr + * + * cdef np.ndarray _get_node_ndarray(self): # <<<<<<<<<<<<<< + * """Wraps nodes as a NumPy struct array + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); @@ -18523,6 +19823,14 @@ static PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_4Tree__get_node_ndarray(stru return __pyx_r; } +/* "sklearn/tree/_tree.pxd":129 + * cdef class Tree: + * # Input/Output layout + * cdef public SIZE_t n_features # Number of features in X # <<<<<<<<<<<<<< + * cdef SIZE_t* n_classes # Number of classes in y[:, k] + * cdef public SIZE_t n_outputs # Number of outputs in y + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_10n_features_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_10n_features_1__get__(PyObject *__pyx_v_self) { @@ -18530,18 +19838,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_10n_features_1__get__(PyOb __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_10n_features___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":128 - * cdef class Tree: - * # Input/Output layout - * cdef public SIZE_t n_features # Number of features in X # <<<<<<<<<<<<<< - * cdef SIZE_t* n_classes # Number of classes in y[:, k] - * cdef public SIZE_t n_outputs # Number of outputs in y - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10n_features___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18551,14 +19853,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10n_features___get__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.n_features.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -18576,6 +19877,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_10n_features_3__set__(PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_10n_features_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -18588,9 +19891,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_10n_features_2__set__(struct __p const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->n_features = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -18601,6 +19905,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_10n_features_2__set__(struct __p return __pyx_r; } +/* "sklearn/tree/_tree.pxd":131 + * cdef public SIZE_t n_features # Number of features in X + * cdef SIZE_t* n_classes # Number of classes in y[:, k] + * cdef public SIZE_t n_outputs # Number of outputs in y # <<<<<<<<<<<<<< + * cdef public SIZE_t max_n_classes # max(n_classes) + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9n_outputs_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9n_outputs_1__get__(PyObject *__pyx_v_self) { @@ -18608,18 +19920,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9n_outputs_1__get__(PyObje __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_outputs___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":130 - * cdef public SIZE_t n_features # Number of features in X - * cdef SIZE_t* n_classes # Number of classes in y[:, k] - * cdef public SIZE_t n_outputs # Number of outputs in y # <<<<<<<<<<<<<< - * cdef public SIZE_t max_n_classes # max(n_classes) - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_outputs___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18629,14 +19935,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_outputs___get__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.n_outputs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -18654,6 +19959,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_9n_outputs_3__set__(PyObject *__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_outputs_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -18666,9 +19973,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_outputs_2__set__(struct __pyx const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->n_outputs = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -18679,6 +19987,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_outputs_2__set__(struct __pyx return __pyx_r; } +/* "sklearn/tree/_tree.pxd":132 + * cdef SIZE_t* n_classes # Number of classes in y[:, k] + * cdef public SIZE_t n_outputs # Number of outputs in y + * cdef public SIZE_t max_n_classes # max(n_classes) # <<<<<<<<<<<<<< + * + * # Parameters + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13max_n_classes_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13max_n_classes_1__get__(PyObject *__pyx_v_self) { @@ -18686,18 +20002,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13max_n_classes_1__get__(P __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_13max_n_classes___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":131 - * cdef SIZE_t* n_classes # Number of classes in y[:, k] - * cdef public SIZE_t n_outputs # Number of outputs in y - * cdef public SIZE_t max_n_classes # max(n_classes) # <<<<<<<<<<<<<< - * - * # Parameters - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_13max_n_classes___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18707,14 +20017,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_13max_n_classes___get__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->max_n_classes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->max_n_classes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.max_n_classes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -18732,6 +20041,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_13max_n_classes_3__set__(PyObjec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_13max_n_classes_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -18744,9 +20055,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_13max_n_classes_2__set__(struct const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->max_n_classes = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -18757,25 +20069,27 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_13max_n_classes_2__set__(struct return __pyx_r; } -/* Python wrapper */ -static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_8splitter_1__get__(PyObject *__pyx_v_self); /*proto*/ +/* "sklearn/tree/_tree.pxd":135 + * + * # Parameters + * cdef public Splitter splitter # Splitting algorithm # <<<<<<<<<<<<<< + * cdef public SIZE_t max_depth # Max depth of the tree + * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_8splitter_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_8splitter_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_8splitter___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":134 - * - * # Parameters - * cdef public Splitter splitter # Splitting algorithm # <<<<<<<<<<<<<< - * cdef public SIZE_t max_depth # Max depth of the tree - * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8splitter___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18785,7 +20099,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8splitter___get__(struct _ __pyx_r = ((PyObject *)__pyx_v_self->splitter); goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -18799,6 +20113,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_8splitter_3__set__(PyObject *__p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_8splitter_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -18806,20 +20122,25 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_8splitter_3__set__(PyObject *__p static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_8splitter_2__set__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_7sklearn_4tree_5_tree_Splitter))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); + if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_7sklearn_4tree_5_tree_Splitter))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_v_value; + __Pyx_INCREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->splitter); __Pyx_DECREF(((PyObject *)__pyx_v_self->splitter)); - __pyx_v_self->splitter = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_v_value); + __pyx_v_self->splitter = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)__pyx_t_1); + __pyx_t_1 = 0; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.splitter.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -18834,6 +20155,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_8splitter_5__del__(PyObject *__p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_8splitter_4__del__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -18848,11 +20171,20 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_8splitter_4__del__(struct __pyx_ __Pyx_DECREF(((PyObject *)__pyx_v_self->splitter)); __pyx_v_self->splitter = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)Py_None); + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/tree/_tree.pxd":136 + * # Parameters + * cdef public Splitter splitter # Splitting algorithm + * cdef public SIZE_t max_depth # Max depth of the tree # <<<<<<<<<<<<<< + * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node + * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9max_depth_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9max_depth_1__get__(PyObject *__pyx_v_self) { @@ -18860,18 +20192,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9max_depth_1__get__(PyObje __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_9max_depth___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":135 - * # Parameters - * cdef public Splitter splitter # Splitting algorithm - * cdef public SIZE_t max_depth # Max depth of the tree # <<<<<<<<<<<<<< - * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node - * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9max_depth___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18881,14 +20207,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9max_depth___get__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->max_depth); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->max_depth); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.max_depth.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -18906,6 +20231,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_9max_depth_3__set__(PyObject *__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_9max_depth_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -18918,9 +20245,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_9max_depth_2__set__(struct __pyx const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->max_depth = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -18931,6 +20259,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_9max_depth_2__set__(struct __pyx return __pyx_r; } +/* "sklearn/tree/_tree.pxd":137 + * cdef public Splitter splitter # Splitting algorithm + * cdef public SIZE_t max_depth # Max depth of the tree + * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node # <<<<<<<<<<<<<< + * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf + * cdef public object random_state # Random state + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_17min_samples_split_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_17min_samples_split_1__get__(PyObject *__pyx_v_self) { @@ -18938,18 +20274,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_17min_samples_split_1__get __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_17min_samples_split___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":136 - * cdef public Splitter splitter # Splitting algorithm - * cdef public SIZE_t max_depth # Max depth of the tree - * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node # <<<<<<<<<<<<<< - * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf - * cdef public object random_state # Random state - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_17min_samples_split___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -18959,14 +20289,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_17min_samples_split___get_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->min_samples_split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->min_samples_split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.min_samples_split.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -18984,6 +20313,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_17min_samples_split_3__set__(PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_17min_samples_split_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -18996,9 +20327,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_17min_samples_split_2__set__(str const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->min_samples_split = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -19009,6 +20341,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_17min_samples_split_2__set__(str return __pyx_r; } +/* "sklearn/tree/_tree.pxd":138 + * cdef public SIZE_t max_depth # Max depth of the tree + * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node + * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf # <<<<<<<<<<<<<< + * cdef public object random_state # Random state + * cdef public int max_leaf_nodes # Number of leafs to grow + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf_1__get__(PyObject *__pyx_v_self) { @@ -19016,18 +20356,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf_1__get_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":137 - * cdef public SIZE_t max_depth # Max depth of the tree - * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node - * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf # <<<<<<<<<<<<<< - * cdef public object random_state # Random state - * cdef public int max_leaf_nodes # Number of leafs to grow - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -19037,14 +20371,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf___get__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->min_samples_leaf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->min_samples_leaf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.min_samples_leaf.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -19062,6 +20395,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf_3__set__(PyOb __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19074,9 +20409,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf_2__set__(stru const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->min_samples_leaf = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -19087,6 +20423,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_16min_samples_leaf_2__set__(stru return __pyx_r; } +/* "sklearn/tree/_tree.pxd":139 + * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node + * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf + * cdef public object random_state # Random state # <<<<<<<<<<<<<< + * cdef public int max_leaf_nodes # Number of leafs to grow + * + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_12random_state_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_12random_state_1__get__(PyObject *__pyx_v_self) { @@ -19094,18 +20438,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_12random_state_1__get__(Py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_12random_state___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":138 - * cdef public SIZE_t min_samples_split # Minimum number of samples in an internal node - * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf - * cdef public object random_state # Random state # <<<<<<<<<<<<<< - * cdef public int max_leaf_nodes # Number of leafs to grow - * - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_12random_state___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -19115,7 +20453,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_12random_state___get__(str __pyx_r = __pyx_v_self->random_state; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -19129,6 +20467,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_12random_state_3__set__(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_12random_state_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19143,6 +20483,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_12random_state_2__set__(struct _ __Pyx_DECREF(__pyx_v_self->random_state); __pyx_v_self->random_state = __pyx_v_value; + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -19155,6 +20496,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_12random_state_5__del__(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_12random_state_4__del__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19169,11 +20512,20 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_12random_state_4__del__(struct _ __Pyx_DECREF(__pyx_v_self->random_state); __pyx_v_self->random_state = Py_None; + /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "sklearn/tree/_tree.pxd":140 + * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf + * cdef public object random_state # Random state + * cdef public int max_leaf_nodes # Number of leafs to grow # <<<<<<<<<<<<<< + * + * # Inner structures: values are stored separately from node structure, + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes_1__get__(PyObject *__pyx_v_self) { @@ -19181,18 +20533,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes_1__get__( __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":139 - * cdef public SIZE_t min_samples_leaf # Minimum number of samples in a leaf - * cdef public object random_state # Random state - * cdef public int max_leaf_nodes # Number of leafs to grow # <<<<<<<<<<<<<< - * - * # Inner structures: values are stored separately from node structure, - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -19202,14 +20548,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes___get__(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_leaf_nodes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->max_leaf_nodes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.max_leaf_nodes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -19227,6 +20572,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes_3__set__(PyObje __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19239,9 +20586,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes_2__set__(struct const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->max_leaf_nodes = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -19252,6 +20600,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_14max_leaf_nodes_2__set__(struct return __pyx_r; } +/* "sklearn/tree/_tree.pxd":144 + * # Inner structures: values are stored separately from node structure, + * # since size determined at runtime. + * cdef public SIZE_t node_count # Counter for node IDs # <<<<<<<<<<<<<< + * cdef public SIZE_t capacity # Capacity of tree, in terms of nodes + * cdef Node* nodes # Array of nodes + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_10node_count_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_10node_count_1__get__(PyObject *__pyx_v_self) { @@ -19259,18 +20615,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_10node_count_1__get__(PyOb __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_10node_count___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":143 - * # Inner structures: values are stored separately from node structure, - * # since size determined at runtime. - * cdef public SIZE_t node_count # Counter for node IDs # <<<<<<<<<<<<<< - * cdef public SIZE_t capacity # Capacity of tree, in terms of nodes - * cdef Node* nodes # Array of nodes - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10node_count___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -19280,14 +20630,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10node_count___get__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->node_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->node_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.node_count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -19305,6 +20654,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_10node_count_3__set__(PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_10node_count_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19317,9 +20668,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_10node_count_2__set__(struct __p const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->node_count = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -19330,6 +20682,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_10node_count_2__set__(struct __p return __pyx_r; } +/* "sklearn/tree/_tree.pxd":145 + * # since size determined at runtime. + * cdef public SIZE_t node_count # Counter for node IDs + * cdef public SIZE_t capacity # Capacity of tree, in terms of nodes # <<<<<<<<<<<<<< + * cdef Node* nodes # Array of nodes + * cdef double* value # (capacity, n_outputs, max_n_classes) array of values + */ + /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_8capacity_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_8capacity_1__get__(PyObject *__pyx_v_self) { @@ -19337,18 +20697,12 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_8capacity_1__get__(PyObjec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_8capacity___get__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/tree/_tree.pxd":144 - * # since size determined at runtime. - * cdef public SIZE_t node_count # Counter for node IDs - * cdef public SIZE_t capacity # Capacity of tree, in terms of nodes # <<<<<<<<<<<<<< - * cdef Node* nodes # Array of nodes - * cdef double* value # (capacity, n_outputs, max_n_classes) array of values - */ - static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8capacity___get__(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -19358,14 +20712,13 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8capacity___get__(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_self->capacity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_self->capacity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.Tree.capacity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -19383,6 +20736,8 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_8capacity_3__set__(PyObject *__p __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_8capacity_2__set__(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyObject *)__pyx_v_value)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -19395,9 +20750,10 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_8capacity_2__set__(struct __pyx_ const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__set__", 0); - __pyx_t_1 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_As_Py_intptr_t(__pyx_v_value); if (unlikely((__pyx_t_1 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->capacity = __pyx_t_1; + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -19408,7 +20764,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_8capacity_2__set__(struct __pyx_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2267 +/* "sklearn/tree/_tree.pyx":2346 * # rand_r replacement using a 32bit XorShift generator * # See http://www.jstatsoft.org/v08/i14/paper for details * cdef inline UINT32_t our_rand_r(UINT32_t* seed) nogil: # <<<<<<<<<<<<<< @@ -19420,7 +20776,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_UINT32_t __pyx_f_7sklearn_4tr __pyx_t_7sklearn_4tree_5_tree_UINT32_t __pyx_r; long __pyx_t_1; - /* "sklearn/tree/_tree.pyx":2268 + /* "sklearn/tree/_tree.pyx":2347 * # See http://www.jstatsoft.org/v08/i14/paper for details * cdef inline UINT32_t our_rand_r(UINT32_t* seed) nogil: * seed[0] ^= (seed[0] << 13) # <<<<<<<<<<<<<< @@ -19430,7 +20786,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_UINT32_t __pyx_f_7sklearn_4tr __pyx_t_1 = 0; (__pyx_v_seed[__pyx_t_1]) = ((__pyx_v_seed[__pyx_t_1]) ^ ((__pyx_t_7sklearn_4tree_5_tree_UINT32_t)((__pyx_v_seed[0]) << 13))); - /* "sklearn/tree/_tree.pyx":2269 + /* "sklearn/tree/_tree.pyx":2348 * cdef inline UINT32_t our_rand_r(UINT32_t* seed) nogil: * seed[0] ^= (seed[0] << 13) * seed[0] ^= (seed[0] >> 17) # <<<<<<<<<<<<<< @@ -19440,7 +20796,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_UINT32_t __pyx_f_7sklearn_4tr __pyx_t_1 = 0; (__pyx_v_seed[__pyx_t_1]) = ((__pyx_v_seed[__pyx_t_1]) ^ ((__pyx_t_7sklearn_4tree_5_tree_UINT32_t)((__pyx_v_seed[0]) >> 17))); - /* "sklearn/tree/_tree.pyx":2270 + /* "sklearn/tree/_tree.pyx":2349 * seed[0] ^= (seed[0] << 13) * seed[0] ^= (seed[0] >> 17) * seed[0] ^= (seed[0] << 5) # <<<<<<<<<<<<<< @@ -19450,7 +20806,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_UINT32_t __pyx_f_7sklearn_4tr __pyx_t_1 = 0; (__pyx_v_seed[__pyx_t_1]) = ((__pyx_v_seed[__pyx_t_1]) ^ ((__pyx_t_7sklearn_4tree_5_tree_UINT32_t)((__pyx_v_seed[0]) << 5))); - /* "sklearn/tree/_tree.pyx":2272 + /* "sklearn/tree/_tree.pyx":2351 * seed[0] ^= (seed[0] << 5) * * return seed[0] % (RAND_R_MAX + 1) # <<<<<<<<<<<<<< @@ -19460,12 +20816,20 @@ static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_UINT32_t __pyx_f_7sklearn_4tr __pyx_r = ((__pyx_v_seed[0]) % (((__pyx_t_7sklearn_4tree_5_tree_UINT32_t)__pyx_e_7sklearn_4tree_5_tree_RAND_R_MAX) + 1)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":2346 + * # rand_r replacement using a 32bit XorShift generator + * # See http://www.jstatsoft.org/v08/i14/paper for details + * cdef inline UINT32_t our_rand_r(UINT32_t* seed) nogil: # <<<<<<<<<<<<<< + * seed[0] ^= (seed[0] << 13) + * seed[0] ^= (seed[0] >> 17) + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2274 +/* "sklearn/tree/_tree.pyx":2353 * return seed[0] % (RAND_R_MAX + 1) * * cdef inline np.ndarray sizet_ptr_to_ndarray(SIZE_t* data, SIZE_t size): # <<<<<<<<<<<<<< @@ -19483,7 +20847,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_n int __pyx_clineno = 0; __Pyx_RefNannySetupContext("sizet_ptr_to_ndarray", 0); - /* "sklearn/tree/_tree.pyx":2277 + /* "sklearn/tree/_tree.pyx":2356 * """Encapsulate data into a 1D numpy array of intp's.""" * cdef np.npy_intp shape[1] * shape[0] = size # <<<<<<<<<<<<<< @@ -19492,7 +20856,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_n */ (__pyx_v_shape[0]) = ((npy_intp)__pyx_v_size); - /* "sklearn/tree/_tree.pyx":2278 + /* "sklearn/tree/_tree.pyx":2357 * cdef np.npy_intp shape[1] * shape[0] = size * return np.PyArray_SimpleNewFromData(1, shape, np.NPY_INTP, data) # <<<<<<<<<<<<<< @@ -19500,15 +20864,22 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_n * cdef inline SIZE_t rand_int(SIZE_t end, UINT32_t* random_state) nogil: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_INTP, __pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_INTP, __pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "sklearn/tree/_tree.pyx":2353 + * return seed[0] % (RAND_R_MAX + 1) + * + * cdef inline np.ndarray sizet_ptr_to_ndarray(SIZE_t* data, SIZE_t size): # <<<<<<<<<<<<<< + * """Encapsulate data into a 1D numpy array of intp's.""" + * cdef np.npy_intp shape[1] + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sklearn.tree._tree.sizet_ptr_to_ndarray", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -19519,7 +20890,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_n return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2280 +/* "sklearn/tree/_tree.pyx":2359 * return np.PyArray_SimpleNewFromData(1, shape, np.NPY_INTP, data) * * cdef inline SIZE_t rand_int(SIZE_t end, UINT32_t* random_state) nogil: # <<<<<<<<<<<<<< @@ -19530,7 +20901,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_sizet_ptr_to_n static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree_5_tree_rand_int(__pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_v_end, __pyx_t_7sklearn_4tree_5_tree_UINT32_t *__pyx_v_random_state) { __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_r; - /* "sklearn/tree/_tree.pyx":2282 + /* "sklearn/tree/_tree.pyx":2361 * cdef inline SIZE_t rand_int(SIZE_t end, UINT32_t* random_state) nogil: * """Generate a random integer in [0; end).""" * return our_rand_r(random_state) % end # <<<<<<<<<<<<<< @@ -19540,12 +20911,20 @@ static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree __pyx_r = (__pyx_f_7sklearn_4tree_5_tree_our_rand_r(__pyx_v_random_state) % __pyx_v_end); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":2359 + * return np.PyArray_SimpleNewFromData(1, shape, np.NPY_INTP, data) + * + * cdef inline SIZE_t rand_int(SIZE_t end, UINT32_t* random_state) nogil: # <<<<<<<<<<<<<< + * """Generate a random integer in [0; end).""" + * return our_rand_r(random_state) % end + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2284 +/* "sklearn/tree/_tree.pyx":2363 * return our_rand_r(random_state) % end * * cdef inline double rand_double(UINT32_t* random_state) nogil: # <<<<<<<<<<<<<< @@ -19556,7 +20935,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_4tree_5_tree_SIZE_t __pyx_f_7sklearn_4tree static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_rand_double(__pyx_t_7sklearn_4tree_5_tree_UINT32_t *__pyx_v_random_state) { double __pyx_r; - /* "sklearn/tree/_tree.pyx":2286 + /* "sklearn/tree/_tree.pyx":2365 * cdef inline double rand_double(UINT32_t* random_state) nogil: * """Generate a random double in [0; 1).""" * return our_rand_r(random_state) / RAND_R_MAX # <<<<<<<<<<<<<< @@ -19566,12 +20945,20 @@ static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_rand_double(__pyx_t_7s __pyx_r = (((double)__pyx_f_7sklearn_4tree_5_tree_our_rand_r(__pyx_v_random_state)) / ((double)__pyx_e_7sklearn_4tree_5_tree_RAND_R_MAX)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":2363 + * return our_rand_r(random_state) % end + * + * cdef inline double rand_double(UINT32_t* random_state) nogil: # <<<<<<<<<<<<<< + * """Generate a random double in [0; 1).""" + * return our_rand_r(random_state) / RAND_R_MAX + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } -/* "sklearn/tree/_tree.pyx":2288 +/* "sklearn/tree/_tree.pyx":2367 * return our_rand_r(random_state) / RAND_R_MAX * * cdef inline double log(double x) nogil: # <<<<<<<<<<<<<< @@ -19581,7 +20968,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_rand_double(__pyx_t_7s static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_log(double __pyx_v_x) { double __pyx_r; - /* "sklearn/tree/_tree.pyx":2289 + /* "sklearn/tree/_tree.pyx":2368 * * cdef inline double log(double x) nogil: * return ln(x) / ln(2.0) # <<<<<<<<<<<<<< @@ -19589,11 +20976,26 @@ static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_log(double __pyx_v_x) __pyx_r = (log(__pyx_v_x) / log(2.0)); goto __pyx_L0; - __pyx_r = 0; + /* "sklearn/tree/_tree.pyx":2367 + * return our_rand_r(random_state) / RAND_R_MAX + * + * cdef inline double log(double x) nogil: # <<<<<<<<<<<<<< + * return ln(x) / ln(2.0) + */ + + /* function exit code */ __pyx_L0:; return __pyx_r; } +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { @@ -19601,18 +21003,12 @@ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numpy.pxd":194 - * # experimental exception made for __getbuffer__ and __releasebuffer__ - * # -- the details of this may change. - * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< - * # This implementation of getbuffer is geared towards Cython - * # requirements, and does not yet fullfill the PEP. - */ - static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; @@ -19644,7 +21040,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":200 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -19655,11 +21051,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L3; } - __pyx_L3:; - /* "numpy.pxd":203 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -19668,7 +21062,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":204 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -19677,7 +21071,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":206 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -19686,7 +21080,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":208 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -19696,7 +21090,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "numpy.pxd":209 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -19708,7 +21102,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":211 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -19719,7 +21113,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L4:; - /* "numpy.pxd":213 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -19729,7 +21123,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { - /* "numpy.pxd":214 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -19743,23 +21137,21 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_3) { - /* "numpy.pxd":215 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; } - __pyx_L5:; - /* "numpy.pxd":217 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -19769,7 +21161,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { - /* "numpy.pxd":218 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -19783,23 +21175,21 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_2) { - /* "numpy.pxd":219 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; } - __pyx_L6:; - /* "numpy.pxd":221 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -19808,7 +21198,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":222 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -19817,7 +21207,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":223 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -19827,7 +21217,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_2 = (__pyx_v_copy_shape != 0); if (__pyx_t_2) { - /* "numpy.pxd":226 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -19836,7 +21226,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":227 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -19845,7 +21235,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":228 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -19856,7 +21246,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":229 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -19865,7 +21255,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":230 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -19878,7 +21268,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":232 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -19887,7 +21277,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":233 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -19898,7 +21288,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L7:; - /* "numpy.pxd":234 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -19907,7 +21297,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":235 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -19916,7 +21306,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":236 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -19925,7 +21315,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - /* "numpy.pxd":239 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -19934,7 +21324,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_f = NULL; - /* "numpy.pxd":240 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -19946,7 +21336,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; - /* "numpy.pxd":244 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -19955,7 +21345,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":246 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -19971,7 +21361,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":248 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -19987,7 +21377,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":251 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -20002,7 +21392,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L10:; - /* "numpy.pxd":253 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -20012,7 +21402,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { - /* "numpy.pxd":254 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -20022,7 +21412,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":255 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -20037,7 +21427,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (!__pyx_t_2) { - /* "numpy.pxd":256 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -20057,23 +21447,21 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":257 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L12; } - __pyx_L12:; - /* "numpy.pxd":274 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -20082,7 +21470,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ switch (__pyx_v_t) { - /* "numpy.pxd":258 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -20090,10 +21478,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_SHORT: f = "h" */ case NPY_BYTE: - __pyx_v_f = __pyx_k__b; + __pyx_v_f = __pyx_k_b; break; - /* "numpy.pxd":259 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -20101,10 +21489,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_USHORT: f = "H" */ case NPY_UBYTE: - __pyx_v_f = __pyx_k__B; + __pyx_v_f = __pyx_k_B; break; - /* "numpy.pxd":260 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -20112,10 +21500,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_INT: f = "i" */ case NPY_SHORT: - __pyx_v_f = __pyx_k__h; + __pyx_v_f = __pyx_k_h; break; - /* "numpy.pxd":261 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -20123,10 +21511,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_UINT: f = "I" */ case NPY_USHORT: - __pyx_v_f = __pyx_k__H; + __pyx_v_f = __pyx_k_H; break; - /* "numpy.pxd":262 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -20134,10 +21522,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_LONG: f = "l" */ case NPY_INT: - __pyx_v_f = __pyx_k__i; + __pyx_v_f = __pyx_k_i; break; - /* "numpy.pxd":263 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -20145,10 +21533,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_ULONG: f = "L" */ case NPY_UINT: - __pyx_v_f = __pyx_k__I; + __pyx_v_f = __pyx_k_I; break; - /* "numpy.pxd":264 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -20156,10 +21544,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_LONGLONG: f = "q" */ case NPY_LONG: - __pyx_v_f = __pyx_k__l; + __pyx_v_f = __pyx_k_l; break; - /* "numpy.pxd":265 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -20167,10 +21555,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_ULONGLONG: f = "Q" */ case NPY_ULONG: - __pyx_v_f = __pyx_k__L; + __pyx_v_f = __pyx_k_L; break; - /* "numpy.pxd":266 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -20178,10 +21566,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_FLOAT: f = "f" */ case NPY_LONGLONG: - __pyx_v_f = __pyx_k__q; + __pyx_v_f = __pyx_k_q; break; - /* "numpy.pxd":267 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -20189,10 +21577,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_DOUBLE: f = "d" */ case NPY_ULONGLONG: - __pyx_v_f = __pyx_k__Q; + __pyx_v_f = __pyx_k_Q; break; - /* "numpy.pxd":268 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -20200,10 +21588,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_LONGDOUBLE: f = "g" */ case NPY_FLOAT: - __pyx_v_f = __pyx_k__f; + __pyx_v_f = __pyx_k_f; break; - /* "numpy.pxd":269 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -20211,10 +21599,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_CFLOAT: f = "Zf" */ case NPY_DOUBLE: - __pyx_v_f = __pyx_k__d; + __pyx_v_f = __pyx_k_d; break; - /* "numpy.pxd":270 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -20222,10 +21610,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_CDOUBLE: f = "Zd" */ case NPY_LONGDOUBLE: - __pyx_v_f = __pyx_k__g; + __pyx_v_f = __pyx_k_g; break; - /* "numpy.pxd":271 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -20233,10 +21621,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_CLONGDOUBLE: f = "Zg" */ case NPY_CFLOAT: - __pyx_v_f = __pyx_k__Zf; + __pyx_v_f = __pyx_k_Zf; break; - /* "numpy.pxd":272 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -20244,10 +21632,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * elif t == NPY_OBJECT: f = "O" */ case NPY_CDOUBLE: - __pyx_v_f = __pyx_k__Zd; + __pyx_v_f = __pyx_k_Zd; break; - /* "numpy.pxd":273 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -20255,10 +21643,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * else: */ case NPY_CLONGDOUBLE: - __pyx_v_f = __pyx_k__Zg; + __pyx_v_f = __pyx_k_Zg; break; - /* "numpy.pxd":274 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -20266,37 +21654,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ case NPY_OBJECT: - __pyx_v_f = __pyx_k__O; + __pyx_v_f = __pyx_k_O; break; default: - /* "numpy.pxd":276 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - /* "numpy.pxd":277 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -20305,7 +21693,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":278 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -20314,11 +21702,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":280 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -20327,7 +21714,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":281 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -20336,7 +21723,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":282 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -20345,17 +21732,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_offset = 0; - /* "numpy.pxd":285 - * f = _util_dtypestring(descr, info.format + 1, + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":283 + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< * info.format + _buffer_format_string_len, - * &offset) # <<<<<<<<<<<<<< - * f[0] = c'\0' # Terminate format string - * + * &offset) */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "numpy.pxd":286 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< @@ -20364,8 +21751,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_f[0]) = '\x00'; } - __pyx_L11:; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + + /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -20389,29 +21784,31 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P return __pyx_r; } +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":288 - * f[0] = c'\0' # Terminate format string - * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - */ - static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":289 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -20421,7 +21818,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { - /* "numpy.pxd":290 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -20433,7 +21830,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L3:; - /* "numpy.pxd":291 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -20443,7 +21840,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "numpy.pxd":292 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -20455,10 +21852,19 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L4:; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":768 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -20475,7 +21881,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":769 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -20489,8 +21895,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":768 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -20501,7 +21914,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":771 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -20518,7 +21931,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":772 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -20532,8 +21945,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":771 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -20544,7 +21964,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":774 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -20561,7 +21981,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":775 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -20575,8 +21995,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":774 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -20587,7 +22014,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":777 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -20604,7 +22031,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":778 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -20618,8 +22045,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":777 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -20630,7 +22064,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":780 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -20647,7 +22081,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":781 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -20661,8 +22095,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":780 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -20673,7 +22114,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":783 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -20695,20 +22136,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_5; + int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - int __pyx_t_10; - long __pyx_t_11; - char *__pyx_t_12; + long __pyx_t_10; + char *__pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":790 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -20717,7 +22157,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":791 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -20726,18 +22166,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":794 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + if (unlikely(__pyx_v_descr->names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON @@ -20748,28 +22188,28 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":795 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; - /* "numpy.pxd":796 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * - * if (end - f) - (new_offset - offset[0]) < 15: + * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { - PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (likely(__pyx_v_fields != Py_None)) { + PyObject* sequence = __pyx_v_fields; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else @@ -20791,28 +22231,8 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif - } else if (1) { + } else { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else - { - Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = NULL; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L6_unpacking_done; - __pyx_L5_unpacking_failed:; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); @@ -20820,98 +22240,87 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; - /* "numpy.pxd":798 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":798 * child, new_offset = fields * - * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); + if (__pyx_t_6) { - /* "numpy.pxd":799 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799 * - * if (end - f) - (new_offset - offset[0]) < 15: + * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; } - __pyx_L7:; - /* "numpy.pxd":801 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); - if (__pyx_t_7) { - __pyx_t_8 = (__pyx_v_little_endian != 0); + __pyx_t_6 = ((__pyx_v_child->byteorder == '>') != 0); + if (__pyx_t_6) { + __pyx_t_7 = (__pyx_v_little_endian != 0); } else { - __pyx_t_8 = __pyx_t_7; + __pyx_t_7 = __pyx_t_6; } - if (!__pyx_t_8) { + if (!__pyx_t_7) { - /* "numpy.pxd":802 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); - if (__pyx_t_7) { - __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); - __pyx_t_10 = __pyx_t_9; + __pyx_t_6 = ((__pyx_v_child->byteorder == '<') != 0); + if (__pyx_t_6) { + __pyx_t_8 = ((!(__pyx_v_little_endian != 0)) != 0); + __pyx_t_9 = __pyx_t_8; } else { - __pyx_t_10 = __pyx_t_7; + __pyx_t_9 = __pyx_t_6; } - __pyx_t_7 = __pyx_t_10; + __pyx_t_6 = __pyx_t_9; } else { - __pyx_t_7 = __pyx_t_8; + __pyx_t_6 = __pyx_t_7; } - if (__pyx_t_7) { + if (__pyx_t_6) { - /* "numpy.pxd":803 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; } - __pyx_L8:; - /* "numpy.pxd":813 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -20919,15 +22328,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_7) break; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!__pyx_t_6) break; - /* "numpy.pxd":814 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -20936,7 +22345,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":815 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -20945,412 +22354,410 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":816 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_11 = 0; - (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); } - /* "numpy.pxd":818 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_11 = 0; - (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); - /* "numpy.pxd":820 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); - if (__pyx_t_7) { + __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); + if (__pyx_t_6) { - /* "numpy.pxd":821 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":822 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); - if (__pyx_t_7) { + __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); + if (__pyx_t_6) { - /* "numpy.pxd":823 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L12; } - __pyx_L12:; - /* "numpy.pxd":826 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 98; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":827 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 66; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":828 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 104; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":829 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 72; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":830 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 105; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":831 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 73; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":832 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 108; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":833 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 76; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":834 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 113; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":835 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 81; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":836 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 102; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":837 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 100; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":838 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 103; - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":839 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":840 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":841 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L13; + goto __pyx_L11; } - /* "numpy.pxd":842 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_7) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 79; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":844 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L13:; + __pyx_L11:; - /* "numpy.pxd":845 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -21358,25 +22765,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L9; } /*else*/ { - /* "numpy.pxd":849 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_12; + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; } - __pyx_L11:; + __pyx_L9:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":850 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -21386,13 +22793,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = __pyx_v_f; goto __pyx_L0; - __pyx_r = 0; - goto __pyx_L0; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":783 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -21405,7 +22818,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":965 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -21420,7 +22833,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":967 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":968 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -21431,7 +22844,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "numpy.pxd":968 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":969 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -21443,7 +22856,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":970 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":971 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -21452,7 +22865,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":971 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":972 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -21463,7 +22876,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":972 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":973 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -21472,7 +22885,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":973 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":974 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -21481,10 +22894,19 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":966 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + + /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":975 +/* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -21498,7 +22920,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":976 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":977 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -21508,7 +22930,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { - /* "numpy.pxd":977 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":978 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -21519,11 +22941,10 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; - goto __pyx_L3; } /*else*/ { - /* "numpy.pxd":979 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":980 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -21533,9 +22954,16 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } - __pyx_L3:; - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + + /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); @@ -21546,7 +22974,11 @@ static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Splitter __pyx_vtable_7skle static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_Splitter(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; p = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)o); p->__pyx_vtab = __pyx_vtabptr_7sklearn_4tree_5_tree_Splitter; @@ -21560,13 +22992,17 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_Splitter(PyTypeObject *t, Py static void __pyx_tp_dealloc_7sklearn_4tree_5_tree_Splitter(PyObject *o) { struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *p = (struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_7sklearn_4tree_5_tree_8Splitter_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -21588,8 +23024,8 @@ static int __pyx_tp_traverse_7sklearn_4tree_5_tree_Splitter(PyObject *o, visitpr } static int __pyx_tp_clear_7sklearn_4tree_5_tree_Splitter(PyObject *o) { - struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *p = (struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)o; PyObject* tmp; + struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *p = (struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)o; tmp = ((PyObject*)p->criterion); p->criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -21707,7 +23143,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Splitter = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -21728,13 +23164,17 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_PresortBestSplitter(PyTypeOb static void __pyx_tp_dealloc_7sklearn_4tree_5_tree_PresortBestSplitter(PyObject *o) { struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *p = (struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_7sklearn_4tree_5_tree_19PresortBestSplitter_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -21754,8 +23194,8 @@ static int __pyx_tp_traverse_7sklearn_4tree_5_tree_PresortBestSplitter(PyObject } static int __pyx_tp_clear_7sklearn_4tree_5_tree_PresortBestSplitter(PyObject *o) { - struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *p = (struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *)o; PyObject* tmp; + struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *p = (struct __pyx_obj_7sklearn_4tree_5_tree_PresortBestSplitter *)o; __pyx_tp_clear_7sklearn_4tree_5_tree_Splitter(o); tmp = ((PyObject*)p->X_argsorted); p->X_argsorted = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); @@ -21822,7 +23262,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -21831,7 +23271,11 @@ static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree __pyx_vtable_7sklearn_ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_Tree(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_7sklearn_4tree_5_tree_Tree *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; p = ((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)o); p->__pyx_vtab = __pyx_vtabptr_7sklearn_4tree_5_tree_Tree; @@ -21845,13 +23289,17 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_Tree(PyTypeObject *t, PyObje static void __pyx_tp_dealloc_7sklearn_4tree_5_tree_Tree(PyObject *o) { struct __pyx_obj_7sklearn_4tree_5_tree_Tree *p = (struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)o; + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_7sklearn_4tree_5_tree_4Tree_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -21873,8 +23321,8 @@ static int __pyx_tp_traverse_7sklearn_4tree_5_tree_Tree(PyObject *o, visitproc v } static int __pyx_tp_clear_7sklearn_4tree_5_tree_Tree(PyObject *o) { - struct __pyx_obj_7sklearn_4tree_5_tree_Tree *p = (struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)o; PyObject* tmp; + struct __pyx_obj_7sklearn_4tree_5_tree_Tree *p = (struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)o; tmp = ((PyObject*)p->splitter); p->splitter = ((struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -22155,7 +23603,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Tree = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22229,7 +23677,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_RandomSplitter = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22238,7 +23686,11 @@ static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_TreeBuilder __pyx_vtable_7s static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_TreeBuilder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; p = ((struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *)o); p->__pyx_vtab = __pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder; @@ -22246,6 +23698,11 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_TreeBuilder(PyTypeObject *t, } static void __pyx_tp_dealloc_7sklearn_4tree_5_tree_TreeBuilder(PyObject *o) { + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif (*Py_TYPE(o)->tp_free)(o); } @@ -22308,7 +23765,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_TreeBuilder = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22317,7 +23774,11 @@ static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion __pyx_vtable_7skl static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_Criterion(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } if (unlikely(!o)) return 0; p = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)o); p->__pyx_vtab = __pyx_vtabptr_7sklearn_4tree_5_tree_Criterion; @@ -22325,13 +23786,14 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_Criterion(PyTypeObject *t, C } static void __pyx_tp_dealloc_7sklearn_4tree_5_tree_Criterion(PyObject *o) { + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif (*Py_TYPE(o)->tp_free)(o); } -static PyMethodDef __pyx_methods_7sklearn_4tree_5_tree_Criterion[] = { - {0, 0, 0, 0} -}; - static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Criterion = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("sklearn.tree._tree.Criterion"), /*tp_name*/ @@ -22364,7 +23826,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Criterion = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_4tree_5_tree_Criterion, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22386,7 +23848,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Criterion = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22405,12 +23867,16 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_ClassificationCriterion(PyTy } static void __pyx_tp_dealloc_7sklearn_4tree_5_tree_ClassificationCriterion(PyObject *o) { + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -22478,7 +23944,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_ClassificationCriterion = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22493,10 +23959,6 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_Gini(PyTypeObject *t, PyObje return o; } -static PyMethodDef __pyx_methods_7sklearn_4tree_5_tree_Gini[] = { - {0, 0, 0, 0} -}; - static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Gini = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("sklearn.tree._tree.Gini"), /*tp_name*/ @@ -22529,7 +23991,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Gini = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_4tree_5_tree_Gini, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22551,7 +24013,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Gini = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22570,12 +24032,16 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_RegressionCriterion(PyTypeOb } static void __pyx_tp_dealloc_7sklearn_4tree_5_tree_RegressionCriterion(PyObject *o) { - { + #if PY_VERSION_HEX >= 0x030400a1 + if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_3__dealloc__(o); - if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } @@ -22643,7 +24109,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_RegressionCriterion = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22658,10 +24124,6 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_MSE(PyTypeObject *t, PyObjec return o; } -static PyMethodDef __pyx_methods_7sklearn_4tree_5_tree_MSE[] = { - {0, 0, 0, 0} -}; - static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_MSE = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("sklearn.tree._tree.MSE"), /*tp_name*/ @@ -22694,7 +24156,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_MSE = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_4tree_5_tree_MSE, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22716,7 +24178,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_MSE = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22731,10 +24193,6 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_FriedmanMSE(PyTypeObject *t, return o; } -static PyMethodDef __pyx_methods_7sklearn_4tree_5_tree_FriedmanMSE[] = { - {0, 0, 0, 0} -}; - static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_FriedmanMSE = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("sklearn.tree._tree.FriedmanMSE"), /*tp_name*/ @@ -22767,7 +24225,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_FriedmanMSE = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_4tree_5_tree_FriedmanMSE, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22789,7 +24247,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_FriedmanMSE = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22804,10 +24262,6 @@ static PyObject *__pyx_tp_new_7sklearn_4tree_5_tree_Entropy(PyTypeObject *t, PyO return o; } -static PyMethodDef __pyx_methods_7sklearn_4tree_5_tree_Entropy[] = { - {0, 0, 0, 0} -}; - static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Entropy = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("sklearn.tree._tree.Entropy"), /*tp_name*/ @@ -22840,7 +24294,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Entropy = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7sklearn_4tree_5_tree_Entropy, /*tp_methods*/ + 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -22862,7 +24316,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_Entropy = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -22936,7 +24390,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -23010,7 +24464,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -23084,7 +24538,7 @@ static PyTypeObject __pyx_type_7sklearn_4tree_5_tree_BestSplitter = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif - #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; @@ -23112,100 +24566,100 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, - {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, - {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, - {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, - {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, - {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0}, - {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, - {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, - {&__pyx_n_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 1}, - {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, - {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, - {&__pyx_n_s__DOUBLE, __pyx_k__DOUBLE, sizeof(__pyx_k__DOUBLE), 0, 0, 1, 1}, - {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, - {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1}, - {&__pyx_n_s__NODE_DTYPE, __pyx_k__NODE_DTYPE, sizeof(__pyx_k__NODE_DTYPE), 0, 0, 1, 1}, - {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s__TREE_LEAF, __pyx_k__TREE_LEAF, sizeof(__pyx_k__TREE_LEAF), 0, 0, 1, 1}, - {&__pyx_n_s__TREE_UNDEFINED, __pyx_k__TREE_UNDEFINED, sizeof(__pyx_k__TREE_UNDEFINED), 0, 0, 1, 1}, - {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, - {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, - {&__pyx_n_s____getstate__, __pyx_k____getstate__, sizeof(__pyx_k____getstate__), 0, 0, 1, 1}, - {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, - {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, - {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, - {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, - {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, - {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s__apply, __pyx_k__apply, sizeof(__pyx_k__apply), 0, 0, 1, 1}, - {&__pyx_n_s__argsort, __pyx_k__argsort, sizeof(__pyx_k__argsort), 0, 0, 1, 1}, - {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, - {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1}, - {&__pyx_n_s__asfortranarray, __pyx_k__asfortranarray, sizeof(__pyx_k__asfortranarray), 0, 0, 1, 1}, - {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, - {&__pyx_n_s__build, __pyx_k__build, sizeof(__pyx_k__build), 0, 0, 1, 1}, - {&__pyx_n_s__c_contiguous, __pyx_k__c_contiguous, sizeof(__pyx_k__c_contiguous), 0, 0, 1, 1}, - {&__pyx_n_s__clip, __pyx_k__clip, sizeof(__pyx_k__clip), 0, 0, 1, 1}, - {&__pyx_n_s__contiguous, __pyx_k__contiguous, sizeof(__pyx_k__contiguous), 0, 0, 1, 1}, - {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, - {&__pyx_n_s__criterion, __pyx_k__criterion, sizeof(__pyx_k__criterion), 0, 0, 1, 1}, - {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, - {&__pyx_n_s__feature, __pyx_k__feature, sizeof(__pyx_k__feature), 0, 0, 1, 1}, - {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1}, - {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1}, - {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, - {&__pyx_n_s__formats, __pyx_k__formats, sizeof(__pyx_k__formats), 0, 0, 1, 1}, - {&__pyx_n_s__impurity, __pyx_k__impurity, sizeof(__pyx_k__impurity), 0, 0, 1, 1}, - {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1}, - {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1}, - {&__pyx_n_s__intp, __pyx_k__intp, sizeof(__pyx_k__intp), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__left_child, __pyx_k__left_child, sizeof(__pyx_k__left_child), 0, 0, 1, 1}, - {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, - {&__pyx_n_s__max_depth, __pyx_k__max_depth, sizeof(__pyx_k__max_depth), 0, 0, 1, 1}, - {&__pyx_n_s__max_features, __pyx_k__max_features, sizeof(__pyx_k__max_features), 0, 0, 1, 1}, - {&__pyx_n_s__max_leaf_nodes, __pyx_k__max_leaf_nodes, sizeof(__pyx_k__max_leaf_nodes), 0, 0, 1, 1}, - {&__pyx_n_s__min_samples_leaf, __pyx_k__min_samples_leaf, sizeof(__pyx_k__min_samples_leaf), 0, 0, 1, 1}, - {&__pyx_n_s__min_samples_split, __pyx_k__min_samples_split, sizeof(__pyx_k__min_samples_split), 0, 0, 1, 1}, - {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, - {&__pyx_n_s__n_classes, __pyx_k__n_classes, sizeof(__pyx_k__n_classes), 0, 0, 1, 1}, - {&__pyx_n_s__n_features, __pyx_k__n_features, sizeof(__pyx_k__n_features), 0, 0, 1, 1}, - {&__pyx_n_s__n_outputs, __pyx_k__n_outputs, sizeof(__pyx_k__n_outputs), 0, 0, 1, 1}, - {&__pyx_n_s__n_samples, __pyx_k__n_samples, sizeof(__pyx_k__n_samples), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, - {&__pyx_n_s__node_count, __pyx_k__node_count, sizeof(__pyx_k__node_count), 0, 0, 1, 1}, - {&__pyx_n_s__nodes, __pyx_k__nodes, sizeof(__pyx_k__nodes), 0, 0, 1, 1}, - {&__pyx_n_s__normalize, __pyx_k__normalize, sizeof(__pyx_k__normalize), 0, 0, 1, 1}, - {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, - {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__offsets, __pyx_k__offsets, sizeof(__pyx_k__offsets), 0, 0, 1, 1}, - {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, - {&__pyx_n_s__predict, __pyx_k__predict, sizeof(__pyx_k__predict), 0, 0, 1, 1}, - {&__pyx_n_s__randint, __pyx_k__randint, sizeof(__pyx_k__randint), 0, 0, 1, 1}, - {&__pyx_n_s__random_state, __pyx_k__random_state, sizeof(__pyx_k__random_state), 0, 0, 1, 1}, - {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1}, - {&__pyx_n_s__right_child, __pyx_k__right_child, sizeof(__pyx_k__right_child), 0, 0, 1, 1}, - {&__pyx_n_s__sample_weight, __pyx_k__sample_weight, sizeof(__pyx_k__sample_weight), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__splitter, __pyx_k__splitter, sizeof(__pyx_k__splitter), 0, 0, 1, 1}, - {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1}, - {&__pyx_n_s__take, __pyx_k__take, sizeof(__pyx_k__take), 0, 0, 1, 1}, - {&__pyx_n_s__threshold, __pyx_k__threshold, sizeof(__pyx_k__threshold), 0, 0, 1, 1}, - {&__pyx_n_s__tree, __pyx_k__tree, sizeof(__pyx_k__tree), 0, 0, 1, 1}, - {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1}, - {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, - {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1}, + {&__pyx_n_s_DOUBLE, __pyx_k_DOUBLE, sizeof(__pyx_k_DOUBLE), 0, 0, 1, 1}, + {&__pyx_n_s_DTYPE, __pyx_k_DTYPE, sizeof(__pyx_k_DTYPE), 0, 0, 1, 1}, + {&__pyx_kp_s_Did_not_recognise_loaded_array_l, __pyx_k_Did_not_recognise_loaded_array_l, sizeof(__pyx_k_Did_not_recognise_loaded_array_l), 0, 0, 1, 0}, + {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, + {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, + {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, + {&__pyx_n_s_NODE_DTYPE, __pyx_k_NODE_DTYPE, sizeof(__pyx_k_NODE_DTYPE), 0, 0, 1, 1}, + {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, + {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s_TREE_LEAF, __pyx_k_TREE_LEAF, sizeof(__pyx_k_TREE_LEAF), 0, 0, 1, 1}, + {&__pyx_n_s_TREE_UNDEFINED, __pyx_k_TREE_UNDEFINED, sizeof(__pyx_k_TREE_UNDEFINED), 0, 0, 1, 1}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1}, + {&__pyx_kp_s_You_have_loaded_Tree_version_whi, __pyx_k_You_have_loaded_Tree_version_whi, sizeof(__pyx_k_You_have_loaded_Tree_version_whi), 0, 0, 1, 0}, + {&__pyx_n_s_apply, __pyx_k_apply, sizeof(__pyx_k_apply), 0, 0, 1, 1}, + {&__pyx_n_s_argsort, __pyx_k_argsort, sizeof(__pyx_k_argsort), 0, 0, 1, 1}, + {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1}, + {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1}, + {&__pyx_n_s_asfortranarray, __pyx_k_asfortranarray, sizeof(__pyx_k_asfortranarray), 0, 0, 1, 1}, + {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, + {&__pyx_n_s_build, __pyx_k_build, sizeof(__pyx_k_build), 0, 0, 1, 1}, + {&__pyx_n_s_c_contiguous, __pyx_k_c_contiguous, sizeof(__pyx_k_c_contiguous), 0, 0, 1, 1}, + {&__pyx_n_s_clip, __pyx_k_clip, sizeof(__pyx_k_clip), 0, 0, 1, 1}, + {&__pyx_n_s_compute_feature_importances, __pyx_k_compute_feature_importances, sizeof(__pyx_k_compute_feature_importances), 0, 0, 1, 1}, + {&__pyx_n_s_contiguous, __pyx_k_contiguous, sizeof(__pyx_k_contiguous), 0, 0, 1, 1}, + {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1}, + {&__pyx_n_s_criterion, __pyx_k_criterion, sizeof(__pyx_k_criterion), 0, 0, 1, 1}, + {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, + {&__pyx_kp_s_failed_to_allocate_d_bytes, __pyx_k_failed_to_allocate_d_bytes, sizeof(__pyx_k_failed_to_allocate_d_bytes), 0, 0, 1, 0}, + {&__pyx_n_s_feature, __pyx_k_feature, sizeof(__pyx_k_feature), 0, 0, 1, 1}, + {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, + {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1}, + {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, + {&__pyx_n_s_formats, __pyx_k_formats, sizeof(__pyx_k_formats), 0, 0, 1, 1}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_impurity, __pyx_k_impurity, sizeof(__pyx_k_impurity), 0, 0, 1, 1}, + {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1}, + {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1}, + {&__pyx_n_s_intp, __pyx_k_intp, sizeof(__pyx_k_intp), 0, 0, 1, 1}, + {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1}, + {&__pyx_n_s_left_child, __pyx_k_left_child, sizeof(__pyx_k_left_child), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1}, + {&__pyx_n_s_max_depth, __pyx_k_max_depth, sizeof(__pyx_k_max_depth), 0, 0, 1, 1}, + {&__pyx_n_s_max_features, __pyx_k_max_features, sizeof(__pyx_k_max_features), 0, 0, 1, 1}, + {&__pyx_n_s_max_leaf_nodes, __pyx_k_max_leaf_nodes, sizeof(__pyx_k_max_leaf_nodes), 0, 0, 1, 1}, + {&__pyx_n_s_min_samples_leaf, __pyx_k_min_samples_leaf, sizeof(__pyx_k_min_samples_leaf), 0, 0, 1, 1}, + {&__pyx_n_s_min_samples_split, __pyx_k_min_samples_split, sizeof(__pyx_k_min_samples_split), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_n_classes, __pyx_k_n_classes, sizeof(__pyx_k_n_classes), 0, 0, 1, 1}, + {&__pyx_n_s_n_features, __pyx_k_n_features, sizeof(__pyx_k_n_features), 0, 0, 1, 1}, + {&__pyx_n_s_n_outputs, __pyx_k_n_outputs, sizeof(__pyx_k_n_outputs), 0, 0, 1, 1}, + {&__pyx_n_s_n_samples, __pyx_k_n_samples, sizeof(__pyx_k_n_samples), 0, 0, 1, 1}, + {&__pyx_n_s_names, __pyx_k_names, sizeof(__pyx_k_names), 0, 0, 1, 1}, + {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0}, + {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, + {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, + {&__pyx_n_s_node_count, __pyx_k_node_count, sizeof(__pyx_k_node_count), 0, 0, 1, 1}, + {&__pyx_n_s_nodes, __pyx_k_nodes, sizeof(__pyx_k_nodes), 0, 0, 1, 1}, + {&__pyx_n_s_normalize, __pyx_k_normalize, sizeof(__pyx_k_normalize), 0, 0, 1, 1}, + {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, + {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_n_s_offsets, __pyx_k_offsets, sizeof(__pyx_k_offsets), 0, 0, 1, 1}, + {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1}, + {&__pyx_n_s_predict, __pyx_k_predict, sizeof(__pyx_k_predict), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_releasebuffer, __pyx_k_pyx_releasebuffer, sizeof(__pyx_k_pyx_releasebuffer), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_randint, __pyx_k_randint, sizeof(__pyx_k_randint), 0, 0, 1, 1}, + {&__pyx_n_s_random_state, __pyx_k_random_state, sizeof(__pyx_k_random_state), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 0, 0, 1, 1}, + {&__pyx_n_s_right_child, __pyx_k_right_child, sizeof(__pyx_k_right_child), 0, 0, 1, 1}, + {&__pyx_n_s_sample_weight, __pyx_k_sample_weight, sizeof(__pyx_k_sample_weight), 0, 0, 1, 1}, + {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, + {&__pyx_n_s_splitter, __pyx_k_splitter, sizeof(__pyx_k_splitter), 0, 0, 1, 1}, + {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1}, + {&__pyx_n_s_take, __pyx_k_take, sizeof(__pyx_k_take), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_threshold, __pyx_k_threshold, sizeof(__pyx_k_threshold), 0, 0, 1, 1}, + {&__pyx_n_s_tree, __pyx_k_tree, sizeof(__pyx_k_tree), 0, 0, 1, 1}, + {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, + {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, + {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, + {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -23215,93 +24669,93 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/tree/_tree.pyx":2049 + /* "sklearn/tree/_tree.pyx":2128 * * if 'nodes' not in d: * raise ValueError('You have loaded Tree version which ' # <<<<<<<<<<<<<< * 'cannot be imported') * */ - __pyx_k_tuple_3 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2049; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_3); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_You_have_loaded_Tree_version_whi); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); - /* "sklearn/tree/_tree.pyx":2062 + /* "sklearn/tree/_tree.pyx":2141 * or not value_ndarray.flags.c_contiguous * or value_ndarray.dtype != np.float64): * raise ValueError('Did not recognise loaded array layout') # <<<<<<<<<<<<<< * * self.capacity = node_ndarray.shape[0] */ - __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_5); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Did_not_recognise_loaded_array_l); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); - /* "numpy.pxd":215 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_10); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); - /* "numpy.pxd":219 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_12); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); - /* "numpy.pxd":257 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_14); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); - /* "numpy.pxd":799 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":799 * - * if (end - f) - (new_offset - offset[0]) < 15: + * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_17 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_16)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_17); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); - /* "numpy.pxd":803 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_13)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_18); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "numpy.pxd":823 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_20 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_19)); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_20); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -23311,11 +24765,10 @@ static int __Pyx_InitCachedConstants(void) { static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -23381,14 +24834,6 @@ PyMODINIT_FUNC PyInit__tree(void) if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_d); - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!PyDict_GetItemString(modules, "sklearn.tree._tree")) { - if (unlikely(PyDict_SetItemString(modules, "sklearn.tree._tree", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - } - #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); @@ -23400,8 +24845,16 @@ PyMODINIT_FUNC PyInit__tree(void) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__pyx_module_is_main_sklearn__tree___tree) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.tree._tree")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.tree._tree", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } } + #endif /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ @@ -23416,6 +24869,7 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_Splitter.node_split = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *, double, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, double *, double *, double *, double *))__pyx_f_7sklearn_4tree_5_tree_8Splitter_node_split; __pyx_vtable_7sklearn_4tree_5_tree_Splitter.node_value = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *, double *))__pyx_f_7sklearn_4tree_5_tree_8Splitter_node_value; if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Splitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_Splitter.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_Splitter.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_Splitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "Splitter", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_Splitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_Splitter = &__pyx_type_7sklearn_4tree_5_tree_Splitter; @@ -23424,9 +24878,10 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_PresortBestSplitter.__pyx_base.init = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *, PyArrayObject *, PyArrayObject *, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *))__pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_init; __pyx_vtable_7sklearn_4tree_5_tree_PresortBestSplitter.__pyx_base.node_split = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *, double, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, double *, double *, double *, double *))__pyx_f_7sklearn_4tree_5_tree_19PresortBestSplitter_node_split; __pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_Splitter; - if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_PresortBestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PresortBestSplitter", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_PresortBestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PresortBestSplitter", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_PresortBestSplitter = &__pyx_type_7sklearn_4tree_5_tree_PresortBestSplitter; __pyx_vtabptr_7sklearn_4tree_5_tree_Tree = &__pyx_vtable_7sklearn_4tree_5_tree_Tree; __pyx_vtable_7sklearn_4tree_5_tree_Tree._add_node = (__pyx_t_7sklearn_4tree_5_tree_SIZE_t (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, int, int, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, double, double, __pyx_t_7sklearn_4tree_5_tree_SIZE_t))__pyx_f_7sklearn_4tree_5_tree_4Tree__add_node; @@ -23437,23 +24892,26 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_Tree.predict = (PyArrayObject *(*)(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_4tree_5_tree_4Tree_predict; __pyx_vtable_7sklearn_4tree_5_tree_Tree.apply = (PyArrayObject *(*)(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_4tree_5_tree_4Tree_apply; __pyx_vtable_7sklearn_4tree_5_tree_Tree.compute_feature_importances = (PyObject *(*)(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_compute_feature_importances *__pyx_optional_args))__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances; - if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Tree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_Tree.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_Tree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Tree", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_Tree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Tree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_Tree.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_Tree.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_Tree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Tree", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_Tree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_Tree = &__pyx_type_7sklearn_4tree_5_tree_Tree; __pyx_vtabptr_7sklearn_4tree_5_tree_RandomSplitter = &__pyx_vtable_7sklearn_4tree_5_tree_RandomSplitter; __pyx_vtable_7sklearn_4tree_5_tree_RandomSplitter.__pyx_base = *__pyx_vtabptr_7sklearn_4tree_5_tree_Splitter; __pyx_vtable_7sklearn_4tree_5_tree_RandomSplitter.__pyx_base.node_split = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *, double, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, double *, double *, double *, double *))__pyx_f_7sklearn_4tree_5_tree_14RandomSplitter_node_split; __pyx_type_7sklearn_4tree_5_tree_RandomSplitter.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_Splitter; - if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_RandomSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_RandomSplitter.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_RandomSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "RandomSplitter", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_RandomSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_RandomSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_RandomSplitter.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_RandomSplitter.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_RandomSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "RandomSplitter", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_RandomSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_RandomSplitter = &__pyx_type_7sklearn_4tree_5_tree_RandomSplitter; __pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder = &__pyx_vtable_7sklearn_4tree_5_tree_TreeBuilder; __pyx_vtable_7sklearn_4tree_5_tree_TreeBuilder.build = (PyObject *(*)(struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_4tree_5_tree_11TreeBuilder_build *__pyx_optional_args))__pyx_f_7sklearn_4tree_5_tree_11TreeBuilder_build; - if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_TreeBuilder.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "TreeBuilder", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_TreeBuilder.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_TreeBuilder.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "TreeBuilder", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_TreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_TreeBuilder = &__pyx_type_7sklearn_4tree_5_tree_TreeBuilder; __pyx_vtabptr_7sklearn_4tree_5_tree_Criterion = &__pyx_vtable_7sklearn_4tree_5_tree_Criterion; __pyx_vtable_7sklearn_4tree_5_tree_Criterion.init = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t, __pyx_t_7sklearn_4tree_5_tree_SIZE_t))__pyx_f_7sklearn_4tree_5_tree_9Criterion_init; @@ -23464,6 +24922,7 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_Criterion.node_value = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *))__pyx_f_7sklearn_4tree_5_tree_9Criterion_node_value; __pyx_vtable_7sklearn_4tree_5_tree_Criterion.impurity_improvement = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double))__pyx_f_7sklearn_4tree_5_tree_9Criterion_impurity_improvement; if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Criterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_Criterion.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_Criterion.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_Criterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "Criterion", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_Criterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_Criterion = &__pyx_type_7sklearn_4tree_5_tree_Criterion; @@ -23477,6 +24936,7 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_ClassificationCriterion.__pyx_base.node_value = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *))__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_node_value; __pyx_type_7sklearn_4tree_5_tree_ClassificationCriterion.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_Criterion; if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_ClassificationCriterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_ClassificationCriterion.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_ClassificationCriterion.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_ClassificationCriterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "ClassificationCriterion", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_ClassificationCriterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_ClassificationCriterion = &__pyx_type_7sklearn_4tree_5_tree_ClassificationCriterion; @@ -23486,6 +24946,7 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_Gini.__pyx_base.__pyx_base.children_impurity = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *, double *))__pyx_f_7sklearn_4tree_5_tree_4Gini_children_impurity; __pyx_type_7sklearn_4tree_5_tree_Gini.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_ClassificationCriterion; if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Gini) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_Gini.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_Gini.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_Gini) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "Gini", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_Gini) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_Gini = &__pyx_type_7sklearn_4tree_5_tree_Gini; @@ -23499,6 +24960,7 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_RegressionCriterion.__pyx_base.node_value = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *))__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_node_value; __pyx_type_7sklearn_4tree_5_tree_RegressionCriterion.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_Criterion; if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_RegressionCriterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_RegressionCriterion.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_RegressionCriterion.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_RegressionCriterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "RegressionCriterion", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_RegressionCriterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_RegressionCriterion = &__pyx_type_7sklearn_4tree_5_tree_RegressionCriterion; @@ -23508,6 +24970,7 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_MSE.__pyx_base.__pyx_base.children_impurity = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *, double *))__pyx_f_7sklearn_4tree_5_tree_3MSE_children_impurity; __pyx_type_7sklearn_4tree_5_tree_MSE.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_RegressionCriterion; if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_MSE) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_MSE.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_MSE.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_MSE) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "MSE", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_MSE) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_MSE = &__pyx_type_7sklearn_4tree_5_tree_MSE; @@ -23516,6 +24979,7 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_FriedmanMSE.__pyx_base.__pyx_base.__pyx_base.impurity_improvement = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double))__pyx_f_7sklearn_4tree_5_tree_11FriedmanMSE_impurity_improvement; __pyx_type_7sklearn_4tree_5_tree_FriedmanMSE.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_MSE; if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_FriedmanMSE) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_FriedmanMSE.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_FriedmanMSE.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_FriedmanMSE) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "FriedmanMSE", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_FriedmanMSE) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_FriedmanMSE = &__pyx_type_7sklearn_4tree_5_tree_FriedmanMSE; @@ -23525,6 +24989,7 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_Entropy.__pyx_base.__pyx_base.children_impurity = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *, double *))__pyx_f_7sklearn_4tree_5_tree_7Entropy_children_impurity; __pyx_type_7sklearn_4tree_5_tree_Entropy.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_ClassificationCriterion; if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Entropy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_Entropy.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_Entropy.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_Entropy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "Entropy", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_Entropy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_Entropy = &__pyx_type_7sklearn_4tree_5_tree_Entropy; @@ -23532,25 +24997,28 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_BestFirstTreeBuilder.__pyx_base = *__pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder; __pyx_vtable_7sklearn_4tree_5_tree_BestFirstTreeBuilder.__pyx_base.build = (PyObject *(*)(struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_4tree_5_tree_11TreeBuilder_build *__pyx_optional_args))__pyx_f_7sklearn_4tree_5_tree_20BestFirstTreeBuilder_build; __pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_TreeBuilder; - if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_BestFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BestFirstTreeBuilder", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_BestFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BestFirstTreeBuilder", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_BestFirstTreeBuilder = &__pyx_type_7sklearn_4tree_5_tree_BestFirstTreeBuilder; __pyx_vtabptr_7sklearn_4tree_5_tree_DepthFirstTreeBuilder = &__pyx_vtable_7sklearn_4tree_5_tree_DepthFirstTreeBuilder; __pyx_vtable_7sklearn_4tree_5_tree_DepthFirstTreeBuilder.__pyx_base = *__pyx_vtabptr_7sklearn_4tree_5_tree_TreeBuilder; __pyx_vtable_7sklearn_4tree_5_tree_DepthFirstTreeBuilder.__pyx_base.build = (PyObject *(*)(struct __pyx_obj_7sklearn_4tree_5_tree_TreeBuilder *, struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_4tree_5_tree_11TreeBuilder_build *__pyx_optional_args))__pyx_f_7sklearn_4tree_5_tree_21DepthFirstTreeBuilder_build; __pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_TreeBuilder; - if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_DepthFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "DepthFirstTreeBuilder", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_DepthFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "DepthFirstTreeBuilder", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_DepthFirstTreeBuilder = &__pyx_type_7sklearn_4tree_5_tree_DepthFirstTreeBuilder; __pyx_vtabptr_7sklearn_4tree_5_tree_BestSplitter = &__pyx_vtable_7sklearn_4tree_5_tree_BestSplitter; __pyx_vtable_7sklearn_4tree_5_tree_BestSplitter.__pyx_base = *__pyx_vtabptr_7sklearn_4tree_5_tree_Splitter; __pyx_vtable_7sklearn_4tree_5_tree_BestSplitter.__pyx_base.node_split = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Splitter *, double, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, __pyx_t_7sklearn_4tree_5_tree_SIZE_t *, double *, double *, double *, double *))__pyx_f_7sklearn_4tree_5_tree_12BestSplitter_node_split; __pyx_type_7sklearn_4tree_5_tree_BestSplitter.tp_base = __pyx_ptype_7sklearn_4tree_5_tree_Splitter; - if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_BestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_BestSplitter.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_BestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BestSplitter", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_BestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_BestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_type_7sklearn_4tree_5_tree_BestSplitter.tp_print = 0; + if (__Pyx_SetVtable(__pyx_type_7sklearn_4tree_5_tree_BestSplitter.tp_dict, __pyx_vtabptr_7sklearn_4tree_5_tree_BestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BestSplitter", (PyObject *)&__pyx_type_7sklearn_4tree_5_tree_BestSplitter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_BestSplitter = &__pyx_type_7sklearn_4tree_5_tree_BestSplitter; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -23582,9 +25050,9 @@ PyMODINIT_FUNC PyInit__tree(void) * cimport numpy as np * np.import_array() */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/tree/_tree.pyx":26 @@ -23605,15 +25073,15 @@ PyMODINIT_FUNC PyInit__tree(void) */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__float32)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_float32); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_float32); + __Pyx_GIVEREF(__pyx_n_s_float32); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__DTYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -23626,15 +25094,15 @@ PyMODINIT_FUNC PyInit__tree(void) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_n_s__float64)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__float64)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_n_s_float64); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_float64); + __Pyx_GIVEREF(__pyx_n_s_float64); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__DOUBLE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DOUBLE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -23645,9 +25113,9 @@ PyMODINIT_FUNC PyInit__tree(void) * TREE_LEAF = -1 * TREE_UNDEFINED = -2 */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -23661,7 +25129,7 @@ PyMODINIT_FUNC PyInit__tree(void) * TREE_UNDEFINED = -2 * cdef SIZE_t _TREE_LEAF = TREE_LEAF */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s__TREE_LEAF, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TREE_LEAF, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/tree/_tree.pyx":43 * cdef double INFINITY = np.inf @@ -23670,7 +25138,7 @@ PyMODINIT_FUNC PyInit__tree(void) * cdef SIZE_t _TREE_LEAF = TREE_LEAF * cdef SIZE_t _TREE_UNDEFINED = TREE_UNDEFINED */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s__TREE_UNDEFINED, __pyx_int_neg_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_TREE_UNDEFINED, __pyx_int_neg_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/tree/_tree.pyx":44 * TREE_LEAF = -1 @@ -23679,9 +25147,9 @@ PyMODINIT_FUNC PyInit__tree(void) * cdef SIZE_t _TREE_UNDEFINED = TREE_UNDEFINED * cdef double EPSILON_DBL = 1e-7 */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__TREE_LEAF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_TREE_LEAF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF = __pyx_t_4; @@ -23692,9 +25160,9 @@ PyMODINIT_FUNC PyInit__tree(void) * cdef double EPSILON_DBL = 1e-7 * cdef float EPSILON_FLT = 1e-7 */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__TREE_UNDEFINED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_TREE_UNDEFINED); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_from_py_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_As_Py_intptr_t(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_intp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_7sklearn_4tree_5_tree__TREE_UNDEFINED = __pyx_t_4; @@ -23769,7 +25237,7 @@ PyMODINIT_FUNC PyInit__tree(void) * 'n_samples'], */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); /* "sklearn/tree/_tree.pyx":64 * # Repeat struct definition for numpy @@ -23780,62 +25248,62 @@ PyMODINIT_FUNC PyInit__tree(void) */ __pyx_t_1 = PyList_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_n_s__left_child)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__left_child)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__left_child)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__right_child)); - PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__right_child)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__right_child)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__feature)); - PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__feature)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__feature)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__threshold)); - PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__threshold)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__threshold)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__impurity)); - PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__impurity)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__impurity)); - __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); - PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__n_samples)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_samples)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__names), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_n_s_left_child); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_left_child); + __Pyx_GIVEREF(__pyx_n_s_left_child); + __Pyx_INCREF(__pyx_n_s_right_child); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_right_child); + __Pyx_GIVEREF(__pyx_n_s_right_child); + __Pyx_INCREF(__pyx_n_s_feature); + PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_feature); + __Pyx_GIVEREF(__pyx_n_s_feature); + __Pyx_INCREF(__pyx_n_s_threshold); + PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_threshold); + __Pyx_GIVEREF(__pyx_n_s_threshold); + __Pyx_INCREF(__pyx_n_s_impurity); + PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_impurity); + __Pyx_GIVEREF(__pyx_n_s_impurity); + __Pyx_INCREF(__pyx_n_s_n_samples); + PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_n_samples); + __Pyx_GIVEREF(__pyx_n_s_n_samples); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_names, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/tree/_tree.pyx":66 * 'names': ['left_child', 'right_child', 'feature', 'threshold', 'impurity', * 'n_samples'], * 'formats': [np.intp, np.intp, np.intp, np.float64, np.float64, np.intp], # <<<<<<<<<<<<<< * 'offsets': [ - * &( NULL).left_child, + * &( NULL).left_child, */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__intp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_intp); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__intp); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_intp); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__intp); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_intp); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__intp); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_intp); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -23858,68 +25326,76 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__formats), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_formats, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/tree/_tree.pyx":68 * 'formats': [np.intp, np.intp, np.intp, np.float64, np.float64, np.intp], * 'offsets': [ - * &( NULL).left_child, # <<<<<<<<<<<<<< - * &( NULL).right_child, - * &( NULL).feature, + * &( NULL).left_child, # <<<<<<<<<<<<<< + * &( NULL).right_child, + * &( NULL).feature, */ __pyx_t_1 = PyInt_FromSsize_t(((Py_ssize_t)(&((struct __pyx_t_7sklearn_4tree_5_tree_Node *)NULL)->left_child))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); /* "sklearn/tree/_tree.pyx":69 * 'offsets': [ - * &( NULL).left_child, - * &( NULL).right_child, # <<<<<<<<<<<<<< - * &( NULL).feature, - * &( NULL).threshold, + * &( NULL).left_child, + * &( NULL).right_child, # <<<<<<<<<<<<<< + * &( NULL).feature, + * &( NULL).threshold, */ __pyx_t_10 = PyInt_FromSsize_t(((Py_ssize_t)(&((struct __pyx_t_7sklearn_4tree_5_tree_Node *)NULL)->right_child))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); /* "sklearn/tree/_tree.pyx":70 - * &( NULL).left_child, - * &( NULL).right_child, - * &( NULL).feature, # <<<<<<<<<<<<<< - * &( NULL).threshold, - * &( NULL).impurity, + * &( NULL).left_child, + * &( NULL).right_child, + * &( NULL).feature, # <<<<<<<<<<<<<< + * &( NULL).threshold, + * &( NULL).impurity, */ __pyx_t_9 = PyInt_FromSsize_t(((Py_ssize_t)(&((struct __pyx_t_7sklearn_4tree_5_tree_Node *)NULL)->feature))); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); /* "sklearn/tree/_tree.pyx":71 - * &( NULL).right_child, - * &( NULL).feature, - * &( NULL).threshold, # <<<<<<<<<<<<<< - * &( NULL).impurity, - * &( NULL).n_samples, + * &( NULL).right_child, + * &( NULL).feature, + * &( NULL).threshold, # <<<<<<<<<<<<<< + * &( NULL).impurity, + * &( NULL).n_samples, */ __pyx_t_8 = PyInt_FromSsize_t(((Py_ssize_t)(&((struct __pyx_t_7sklearn_4tree_5_tree_Node *)NULL)->threshold))); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); /* "sklearn/tree/_tree.pyx":72 - * &( NULL).feature, - * &( NULL).threshold, - * &( NULL).impurity, # <<<<<<<<<<<<<< - * &( NULL).n_samples, + * &( NULL).feature, + * &( NULL).threshold, + * &( NULL).impurity, # <<<<<<<<<<<<<< + * &( NULL).n_samples, * ] */ __pyx_t_7 = PyInt_FromSsize_t(((Py_ssize_t)(&((struct __pyx_t_7sklearn_4tree_5_tree_Node *)NULL)->impurity))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); /* "sklearn/tree/_tree.pyx":73 - * &( NULL).threshold, - * &( NULL).impurity, - * &( NULL).n_samples, # <<<<<<<<<<<<<< + * &( NULL).threshold, + * &( NULL).impurity, + * &( NULL).n_samples, # <<<<<<<<<<<<<< * ] * }) */ __pyx_t_6 = PyInt_FromSsize_t(((Py_ssize_t)(&((struct __pyx_t_7sklearn_4tree_5_tree_Node *)NULL)->n_samples))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); + + /* "sklearn/tree/_tree.pyx":67 + * 'n_samples'], + * 'formats': [np.intp, np.intp, np.intp, np.float64, np.float64, np.intp], + * 'offsets': [ # <<<<<<<<<<<<<< + * &( NULL).left_child, + * &( NULL).right_child, + */ __pyx_t_5 = PyList_New(6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); @@ -23940,40 +25416,35 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__offsets), ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_offsets, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "sklearn/tree/_tree.pyx":63 + * + * # Repeat struct definition for numpy + * NODE_DTYPE = np.dtype({ # <<<<<<<<<<<<<< + * 'names': ['left_child', 'right_child', 'feature', 'threshold', 'impurity', + * 'n_samples'], + */ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5numpy_dtype)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s__NODE_DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_NODE_DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":2077 + /* "sklearn/tree/_tree.pyx":2156 * # XXX using (size_t)(-1) is ugly, but SIZE_MAX is not available in C89 * # (i.e., older MSVC). * cdef int _resize_c(self, SIZE_t capacity=(-1)) nogil: # <<<<<<<<<<<<<< * """Guts of _resize. Returns 0 for success, -1 for error.""" * if capacity == self.capacity and self.nodes != NULL: */ - __pyx_k_6 = ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)-1); - - /* "sklearn/tree/_tree.pyx":2186 - * return out - * - * cpdef compute_feature_importances(self, normalize=True): # <<<<<<<<<<<<<< - * """Computes the importance of each feature (aka variable).""" - * cdef SIZE_t n_left - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_k_7 = __pyx_t_2; - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; + __pyx_k__3 = ((__pyx_t_7sklearn_4tree_5_tree_SIZE_t)-1); /* "sklearn/tree/_tree.pyx":1 * # cython: cdivision=True # <<<<<<<<<<<<<< @@ -23981,11 +25452,11 @@ PyMODINIT_FUNC PyInit__tree(void) * # cython: wraparound=False */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "numpy.pxd":975 + /* "/usr/local/lib/python2.7/dist-packages/Cython/Includes/numpy/__init__.pxd":976 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -24041,7 +25512,7 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else - "name '%s' is not defined", PyString_AS_STRING(name)); + "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; @@ -24067,7 +25538,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -24171,12 +25642,12 @@ static int __Pyx_ParseOptionalKeywords( goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); + "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", + "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", @@ -24186,23 +25657,29 @@ static int __Pyx_ParseOptionalKeywords( return -1; } -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, +static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); +} +static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { - if (Py_TYPE(obj) == type) return 1; + if (likely(Py_TYPE(obj) == type)) return 1; + #if PY_MAJOR_VERSION == 2 + else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif } else { - if (PyObject_TypeCheck(obj, type)) return 1; + if (likely(PyObject_TypeCheck(obj, type))) return 1; } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); + __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } @@ -24781,10 +26258,18 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb } static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else @@ -24801,7 +26286,7 @@ static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); + PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) @@ -24914,27 +26399,40 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyEval_CallObject(type, args); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + if (PyObject_IsSubclass(instance_class, type)) { + type = instance_class; + } else { + instance_class = NULL; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } } } else { PyErr_SetString(PyExc_TypeError, @@ -25156,7 +26654,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } static void __Pyx_RaiseBufferFallbackError(void) { - PyErr_Format(PyExc_ValueError, + PyErr_SetString(PyExc_ValueError, "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } @@ -25167,7 +26665,7 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } @@ -25175,51 +26673,6 @@ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } - } - return 0; -#endif -} - -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; -} - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) PyObject *ob = PyCapsule_New(vtable, 0, 0); @@ -25228,7 +26681,7 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #endif if (!ob) goto bad; - if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) + if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; @@ -25239,7 +26692,7 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { static void* __Pyx_GetVtable(PyObject *dict) { void* ptr; - PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__); + PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable); if (!ob) goto bad; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) @@ -25269,85 +26722,271 @@ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { return value; } -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { - const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(Py_intptr_t) == sizeof(char)) || - (sizeof(Py_intptr_t) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(Py_intptr_t) == sizeof(int)) || - (sizeof(Py_intptr_t) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) { + const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(Py_intptr_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } } else { + if (sizeof(Py_intptr_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(Py_intptr_t) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; + unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), little, !is_unsigned); } } -static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject* x) { - const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(Py_intptr_t) == sizeof(char)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedChar(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(Py_intptr_t) == sizeof(short)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedShort(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(Py_intptr_t) == sizeof(int)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedInt(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(Py_intptr_t) == sizeof(long)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedLong(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (Py_intptr_t)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (Py_intptr_t)__Pyx_PyInt_AsSignedLongLong(x); - } else { - #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); - #else +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func) \ + { \ + func_type value = func(x); \ + if (sizeof(target_type) < sizeof(func_type)) { \ + if (unlikely(value != (func_type) (target_type) value)) { \ + func_type zero = 0; \ + PyErr_SetString(PyExc_OverflowError, \ + (is_unsigned && unlikely(value < zero)) ? \ + "can't convert negative value to " #target_type : \ + "value too large to convert to " #target_type); \ + return (target_type) -1; \ + } \ + } \ + return (target_type) value; \ + } + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif +static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) { + const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(Py_intptr_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to Py_intptr_t"); + return (Py_intptr_t) -1; + } + return (Py_intptr_t) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(Py_intptr_t)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (Py_intptr_t) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to Py_intptr_t"); + return (Py_intptr_t) -1; + } + if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong) + } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long long, PyLong_AsUnsignedLongLong) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(Py_intptr_t)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(Py_intptr_t) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(Py_intptr_t) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (sizeof(Py_intptr_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyLong_AsLong) + } else if (sizeof(Py_intptr_t) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(Py_intptr_t, long long, PyLong_AsLongLong) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + Py_intptr_t val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (Py_intptr_t) -1; + } + } else { Py_intptr_t val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (Py_intptr_t) -1; + val = __Pyx_PyInt_As_Py_intptr_t(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(int) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); } - #endif - return (Py_intptr_t)-1; + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(int)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (int) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; + } + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong) + } else if (sizeof(int) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(int)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(int) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(int) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong) + } else if (sizeof(int) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; } } @@ -25359,7 +26998,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif @@ -25442,7 +27081,7 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict) { PyObject *getbuffer_cobj = PyObject_GetItem( - obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer); + obj->ob_type->tp_dict, __pyx_n_s_pyx_getbuffer); if (getbuffer_cobj) { getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); Py_DECREF(getbuffer_cobj); @@ -25454,7 +27093,7 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { } } #endif - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); + PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name); #if PY_VERSION_HEX < 0x02060000 fail: #endif @@ -25473,7 +27112,7 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict) { PyObject *releasebuffer_cobj = PyObject_GetItem( - obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer); + obj->ob_type->tp_dict, __pyx_n_s_pyx_releasebuffer); if (releasebuffer_cobj) { releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); Py_DECREF(releasebuffer_cobj); @@ -25498,79 +27137,148 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { #endif /* PY_MAJOR_VERSION < 3 */ - static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject* x) { - const npy_uint32 neg_one = (npy_uint32)-1, const_zero = (npy_uint32)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(npy_uint32) == sizeof(char)) { - if (is_unsigned) - return (npy_uint32)__Pyx_PyInt_AsUnsignedChar(x); - else - return (npy_uint32)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(npy_uint32) == sizeof(short)) { - if (is_unsigned) - return (npy_uint32)__Pyx_PyInt_AsUnsignedShort(x); - else - return (npy_uint32)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(npy_uint32) == sizeof(int)) { - if (is_unsigned) - return (npy_uint32)__Pyx_PyInt_AsUnsignedInt(x); - else - return (npy_uint32)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(npy_uint32) == sizeof(long)) { - if (is_unsigned) - return (npy_uint32)__Pyx_PyInt_AsUnsignedLong(x); - else - return (npy_uint32)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(npy_uint32) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (npy_uint32)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (npy_uint32)__Pyx_PyInt_AsSignedLongLong(x); - } else { - #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); - #else - npy_uint32 val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; + #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif +static CYTHON_INLINE npy_uint32 __Pyx_PyInt_As_npy_uint32(PyObject *x) { + const npy_uint32 neg_one = (npy_uint32) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(npy_uint32) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(npy_uint32, long, PyInt_AS_LONG) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to npy_uint32"); + return (npy_uint32) -1; + } + return (npy_uint32) val; } - #endif - return (npy_uint32)-1; - } -} - -static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { - long t = b; - switch (e) { - case 3: - t *= b; - case 2: - t *= b; - case 1: - return t; - case 0: - return 1; - } - #if 1 - if (unlikely(e<0)) return 0; - #endif - t = 1; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(npy_uint32)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (npy_uint32) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to npy_uint32"); + return (npy_uint32) -1; + } + if (sizeof(npy_uint32) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long, PyLong_AsUnsignedLong) + } else if (sizeof(npy_uint32) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(npy_uint32, unsigned long long, PyLong_AsUnsignedLongLong) + } + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(npy_uint32)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(npy_uint32) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(npy_uint32) ((PyLongObject*)x)->ob_digit[0]; + } + } + #endif +#endif + if (sizeof(npy_uint32) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(npy_uint32, long, PyLong_AsLong) + } else if (sizeof(npy_uint32) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(npy_uint32, long long, PyLong_AsLongLong) + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + npy_uint32 val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (npy_uint32) -1; + } + } else { + npy_uint32 val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (npy_uint32) -1; + val = __Pyx_PyInt_As_npy_uint32(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) -1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(long) <= sizeof(unsigned long long)) { + return PyLong_FromUnsignedLongLong((unsigned long long) value); + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(long long)) { + return PyLong_FromLongLong((long long) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + +static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { + long t = b; + switch (e) { + case 3: + t *= b; + case 2: + t *= b; + case 1: + return t; + case 0: + return 1; + } + #if 1 + if (unlikely(e<0)) return 0; + #endif + t = 1; while (likely(e)) { t *= (b * (e&1)) | ((~e)&1); /* 1 or b */ b *= b; @@ -25819,358 +27527,54 @@ static CYTHON_INLINE long __Pyx_pow_long(long b, long e) { #endif #endif -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { - const unsigned char neg_one = (unsigned char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned char" : - "value too large to convert to unsigned char"); - } - return (unsigned char)-1; - } - return (unsigned char)val; - } - return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { - const unsigned short neg_one = (unsigned short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned short" : - "value too large to convert to unsigned short"); - } - return (unsigned short)-1; - } - return (unsigned short)val; - } - return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { - const unsigned int neg_one = (unsigned int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(unsigned int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(unsigned int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to unsigned int" : - "value too large to convert to unsigned int"); - } - return (unsigned int)-1; - } - return (unsigned int)val; - } - return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); -} - -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { - const char neg_one = (char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to char" : - "value too large to convert to char"); - } - return (char)-1; - } - return (char)val; - } - return (char)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { - const short neg_one = (short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to short" : - "value too large to convert to short"); - } - return (short)-1; - } - return (short)val; - } - return (short)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { - const signed char neg_one = (signed char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed char) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed char)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed char" : - "value too large to convert to signed char"); - } - return (signed char)-1; - } - return (signed char)val; - } - return (signed char)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { - const signed short neg_one = (signed short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed short) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed short)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed short" : - "value too large to convert to signed short"); - } - return (signed short)-1; - } - return (signed short)val; - } - return (signed short)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(signed int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(signed int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to signed int" : - "value too large to convert to signed int"); - } - return (signed int)-1; - } - return (signed int)val; - } - return (signed int)__Pyx_PyInt_AsSignedLong(x); -} - -static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(int) < sizeof(long)) { - long val = __Pyx_PyInt_AsLong(x); - if (unlikely(val != (long)(int)val)) { - if (!unlikely(val == -1 && PyErr_Occurred())) { - PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? - "can't convert negative value to int" : - "value too large to convert to int"); - } - return (int)-1; - } - return (int)val; - } - return (int)__Pyx_PyInt_AsLong(x); -} - #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif #endif -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { - const unsigned long neg_one = (unsigned long)-1, const_zero = 0; +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return (unsigned long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return (unsigned long)PyLong_AsUnsignedLong(x); + if (sizeof(long) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG) } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - return (unsigned long)PyLong_AsLong(x); - } - } else { - unsigned long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned long)-1; - val = __Pyx_PyInt_AsUnsignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return (unsigned PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } + "can't convert negative value to long"); + return (long) -1; } -#endif -#endif - return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + return (long) val; } - } else { - unsigned PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (unsigned PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { - const long neg_one = (long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS + #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; } } -#endif + #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); - return (long)-1; + return (long) -1; + } + if (sizeof(long) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong) + } else if (sizeof(long) <= sizeof(unsigned long long)) { + __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong) } - return (long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS + #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; @@ -26178,198 +27582,46 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; } } + #endif #endif -#endif - return (long)PyLong_AsLong(x); - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (long)-1; - val = __Pyx_PyInt_AsLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { - const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return (PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - return (PY_LONG_LONG)PyLong_AsLongLong(x); - } - } else { - PY_LONG_LONG val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { - const signed long neg_one = (signed long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return (signed long)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; + if (sizeof(long) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong) + } else if (sizeof(long) <= sizeof(long long)) { + __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong) } - return (signed long)PyLong_AsUnsignedLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - return (signed long)PyLong_AsLong(x); } - } else { - signed long val; - PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed long)-1; - val = __Pyx_PyInt_AsSignedLong(tmp); - Py_DECREF(tmp); - return val; - } -} - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS -#include "longintrepr.h" -#endif -#endif -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { - const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; - } - return (signed PY_LONG_LONG)val; - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } - } -#endif -#endif - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + long val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); } - return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); - } else { -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 -#if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; - } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; } #endif -#endif - return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + return (long) -1; } } else { - signed PY_LONG_LONG val; + long val; PyObject *tmp = __Pyx_PyNumber_Int(x); - if (!tmp) return (signed PY_LONG_LONG)-1; - val = __Pyx_PyInt_AsSignedLongLong(tmp); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } @@ -26439,7 +27691,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, - "%s.%s is not a type object", + "%.200s.%.200s is not a type object", module_name, class_name); goto bad; } @@ -26467,7 +27719,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s has the wrong size, try recompiling", + "%.200s.%.200s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -26720,10 +27972,16 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_ #endif /* PY_VERSION_HEX < 0x03030000 */ } else #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ +#if PY_VERSION_HEX >= 0x02060000 + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); - if (r < 0) { + if (unlikely(r < 0)) { return NULL; } else { return result; @@ -26768,7 +28026,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, - "__%s__ returned non-%s (type %.200s)", + "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; @@ -26780,9 +28038,35 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { } return res; } +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) + return PyInt_AS_LONG(b); +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + switch (Py_SIZE(b)) { + case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0]; + case 0: return 0; + case 1: return ((PyLongObject*)b)->ob_digit[0]; + } + #endif + #endif + #if PY_VERSION_HEX < 0x02060000 + return PyInt_AsSsize_t(b); + #else + return PyLong_AsSsize_t(b); + #endif + } + x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); @@ -26801,16 +28085,6 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); #endif } -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { - unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); - if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { - if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t)-1; - } - return (size_t)val; -} #endif /* Py_PYTHON_H */ diff --git a/sklearn/tree/_tree.pxd b/sklearn/tree/_tree.pxd index e42bacaef764b..f58140a12a93b 100644 --- a/sklearn/tree/_tree.pxd +++ b/sklearn/tree/_tree.pxd @@ -67,12 +67,13 @@ cdef class Splitter: cdef public SIZE_t min_samples_leaf # Min samples in a leaf cdef object random_state # Random state - cdef UINT32_t rand_r_state # sklearn_rand_r random number state + cdef UINT32_t rand_r_state # sklearn_rand_r random number state cdef SIZE_t* samples # Sample indices in X, y cdef SIZE_t n_samples # X.shape[0] cdef SIZE_t* features # Feature indices in X cdef SIZE_t n_features # X.shape[1] + cdef DTYPE_t* feature_values # temp. array holding feature values cdef SIZE_t start # Start position for the current node cdef SIZE_t end # End position for the current ndoe diff --git a/sklearn/tree/_tree.pyx b/sklearn/tree/_tree.pyx index 00a5fd28976a3..03d8d09fe3381 100644 --- a/sklearn/tree/_tree.pyx +++ b/sklearn/tree/_tree.pyx @@ -65,12 +65,12 @@ NODE_DTYPE = np.dtype({ 'n_samples'], 'formats': [np.intp, np.intp, np.intp, np.float64, np.float64, np.intp], 'offsets': [ - &( NULL).left_child, - &( NULL).right_child, - &( NULL).feature, - &( NULL).threshold, - &( NULL).impurity, - &( NULL).n_samples, + &( NULL).left_child, + &( NULL).right_child, + &( NULL).feature, + &( NULL).threshold, + &( NULL).impurity, + &( NULL).n_samples, ] }) @@ -898,6 +898,7 @@ cdef class Splitter: self.n_samples = 0 self.features = NULL self.n_features = 0 + self.feature_values = NULL self.X = NULL self.X_sample_stride = 0 @@ -914,6 +915,7 @@ cdef class Splitter: """Destructor.""" free(self.samples) free(self.features) + free(self.feature_values) def __getstate__(self): return {} @@ -925,16 +927,13 @@ cdef class Splitter: np.ndarray[DOUBLE_t, ndim=2, mode="c"] y, DOUBLE_t* sample_weight): """Initialize the splitter.""" - # Free old structures, if any - free(self.samples) - free(self.features) - # Reset random state self.rand_r_state = self.random_state.randint(0, RAND_R_MAX) # Initialize samples and features structures cdef SIZE_t n_samples = X.shape[0] - cdef SIZE_t* samples = malloc(n_samples * sizeof(SIZE_t)) + cdef SIZE_t* samples = realloc(self.samples, + n_samples * sizeof(SIZE_t)) if samples == NULL: raise MemoryError() @@ -951,7 +950,8 @@ cdef class Splitter: self.n_samples = j cdef SIZE_t n_features = X.shape[1] - cdef SIZE_t* features = malloc(n_features * sizeof(SIZE_t)) + cdef SIZE_t* features = realloc(self.features, + n_features * sizeof(SIZE_t)) if features == NULL: raise MemoryError() @@ -961,6 +961,12 @@ cdef class Splitter: self.features = features self.n_features = n_features + cdef DTYPE_t* fv = realloc(self.feature_values, + n_samples * sizeof(DTYPE_t)) + if fv == NULL: + raise MemoryError() + self.feature_values = fv + # Initialize X, y, sample_weight self.X = X.data self.X_sample_stride = X.strides[0] / X.itemsize @@ -1015,6 +1021,7 @@ cdef class BestSplitter(Splitter): cdef SIZE_t n_features = self.n_features cdef DTYPE_t* X = self.X + cdef DTYPE_t* Xf = self.feature_values cdef SIZE_t X_sample_stride = self.X_sample_stride cdef SIZE_t X_fx_stride = self.X_fx_stride cdef SIZE_t max_features = self.max_features @@ -1053,17 +1060,21 @@ cdef class BestSplitter(Splitter): current_feature = features[f_i] - # Sort samples along that feature - sort(X, X_sample_stride, X_fx_stride, current_feature, samples + start, end - start) + # Sort samples along that feature; first copy the feature values + # for the active samples into Xf, s.t. Xf[i] == X[samples[i], j], + # so the sort uses the cache more effectively. + for p in range(start, end): + Xf[p] = X[X_sample_stride * samples[p] + + X_fx_stride * current_feature] + + sort(Xf + start, samples + start, end - start) # Evaluate all splits self.criterion.reset() p = start while p < end: - while ((p + 1 < end) and - (X[X_sample_stride * samples[p + 1] + X_fx_stride * current_feature] <= - X[X_sample_stride * samples[p] + X_fx_stride * current_feature] + EPSILON_FLT)): + while p + 1 < end and Xf[p + 1] <= Xf[p] + EPSILON_FLT: p += 1 # (p + 1 >= end) or (X[samples[p + 1], current_feature] > @@ -1091,11 +1102,10 @@ cdef class BestSplitter(Splitter): best_pos = current_pos best_feature = current_feature - current_threshold = (X[X_sample_stride * samples[p - 1] + X_fx_stride * current_feature] + - X[X_sample_stride * samples[p] + X_fx_stride * current_feature]) / 2.0 + current_threshold = (Xf[p - 1] + Xf[p]) / 2.0 - if current_threshold == X[X_sample_stride * samples[p] + X_fx_stride * current_feature]: - current_threshold = X[X_sample_stride * samples[p - 1] + X_fx_stride * current_feature] + if current_threshold == Xf[p]: + current_threshold = Xf[p - 1] best_threshold = current_threshold @@ -1115,7 +1125,8 @@ cdef class BestSplitter(Splitter): p = start while p < partition_end: - if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: + if X[X_sample_stride * samples[p] + + X_fx_stride * best_feature] <= best_threshold: p += 1 else: @@ -1133,46 +1144,115 @@ cdef class BestSplitter(Splitter): impurity_right[0] = best_impurity_right impurity_improvement[0] = best_improvement -cdef inline void sort(DTYPE_t* X, SIZE_t X_sample_stride, SIZE_t X_fx_stride, SIZE_t current_feature, - SIZE_t* samples, SIZE_t length) nogil: - """In-place sorting of samples[start:end] using - X[sample[i], current_feature] as key.""" - # Heapsort, adapted from Numerical Recipes in C - cdef SIZE_t tmp - cdef DOUBLE_t tmp_value - cdef SIZE_t n = length - cdef SIZE_t parent = length / 2 - cdef SIZE_t index, child +# Sort n-element arrays pointed to by Xf and samples, simultaneously, +# by the values in Xf. Algorithm: Introsort (Musser, SP&E, 1997). +cdef inline void sort(DTYPE_t* Xf, SIZE_t* samples, SIZE_t n) nogil: + cdef int maxd = 2 * log(n) + introsort(Xf, samples, n, maxd) + + +cdef inline void swap(DTYPE_t* Xf, SIZE_t* samples, SIZE_t i, SIZE_t j) nogil: + # Helper for sort + Xf[i], Xf[j] = Xf[j], Xf[i] + samples[i], samples[j] = samples[j], samples[i] + + +cdef inline DTYPE_t median3(DTYPE_t* Xf, SIZE_t n) nogil: + # Median of three pivot selection, after Bentley and McIlroy (1993). + # Engineering a sort function. SP&E. Requires 8/3 comparisons on average. + cdef DTYPE_t a = Xf[0], b = Xf[n / 2], c = Xf[n - 1] + if a < b: + if b < c: + return b + elif a < c: + return c + else: + return a + elif b < c: + if a < c: + return a + else: + return c + else: + return b + + +# Introsort with median of 3 pivot selection and 3-way partition function +# (robust to repeated elements, e.g. lots of zero features). +cdef void introsort(DTYPE_t* Xf, SIZE_t *samples, SIZE_t n, int maxd) nogil: + cdef DTYPE_t pivot + cdef SIZE_t i, l, r + + while n > 1: + if maxd <= 0: # max depth limit exceeded ("gone quadratic") + heapsort(Xf, samples, n) + return + maxd -= 1 + + pivot = median3(Xf, n) + + # Three-way partition. + i = l = 0 + r = n + while i < r: + if Xf[i] < pivot: + swap(Xf, samples, i, l) + i += 1 + l += 1 + elif Xf[i] > pivot: + r -= 1 + swap(Xf, samples, i, r) + else: + i += 1 + + introsort(Xf, samples, l, maxd) + Xf += r + samples += r + n -= r + + +cdef inline void sift_down(DTYPE_t* Xf, SIZE_t* samples, + SIZE_t start, SIZE_t end) nogil: + # Restore heap order in Xf[start:end] by moving the max element to start. + cdef SIZE_t child, maxind, root + + root = start while True: - if parent > 0: - parent -= 1 - tmp = samples[parent] + child = root * 2 + 1 + + # find max of root, left child, right child + maxind = root + if child < end and Xf[maxind] < Xf[child]: + maxind = child + if child + 1 < end and Xf[maxind] < Xf[child + 1]: + maxind = child + 1 + + if maxind == root: + break else: - n -= 1 - if n == 0: - return - tmp = samples[n] - samples[n] = samples[0] - - tmp_value = X[X_sample_stride * tmp + X_fx_stride * current_feature] - index = parent - child = index * 2 + 1 - - while child < n: - if ((child + 1 < n) and - (X[X_sample_stride * samples[child + 1] + X_fx_stride * current_feature] > X[X_sample_stride * samples[child] + X_fx_stride * current_feature])): - child += 1 - - if X[X_sample_stride * samples[child] + X_fx_stride * current_feature] > tmp_value: - samples[index] = samples[child] - index = child - child = index * 2 + 1 + swap(Xf, samples, root, maxind) + root = maxind - else: - break - samples[index] = tmp +cdef void heapsort(DTYPE_t* Xf, SIZE_t* samples, SIZE_t n) nogil: + cdef SIZE_t start, end + + # heapify + start = (n - 2) / 2 + end = n + while True: + sift_down(Xf, samples, start, end) + if start == 0: + break + start -= 1 + + # sort by shrinking the heap, putting the max element immediately after it + end = n - 1 + while end > 0: + swap(Xf, samples, 0, end) + sift_down(Xf, samples, 0, end) + end = end - 1 cdef class RandomSplitter(Splitter): @@ -1314,7 +1394,8 @@ cdef class RandomSplitter(Splitter): p = start while p < partition_end: - if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: + if X[X_sample_stride * samples[p] + + X_fx_stride * best_feature] <= best_threshold: p += 1 else: @@ -1403,7 +1484,7 @@ cdef class PresortBestSplitter(Splitter): cdef SIZE_t n_features = self.n_features cdef DTYPE_t* X = self.X - cdef DTYPE_t* X_fx + cdef DTYPE_t* Xf = self.feature_values cdef SIZE_t X_sample_stride = self.X_sample_stride cdef SIZE_t X_fx_stride = self.X_fx_stride cdef INT32_t* X_argsorted = self.X_argsorted_ptr @@ -1454,8 +1535,6 @@ cdef class PresortBestSplitter(Splitter): current_feature = features[f_i] - X_fx = X + (X_fx_stride * current_feature) - # Extract ordering from X_argsorted p = start @@ -1463,6 +1542,8 @@ cdef class PresortBestSplitter(Splitter): j = X_argsorted[X_argsorted_stride * current_feature + i] if sample_mask[j] == 1: samples[p] = j + Xf[p] = X[X_sample_stride * j + + X_fx_stride * current_feature] p += 1 # Evaluate all splits @@ -1470,9 +1551,7 @@ cdef class PresortBestSplitter(Splitter): p = start while p < end: - while ((p + 1 < end) and - (X_fx[X_sample_stride * samples[p + 1]] <= - X_fx[X_sample_stride * samples[p]] + EPSILON_FLT)): + while p + 1 < end and Xf[p + 1] <= Xf[p] + EPSILON_FLT: p += 1 # (p + 1 >= end) or (X[samples[p + 1], current_feature] > @@ -1487,7 +1566,7 @@ cdef class PresortBestSplitter(Splitter): # Reject if min_samples_leaf is not guaranteed if (((current_pos - start) < min_samples_leaf) or ((end - current_pos) < min_samples_leaf)): - continue + continue self.criterion.update(current_pos) current_improvement = self.criterion.impurity_improvement(impurity) @@ -1500,11 +1579,10 @@ cdef class PresortBestSplitter(Splitter): best_pos = current_pos best_feature = current_feature - current_threshold = (X_fx[X_sample_stride * samples[p - 1]] + - X_fx[X_sample_stride * samples[p]]) / 2.0 + current_threshold = (Xf[p - 1] + Xf[p]) / 2.0 - if current_threshold == X_fx[X_sample_stride * samples[p]]: - current_threshold = X_fx[X_sample_stride * samples[p - 1]] + if current_threshold == Xf[p]: + current_threshold = Xf[p - 1] best_threshold = current_threshold @@ -1524,7 +1602,8 @@ cdef class PresortBestSplitter(Splitter): p = start while p < partition_end: - if X[X_sample_stride * samples[p] + X_fx_stride * best_feature] <= best_threshold: + if X[X_sample_stride * samples[p] + + X_fx_stride * best_feature] <= best_threshold: p += 1 else: