diff --git a/sklearn/_hmmc.c b/sklearn/_hmmc.c index 7e7d5d29190ac..b908b391553b4 100644 --- a/sklearn/_hmmc.c +++ b/sklearn/_hmmc.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Mon Jan 9 21:06:13 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:32:17 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #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 PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #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) #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) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 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_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])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -232,11 +251,11 @@ #include #define __PYX_HAVE__sklearn___hmmc #define __PYX_HAVE_API__sklearn___hmmc +#include "math.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#include "math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -267,7 +286,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -291,8 +310,12 @@ 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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -317,7 +340,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -327,7 +349,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -335,18 +356,54 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "_hmmc.pyx", "numpy.pxd", + "type.pxd", }; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; -/* "numpy.pxd":719 + +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -355,7 +412,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -364,7 +421,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -373,7 +430,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -382,7 +439,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -391,7 +448,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -400,7 +457,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -409,7 +466,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -418,7 +475,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -427,7 +484,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -436,7 +493,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.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 # <<<<<<<<<<<<<< @@ -445,7 +502,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -454,7 +511,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -463,7 +520,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -472,7 +529,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -481,7 +538,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -490,7 +547,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -499,7 +556,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -508,7 +565,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -517,7 +574,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -526,7 +583,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -535,15 +592,14 @@ typedef npy_double __pyx_t_5numpy_double_t; */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* "sklearn/_hmmc.pyx":9 - * double log(double) +/* "sklearn/_hmmc.pyx":8 + * np.import_array() * * ctypedef np.float64_t dtype_t # <<<<<<<<<<<<<< * * */ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5_hmmc_dtype_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -564,9 +620,10 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5_hmmc_dtype_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -575,7 +632,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5_hmmc_dtype_t; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -584,7 +641,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -593,7 +650,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -601,12 +658,9 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -619,8 +673,21 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -631,7 +698,7 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -642,76 +709,73 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static 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, const char *name, int exact); /*proto*/ -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ + #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) - -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + #if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); #else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release #endif -Py_ssize_t __Pyx_zeros[] = {0, 0, 0}; -Py_ssize_t __Pyx_minusones[] = {-1, -1, -1}; + +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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ @@ -729,7 +793,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_long(npy_long); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -850,15 +913,40 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject * static int __Pyx_check_binary_version(void); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'libc.math' */ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -867,6 +955,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -877,22 +970,13 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ - -/* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ /* Module declarations from 'sklearn._hmmc' */ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t = { "dtype_t", NULL, sizeof(__pyx_t_7sklearn_5_hmmc_dtype_t), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "int_t", NULL, sizeof(__pyx_t_5numpy_int_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t = { "dtype_t", NULL, sizeof(__pyx_t_7sklearn_5_hmmc_dtype_t), { 0 }, 0, 'R', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "int_t", NULL, sizeof(__pyx_t_5numpy_int_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int_t), 0 }; #define __Pyx_MODULE_NAME "sklearn._hmmc" int __pyx_module_is_main_sklearn___hmmc = 0; @@ -901,13 +985,21 @@ static PyObject *__pyx_builtin_xrange; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_N, PyArrayObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_7sklearn_5_hmmc_2_forward(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_observations, int __pyx_v_n_components, PyArrayObject *__pyx_v_log_startprob, PyArrayObject *__pyx_v_log_transmat, PyArrayObject *__pyx_v_framelogprob, PyArrayObject *__pyx_v_fwdlattice); /* proto */ +static PyObject *__pyx_pf_7sklearn_5_hmmc_4_backward(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_observations, int __pyx_v_n_components, CYTHON_UNUSED PyArrayObject *__pyx_v_log_startprob, PyArrayObject *__pyx_v_log_transmat, PyArrayObject *__pyx_v_framelogprob, PyArrayObject *__pyx_v_bwdlattice); /* proto */ +static PyObject *__pyx_pf_7sklearn_5_hmmc_6_compute_lneta(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_observations, int __pyx_v_n_components, PyArrayObject *__pyx_v_fwdlattice, PyArrayObject *__pyx_v_log_transmat, PyArrayObject *__pyx_v_bwdlattice, PyArrayObject *__pyx_v_framelogprob, double __pyx_v_logprob, PyArrayObject *__pyx_v_lneta); /* proto */ +static PyObject *__pyx_pf_7sklearn_5_hmmc_8_viterbi(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_observations, int __pyx_v_n_components, PyArrayObject *__pyx_v_log_startprob, PyArrayObject *__pyx_v_log_transmat, PyArrayObject *__pyx_v_framelogprob); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_6[] = "ndarray is not C contiguous"; static char __pyx_k_8[] = "ndarray is not Fortran contiguous"; static char __pyx_k_10[] = "Non-native byte order not supported"; static char __pyx_k_12[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_13[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_16[] = "Format string allocated too short."; -static char __pyx_k_18[] = "sklearn._hmmc"; +static char __pyx_k_20[] = "/scratch/apps/src/scikit-learn/sklearn/_hmmc.pyx"; +static char __pyx_k_21[] = "sklearn._hmmc"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -922,14 +1014,18 @@ 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__j[] = "j"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; +static char __pyx_k__t[] = "t"; 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__int[] = "int"; static char __pyx_k__max[] = "max"; +static char __pyx_k__Xsum[] = "Xsum"; +static char __pyx_k__maxv[] = "maxv"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__lneta[] = "lneta"; static char __pyx_k__numpy[] = "numpy"; @@ -939,6 +1035,7 @@ static char __pyx_k__argmax[] = "argmax"; static char __pyx_k__xrange[] = "xrange"; static char __pyx_k___logsum[] = "_logsum"; static char __pyx_k__logprob[] = "logprob"; +static char __pyx_k__max_pos[] = "max_pos"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k___forward[] = "_forward"; @@ -947,6 +1044,7 @@ static char __pyx_k___backward[] = "_backward"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__bwdlattice[] = "bwdlattice"; static char __pyx_k__fwdlattice[] = "fwdlattice"; +static char __pyx_k__work_buffer[] = "work_buffer"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__framelogprob[] = "framelogprob"; static char __pyx_k__log_transmat[] = "log_transmat"; @@ -954,17 +1052,21 @@ static char __pyx_k__n_components[] = "n_components"; static char __pyx_k__log_startprob[] = "log_startprob"; static char __pyx_k___compute_lneta[] = "_compute_lneta"; static char __pyx_k__n_observations[] = "n_observations"; +static char __pyx_k__state_sequence[] = "state_sequence"; +static char __pyx_k__viterbi_lattice[] = "viterbi_lattice"; static PyObject *__pyx_kp_u_10; static PyObject *__pyx_kp_u_12; static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_u_16; -static PyObject *__pyx_n_s_18; +static PyObject *__pyx_kp_s_20; +static PyObject *__pyx_n_s_21; static PyObject *__pyx_kp_u_6; static PyObject *__pyx_kp_u_8; static PyObject *__pyx_n_s__N; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__X; +static PyObject *__pyx_n_s__Xsum; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___backward; @@ -977,17 +1079,25 @@ static PyObject *__pyx_n_s__bwdlattice; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__framelogprob; static PyObject *__pyx_n_s__fwdlattice; +static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__int; +static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__lneta; static PyObject *__pyx_n_s__log_startprob; static PyObject *__pyx_n_s__log_transmat; static PyObject *__pyx_n_s__logprob; static PyObject *__pyx_n_s__max; +static PyObject *__pyx_n_s__max_pos; +static PyObject *__pyx_n_s__maxv; static PyObject *__pyx_n_s__n_components; static PyObject *__pyx_n_s__n_observations; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__state_sequence; +static PyObject *__pyx_n_s__t; +static PyObject *__pyx_n_s__viterbi_lattice; +static PyObject *__pyx_n_s__work_buffer; static PyObject *__pyx_n_s__xrange; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_15; @@ -1002,65 +1112,51 @@ static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_tuple_17; - -/* "sklearn/_hmmc.pyx":13 - * - * @cython.boundscheck(False) - * def _logsum(int N, np.ndarray[dtype_t, ndim=1] X): # <<<<<<<<<<<<<< - * cdef int i - * cdef double maxv, Xsum - */ - -static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7sklearn_5_hmmc__logsum = {__Pyx_NAMESTR("_logsum"), (PyCFunction)__pyx_pf_7sklearn_5_hmmc__logsum, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_tuple_22; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_codeobj_19; +static PyObject *__pyx_k_codeobj_23; +static PyObject *__pyx_k_codeobj_25; +static PyObject *__pyx_k_codeobj_27; +static PyObject *__pyx_k_codeobj_29; + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5_hmmc_1_logsum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7sklearn_5_hmmc_1_logsum = {__Pyx_NAMESTR("_logsum"), (PyCFunction)__pyx_pw_7sklearn_5_hmmc_1_logsum, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_7sklearn_5_hmmc_1_logsum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_N; PyArrayObject *__pyx_v_X = 0; - int __pyx_v_i; - double __pyx_v_maxv; - double __pyx_v_Xsum; - Py_buffer __pyx_bstruct_X; - Py_ssize_t __pyx_bstride_0_X = 0; - Py_ssize_t __pyx_bshape_0_X = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - double __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__N,&__pyx_n_s__X,0}; - __Pyx_RefNannySetupContext("_logsum"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_logsum (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__N,&__pyx_n_s__X,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__N); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__N)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_logsum", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_logsum", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_logsum") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_logsum") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1068,27 +1164,64 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(PyObject *__pyx_self, PyObject values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_N = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_N = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_logsum", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_logsum", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn._hmmc._logsum", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_X.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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 = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5_hmmc__logsum(__pyx_self, __pyx_v_N, __pyx_v_X); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/_hmmc.pyx":12 + * + * @cython.boundscheck(False) + * def _logsum(int N, np.ndarray[dtype_t, ndim=1] X): # <<<<<<<<<<<<<< + * cdef int i + * cdef double maxv, Xsum + */ + +static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_N, PyArrayObject *__pyx_v_X) { + int __pyx_v_i; + double __pyx_v_maxv; + double __pyx_v_Xsum; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + double __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_logsum", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_X = __pyx_bstruct_X.strides[0]; - __pyx_bshape_0_X = __pyx_bstruct_X.shape[0]; + __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]; - /* "sklearn/_hmmc.pyx":16 + /* "sklearn/_hmmc.pyx":15 * cdef int i * cdef double maxv, Xsum * Xsum = 0.0 # <<<<<<<<<<<<<< @@ -1097,23 +1230,23 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(PyObject *__pyx_self, PyObject */ __pyx_v_Xsum = 0.0; - /* "sklearn/_hmmc.pyx":17 + /* "sklearn/_hmmc.pyx":16 * cdef double maxv, Xsum * Xsum = 0.0 * maxv = X.max() # <<<<<<<<<<<<<< * for i in xrange(N): * Xsum += exp(X[i] - maxv) */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __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 = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_maxv = __pyx_t_3; - /* "sklearn/_hmmc.pyx":18 + /* "sklearn/_hmmc.pyx":17 * Xsum = 0.0 * maxv = X.max() * for i in xrange(N): # <<<<<<<<<<<<<< @@ -1124,7 +1257,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(PyObject *__pyx_self, PyObject for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "sklearn/_hmmc.pyx":19 + /* "sklearn/_hmmc.pyx":18 * maxv = X.max() * for i in xrange(N): * Xsum += exp(X[i] - maxv) # <<<<<<<<<<<<<< @@ -1132,11 +1265,11 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(PyObject *__pyx_self, PyObject * */ __pyx_t_6 = __pyx_v_i; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_X; - __pyx_v_Xsum = (__pyx_v_Xsum + exp(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_X.buf, __pyx_t_6, __pyx_bstride_0_X)) - __pyx_v_maxv))); + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_X.diminfo[0].shape; + __pyx_v_Xsum = (__pyx_v_Xsum + exp(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_X.diminfo[0].strides)) - __pyx_v_maxv))); } - /* "sklearn/_hmmc.pyx":20 + /* "sklearn/_hmmc.pyx":19 * for i in xrange(N): * Xsum += exp(X[i] - maxv) * return log(Xsum) + maxv # <<<<<<<<<<<<<< @@ -1144,7 +1277,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(PyObject *__pyx_self, PyObject * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyFloat_FromDouble((log(__pyx_v_Xsum) + __pyx_v_maxv)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((log(__pyx_v_Xsum) + __pyx_v_maxv)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -1157,100 +1290,39 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc__logsum(PyObject *__pyx_self, PyObject __Pyx_XDECREF(__pyx_t_2); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn._hmmc._logsum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/_hmmc.pyx":24 - * - * @cython.boundscheck(False) - * def _forward(int n_observations, int n_components, \ # <<<<<<<<<<<<<< - * np.ndarray[dtype_t, ndim=1] log_startprob, \ - * np.ndarray[dtype_t, ndim=2] log_transmat, \ - */ - -static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7sklearn_5_hmmc_1_forward = {__Pyx_NAMESTR("_forward"), (PyCFunction)__pyx_pf_7sklearn_5_hmmc_1_forward, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5_hmmc_3_forward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7sklearn_5_hmmc_3_forward = {__Pyx_NAMESTR("_forward"), (PyCFunction)__pyx_pw_7sklearn_5_hmmc_3_forward, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_7sklearn_5_hmmc_3_forward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_n_observations; int __pyx_v_n_components; PyArrayObject *__pyx_v_log_startprob = 0; PyArrayObject *__pyx_v_log_transmat = 0; PyArrayObject *__pyx_v_framelogprob = 0; PyArrayObject *__pyx_v_fwdlattice = 0; - int __pyx_v_t; - int __pyx_v_i; - int __pyx_v_j; - PyArrayObject *__pyx_v_work_buffer = 0; - Py_buffer __pyx_bstruct_log_transmat; - Py_ssize_t __pyx_bstride_0_log_transmat = 0; - Py_ssize_t __pyx_bstride_1_log_transmat = 0; - Py_ssize_t __pyx_bshape_0_log_transmat = 0; - Py_ssize_t __pyx_bshape_1_log_transmat = 0; - Py_buffer __pyx_bstruct_framelogprob; - Py_ssize_t __pyx_bstride_0_framelogprob = 0; - Py_ssize_t __pyx_bstride_1_framelogprob = 0; - Py_ssize_t __pyx_bshape_0_framelogprob = 0; - Py_ssize_t __pyx_bshape_1_framelogprob = 0; - Py_buffer __pyx_bstruct_fwdlattice; - Py_ssize_t __pyx_bstride_0_fwdlattice = 0; - Py_ssize_t __pyx_bstride_1_fwdlattice = 0; - Py_ssize_t __pyx_bshape_0_fwdlattice = 0; - Py_ssize_t __pyx_bshape_1_fwdlattice = 0; - Py_buffer __pyx_bstruct_work_buffer; - Py_ssize_t __pyx_bstride_0_work_buffer = 0; - Py_ssize_t __pyx_bshape_0_work_buffer = 0; - Py_buffer __pyx_bstruct_log_startprob; - Py_ssize_t __pyx_bstride_0_log_startprob = 0; - Py_ssize_t __pyx_bshape_0_log_startprob = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_t_10; - long __pyx_t_11; - int __pyx_t_12; - long __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - long __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - int __pyx_t_23; - __pyx_t_7sklearn_5_hmmc_dtype_t __pyx_t_24; - int __pyx_t_25; - int __pyx_t_26; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_observations,&__pyx_n_s__n_components,&__pyx_n_s__log_startprob,&__pyx_n_s__log_transmat,&__pyx_n_s__framelogprob,&__pyx_n_s__fwdlattice,0}; - __Pyx_RefNannySetupContext("_forward"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_forward (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_observations,&__pyx_n_s__n_components,&__pyx_n_s__log_startprob,&__pyx_n_s__log_transmat,&__pyx_n_s__framelogprob,&__pyx_n_s__fwdlattice,0}; PyObject* values[6] = {0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -1261,44 +1333,38 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_observations); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_observations)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_components); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_components)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_startprob); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_startprob)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_transmat); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_transmat)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__framelogprob); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__framelogprob)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwdlattice); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwdlattice)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_forward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_forward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; @@ -1310,8 +1376,8 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); } - __pyx_v_n_observations = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_observations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_n_components = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_components == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_observations = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_observations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_components = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_components == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_log_startprob = ((PyArrayObject *)values[2]); __pyx_v_log_transmat = ((PyArrayObject *)values[3]); __pyx_v_framelogprob = ((PyArrayObject *)values[4]); @@ -1319,93 +1385,167 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_forward", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn._hmmc._forward", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_work_buffer.buf = NULL; - __pyx_bstruct_log_startprob.buf = NULL; - __pyx_bstruct_log_transmat.buf = NULL; - __pyx_bstruct_framelogprob.buf = NULL; - __pyx_bstruct_fwdlattice.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_startprob), __pyx_ptype_5numpy_ndarray, 1, "log_startprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_transmat), __pyx_ptype_5numpy_ndarray, 1, "log_transmat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_framelogprob), __pyx_ptype_5numpy_ndarray, 1, "framelogprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fwdlattice), __pyx_ptype_5numpy_ndarray, 1, "fwdlattice", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_startprob), __pyx_ptype_5numpy_ndarray, 1, "log_startprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_transmat), __pyx_ptype_5numpy_ndarray, 1, "log_transmat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_framelogprob), __pyx_ptype_5numpy_ndarray, 1, "framelogprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fwdlattice), __pyx_ptype_5numpy_ndarray, 1, "fwdlattice", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5_hmmc_2_forward(__pyx_self, __pyx_v_n_observations, __pyx_v_n_components, __pyx_v_log_startprob, __pyx_v_log_transmat, __pyx_v_framelogprob, __pyx_v_fwdlattice); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/_hmmc.pyx":23 + * + * @cython.boundscheck(False) + * def _forward(int n_observations, int n_components, \ # <<<<<<<<<<<<<< + * np.ndarray[dtype_t, ndim=1] log_startprob, \ + * np.ndarray[dtype_t, ndim=2] log_transmat, \ + */ + +static PyObject *__pyx_pf_7sklearn_5_hmmc_2_forward(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_observations, int __pyx_v_n_components, PyArrayObject *__pyx_v_log_startprob, PyArrayObject *__pyx_v_log_transmat, PyArrayObject *__pyx_v_framelogprob, PyArrayObject *__pyx_v_fwdlattice) { + int __pyx_v_t; + int __pyx_v_i; + int __pyx_v_j; + PyArrayObject *__pyx_v_work_buffer = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_framelogprob; + __Pyx_Buffer __pyx_pybuffer_framelogprob; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fwdlattice; + __Pyx_Buffer __pyx_pybuffer_fwdlattice; + __Pyx_LocalBuf_ND __pyx_pybuffernd_log_startprob; + __Pyx_Buffer __pyx_pybuffer_log_startprob; + __Pyx_LocalBuf_ND __pyx_pybuffernd_log_transmat; + __Pyx_Buffer __pyx_pybuffer_log_transmat; + __Pyx_LocalBuf_ND __pyx_pybuffernd_work_buffer; + __Pyx_Buffer __pyx_pybuffer_work_buffer; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyArrayObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + long __pyx_t_11; + int __pyx_t_12; + long __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + long __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + __pyx_t_7sklearn_5_hmmc_dtype_t __pyx_t_24; + int __pyx_t_25; + int __pyx_t_26; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_forward", 0); + __pyx_pybuffer_work_buffer.pybuffer.buf = NULL; + __pyx_pybuffer_work_buffer.refcount = 0; + __pyx_pybuffernd_work_buffer.data = NULL; + __pyx_pybuffernd_work_buffer.rcbuffer = &__pyx_pybuffer_work_buffer; + __pyx_pybuffer_log_startprob.pybuffer.buf = NULL; + __pyx_pybuffer_log_startprob.refcount = 0; + __pyx_pybuffernd_log_startprob.data = NULL; + __pyx_pybuffernd_log_startprob.rcbuffer = &__pyx_pybuffer_log_startprob; + __pyx_pybuffer_log_transmat.pybuffer.buf = NULL; + __pyx_pybuffer_log_transmat.refcount = 0; + __pyx_pybuffernd_log_transmat.data = NULL; + __pyx_pybuffernd_log_transmat.rcbuffer = &__pyx_pybuffer_log_transmat; + __pyx_pybuffer_framelogprob.pybuffer.buf = NULL; + __pyx_pybuffer_framelogprob.refcount = 0; + __pyx_pybuffernd_framelogprob.data = NULL; + __pyx_pybuffernd_framelogprob.rcbuffer = &__pyx_pybuffer_framelogprob; + __pyx_pybuffer_fwdlattice.pybuffer.buf = NULL; + __pyx_pybuffer_fwdlattice.refcount = 0; + __pyx_pybuffernd_fwdlattice.data = NULL; + __pyx_pybuffernd_fwdlattice.rcbuffer = &__pyx_pybuffer_fwdlattice; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_log_startprob, (PyObject*)__pyx_v_log_startprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_log_startprob.rcbuffer->pybuffer, (PyObject*)__pyx_v_log_startprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_log_startprob = __pyx_bstruct_log_startprob.strides[0]; - __pyx_bshape_0_log_startprob = __pyx_bstruct_log_startprob.shape[0]; + __pyx_pybuffernd_log_startprob.diminfo[0].strides = __pyx_pybuffernd_log_startprob.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_log_startprob.diminfo[0].shape = __pyx_pybuffernd_log_startprob.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_log_transmat, (PyObject*)__pyx_v_log_transmat, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer, (PyObject*)__pyx_v_log_transmat, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_log_transmat = __pyx_bstruct_log_transmat.strides[0]; __pyx_bstride_1_log_transmat = __pyx_bstruct_log_transmat.strides[1]; - __pyx_bshape_0_log_transmat = __pyx_bstruct_log_transmat.shape[0]; __pyx_bshape_1_log_transmat = __pyx_bstruct_log_transmat.shape[1]; + __pyx_pybuffernd_log_transmat.diminfo[0].strides = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_log_transmat.diminfo[0].shape = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_log_transmat.diminfo[1].strides = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_log_transmat.diminfo[1].shape = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_framelogprob, (PyObject*)__pyx_v_framelogprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer, (PyObject*)__pyx_v_framelogprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_framelogprob = __pyx_bstruct_framelogprob.strides[0]; __pyx_bstride_1_framelogprob = __pyx_bstruct_framelogprob.strides[1]; - __pyx_bshape_0_framelogprob = __pyx_bstruct_framelogprob.shape[0]; __pyx_bshape_1_framelogprob = __pyx_bstruct_framelogprob.shape[1]; + __pyx_pybuffernd_framelogprob.diminfo[0].strides = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_framelogprob.diminfo[0].shape = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_framelogprob.diminfo[1].strides = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_framelogprob.diminfo[1].shape = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fwdlattice, (PyObject*)__pyx_v_fwdlattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer, (PyObject*)__pyx_v_fwdlattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_fwdlattice = __pyx_bstruct_fwdlattice.strides[0]; __pyx_bstride_1_fwdlattice = __pyx_bstruct_fwdlattice.strides[1]; - __pyx_bshape_0_fwdlattice = __pyx_bstruct_fwdlattice.shape[0]; __pyx_bshape_1_fwdlattice = __pyx_bstruct_fwdlattice.shape[1]; + __pyx_pybuffernd_fwdlattice.diminfo[0].strides = __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fwdlattice.diminfo[0].shape = __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fwdlattice.diminfo[1].strides = __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fwdlattice.diminfo[1].shape = __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.shape[1]; - /* "sklearn/_hmmc.pyx":33 + /* "sklearn/_hmmc.pyx":32 * cdef double logprob * cdef np.ndarray[dtype_t, ndim = 1] work_buffer * work_buffer = np.zeros(n_components) # <<<<<<<<<<<<<< * * for i in xrange(n_components): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __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_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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 = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__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 = 33; __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 = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_work_buffer); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_work_buffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer); + __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_5 < 0)) { PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_work_buffer, (PyObject*)__pyx_v_work_buffer, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer, (PyObject*)__pyx_v_work_buffer, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); } } - __pyx_bstride_0_work_buffer = __pyx_bstruct_work_buffer.strides[0]; - __pyx_bshape_0_work_buffer = __pyx_bstruct_work_buffer.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_work_buffer.diminfo[0].strides = __pyx_pybuffernd_work_buffer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_work_buffer.diminfo[0].shape = __pyx_pybuffernd_work_buffer.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_4 = 0; __pyx_v_work_buffer = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/_hmmc.pyx":35 + /* "sklearn/_hmmc.pyx":34 * work_buffer = np.zeros(n_components) * * for i in xrange(n_components): # <<<<<<<<<<<<<< @@ -1416,7 +1556,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_5; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "sklearn/_hmmc.pyx":36 + /* "sklearn/_hmmc.pyx":35 * * for i in xrange(n_components): * fwdlattice[0, i] = log_startprob[i] + framelogprob[0, i] # <<<<<<<<<<<<<< @@ -1424,19 +1564,19 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje * for t in xrange(1, n_observations): */ __pyx_t_10 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_log_startprob; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_log_startprob.diminfo[0].shape; __pyx_t_11 = 0; __pyx_t_12 = __pyx_v_i; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_framelogprob; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_1_framelogprob; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_framelogprob.diminfo[0].shape; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_framelogprob.diminfo[1].shape; __pyx_t_13 = 0; __pyx_t_14 = __pyx_v_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_fwdlattice; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_1_fwdlattice; - *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_fwdlattice.buf, __pyx_t_13, __pyx_bstride_0_fwdlattice, __pyx_t_14, __pyx_bstride_1_fwdlattice) = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_log_startprob.buf, __pyx_t_10, __pyx_bstride_0_log_startprob)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_framelogprob.buf, __pyx_t_11, __pyx_bstride_0_framelogprob, __pyx_t_12, __pyx_bstride_1_framelogprob))); + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_fwdlattice.diminfo[0].shape; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_pybuffernd_fwdlattice.diminfo[1].shape; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_fwdlattice.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_fwdlattice.diminfo[1].strides) = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_log_startprob.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_log_startprob.diminfo[0].strides)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_framelogprob.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_framelogprob.diminfo[1].strides))); } - /* "sklearn/_hmmc.pyx":38 + /* "sklearn/_hmmc.pyx":37 * fwdlattice[0, i] = log_startprob[i] + framelogprob[0, i] * * for t in xrange(1, n_observations): # <<<<<<<<<<<<<< @@ -1447,7 +1587,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje for (__pyx_t_9 = 1; __pyx_t_9 < __pyx_t_5; __pyx_t_9+=1) { __pyx_v_t = __pyx_t_9; - /* "sklearn/_hmmc.pyx":39 + /* "sklearn/_hmmc.pyx":38 * * for t in xrange(1, n_observations): * for j in xrange(n_components): # <<<<<<<<<<<<<< @@ -1458,7 +1598,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_j = __pyx_t_16; - /* "sklearn/_hmmc.pyx":40 + /* "sklearn/_hmmc.pyx":39 * for t in xrange(1, n_observations): * for j in xrange(n_components): * for i in xrange(n_components): # <<<<<<<<<<<<<< @@ -1469,7 +1609,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_i = __pyx_t_18; - /* "sklearn/_hmmc.pyx":41 + /* "sklearn/_hmmc.pyx":40 * for j in xrange(n_components): * for i in xrange(n_components): * work_buffer[i] = fwdlattice[t - 1, i] + log_transmat[i, j] # <<<<<<<<<<<<<< @@ -1478,42 +1618,42 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje */ __pyx_t_19 = (__pyx_v_t - 1); __pyx_t_20 = __pyx_v_i; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_fwdlattice; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_1_fwdlattice; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_pybuffernd_fwdlattice.diminfo[0].shape; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_pybuffernd_fwdlattice.diminfo[1].shape; __pyx_t_21 = __pyx_v_i; __pyx_t_22 = __pyx_v_j; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_log_transmat; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_1_log_transmat; + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_pybuffernd_log_transmat.diminfo[0].shape; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_log_transmat.diminfo[1].shape; __pyx_t_23 = __pyx_v_i; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_bshape_0_work_buffer; - *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_work_buffer.buf, __pyx_t_23, __pyx_bstride_0_work_buffer) = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_fwdlattice.buf, __pyx_t_19, __pyx_bstride_0_fwdlattice, __pyx_t_20, __pyx_bstride_1_fwdlattice)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_log_transmat.buf, __pyx_t_21, __pyx_bstride_0_log_transmat, __pyx_t_22, __pyx_bstride_1_log_transmat))); + if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_work_buffer.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_work_buffer.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_work_buffer.diminfo[0].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_fwdlattice.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_fwdlattice.diminfo[1].strides)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_log_transmat.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_log_transmat.diminfo[1].strides))); } - /* "sklearn/_hmmc.pyx":42 + /* "sklearn/_hmmc.pyx":41 * for i in xrange(n_components): * work_buffer[i] = fwdlattice[t - 1, i] + log_transmat[i, j] * fwdlattice[t, j] = _logsum(n_components, work_buffer) \ # <<<<<<<<<<<<<< * + framelogprob[t, j] * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___logsum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___logsum); 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_3 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(2); 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); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_work_buffer)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_work_buffer)); __Pyx_GIVEREF(((PyObject *)__pyx_v_work_buffer)); __pyx_t_3 = 0; - __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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __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_2)); __pyx_t_2 = 0; - /* "sklearn/_hmmc.pyx":43 + /* "sklearn/_hmmc.pyx":42 * work_buffer[i] = fwdlattice[t - 1, i] + log_transmat[i, j] * fwdlattice[t, j] = _logsum(n_components, work_buffer) \ * + framelogprob[t, j] # <<<<<<<<<<<<<< @@ -1522,18 +1662,18 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje */ __pyx_t_17 = __pyx_v_t; __pyx_t_18 = __pyx_v_j; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_framelogprob; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_1_framelogprob; - __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_framelogprob.buf, __pyx_t_17, __pyx_bstride_0_framelogprob, __pyx_t_18, __pyx_bstride_1_framelogprob))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_pybuffernd_framelogprob.diminfo[0].shape; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_pybuffernd_framelogprob.diminfo[1].shape; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_framelogprob.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_framelogprob.diminfo[1].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_24 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_24 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/_hmmc.pyx":42 + /* "sklearn/_hmmc.pyx":41 * for i in xrange(n_components): * work_buffer[i] = fwdlattice[t - 1, i] + log_transmat[i, j] * fwdlattice[t, j] = _logsum(n_components, work_buffer) \ # <<<<<<<<<<<<<< @@ -1542,9 +1682,9 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje */ __pyx_t_25 = __pyx_v_t; __pyx_t_26 = __pyx_v_j; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_0_fwdlattice; - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_1_fwdlattice; - *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_fwdlattice.buf, __pyx_t_25, __pyx_bstride_0_fwdlattice, __pyx_t_26, __pyx_bstride_1_fwdlattice) = __pyx_t_24; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_pybuffernd_fwdlattice.diminfo[0].shape; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_fwdlattice.diminfo[1].shape; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_fwdlattice.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_fwdlattice.diminfo[1].strides) = __pyx_t_24; } } @@ -1556,21 +1696,21 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje __Pyx_XDECREF(__pyx_t_3); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_transmat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_framelogprob); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fwdlattice); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_work_buffer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_startprob); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_startprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn._hmmc._forward", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_transmat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_framelogprob); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fwdlattice); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_work_buffer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_startprob); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_startprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_work_buffer); __Pyx_XGIVEREF(__pyx_r); @@ -1578,83 +1718,26 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_1_forward(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "sklearn/_hmmc.pyx":47 - * - * @cython.boundscheck(False) - * def _backward(int n_observations, int n_components, \ # <<<<<<<<<<<<<< - * np.ndarray[dtype_t, ndim=1] log_startprob, \ - * np.ndarray[dtype_t, ndim=2] log_transmat, \ - */ - -static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7sklearn_5_hmmc_2_backward = {__Pyx_NAMESTR("_backward"), (PyCFunction)__pyx_pf_7sklearn_5_hmmc_2_backward, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5_hmmc_5_backward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7sklearn_5_hmmc_5_backward = {__Pyx_NAMESTR("_backward"), (PyCFunction)__pyx_pw_7sklearn_5_hmmc_5_backward, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_7sklearn_5_hmmc_5_backward(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_n_observations; int __pyx_v_n_components; - PyArrayObject *__pyx_v_log_startprob = 0; + CYTHON_UNUSED PyArrayObject *__pyx_v_log_startprob = 0; PyArrayObject *__pyx_v_log_transmat = 0; PyArrayObject *__pyx_v_framelogprob = 0; PyArrayObject *__pyx_v_bwdlattice = 0; - int __pyx_v_t; - int __pyx_v_i; - int __pyx_v_j; - PyArrayObject *__pyx_v_work_buffer = 0; - Py_buffer __pyx_bstruct_log_transmat; - Py_ssize_t __pyx_bstride_0_log_transmat = 0; - Py_ssize_t __pyx_bstride_1_log_transmat = 0; - Py_ssize_t __pyx_bshape_0_log_transmat = 0; - Py_ssize_t __pyx_bshape_1_log_transmat = 0; - Py_buffer __pyx_bstruct_framelogprob; - Py_ssize_t __pyx_bstride_0_framelogprob = 0; - Py_ssize_t __pyx_bstride_1_framelogprob = 0; - Py_ssize_t __pyx_bshape_0_framelogprob = 0; - Py_ssize_t __pyx_bshape_1_framelogprob = 0; - Py_buffer __pyx_bstruct_bwdlattice; - Py_ssize_t __pyx_bstride_0_bwdlattice = 0; - Py_ssize_t __pyx_bstride_1_bwdlattice = 0; - Py_ssize_t __pyx_bshape_0_bwdlattice = 0; - Py_ssize_t __pyx_bshape_1_bwdlattice = 0; - Py_buffer __pyx_bstruct_work_buffer; - Py_ssize_t __pyx_bstride_0_work_buffer = 0; - Py_ssize_t __pyx_bshape_0_work_buffer = 0; - Py_buffer __pyx_bstruct_log_startprob; - Py_ssize_t __pyx_bstride_0_log_startprob = 0; - Py_ssize_t __pyx_bshape_0_log_startprob = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - long __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - long __pyx_t_17; - int __pyx_t_18; - long __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - __pyx_t_7sklearn_5_hmmc_dtype_t __pyx_t_22; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_observations,&__pyx_n_s__n_components,&__pyx_n_s__log_startprob,&__pyx_n_s__log_transmat,&__pyx_n_s__framelogprob,&__pyx_n_s__bwdlattice,0}; - __Pyx_RefNannySetupContext("_backward"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_backward (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_observations,&__pyx_n_s__n_components,&__pyx_n_s__log_startprob,&__pyx_n_s__log_transmat,&__pyx_n_s__framelogprob,&__pyx_n_s__bwdlattice,0}; PyObject* values[6] = {0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -1665,44 +1748,38 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_observations); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_observations)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_components); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_components)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_startprob); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_startprob)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_transmat); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_transmat)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__framelogprob); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__framelogprob)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bwdlattice); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bwdlattice)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_backward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_backward") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; @@ -1714,8 +1791,8 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); } - __pyx_v_n_observations = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_observations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_n_components = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_components == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_observations = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_observations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_components = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_components == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_log_startprob = ((PyArrayObject *)values[2]); __pyx_v_log_transmat = ((PyArrayObject *)values[3]); __pyx_v_framelogprob = ((PyArrayObject *)values[4]); @@ -1723,93 +1800,163 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_backward", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn._hmmc._backward", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_work_buffer.buf = NULL; - __pyx_bstruct_log_startprob.buf = NULL; - __pyx_bstruct_log_transmat.buf = NULL; - __pyx_bstruct_framelogprob.buf = NULL; - __pyx_bstruct_bwdlattice.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_startprob), __pyx_ptype_5numpy_ndarray, 1, "log_startprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_transmat), __pyx_ptype_5numpy_ndarray, 1, "log_transmat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_framelogprob), __pyx_ptype_5numpy_ndarray, 1, "framelogprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bwdlattice), __pyx_ptype_5numpy_ndarray, 1, "bwdlattice", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_startprob), __pyx_ptype_5numpy_ndarray, 1, "log_startprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_transmat), __pyx_ptype_5numpy_ndarray, 1, "log_transmat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_framelogprob), __pyx_ptype_5numpy_ndarray, 1, "framelogprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bwdlattice), __pyx_ptype_5numpy_ndarray, 1, "bwdlattice", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5_hmmc_4_backward(__pyx_self, __pyx_v_n_observations, __pyx_v_n_components, __pyx_v_log_startprob, __pyx_v_log_transmat, __pyx_v_framelogprob, __pyx_v_bwdlattice); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/_hmmc.pyx":46 + * + * @cython.boundscheck(False) + * def _backward(int n_observations, int n_components, \ # <<<<<<<<<<<<<< + * np.ndarray[dtype_t, ndim=1] log_startprob, \ + * np.ndarray[dtype_t, ndim=2] log_transmat, \ + */ + +static PyObject *__pyx_pf_7sklearn_5_hmmc_4_backward(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_observations, int __pyx_v_n_components, CYTHON_UNUSED PyArrayObject *__pyx_v_log_startprob, PyArrayObject *__pyx_v_log_transmat, PyArrayObject *__pyx_v_framelogprob, PyArrayObject *__pyx_v_bwdlattice) { + int __pyx_v_t; + int __pyx_v_i; + int __pyx_v_j; + PyArrayObject *__pyx_v_work_buffer = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_bwdlattice; + __Pyx_Buffer __pyx_pybuffer_bwdlattice; + __Pyx_LocalBuf_ND __pyx_pybuffernd_framelogprob; + __Pyx_Buffer __pyx_pybuffer_framelogprob; + __Pyx_LocalBuf_ND __pyx_pybuffernd_log_startprob; + __Pyx_Buffer __pyx_pybuffer_log_startprob; + __Pyx_LocalBuf_ND __pyx_pybuffernd_log_transmat; + __Pyx_Buffer __pyx_pybuffer_log_transmat; + __Pyx_LocalBuf_ND __pyx_pybuffernd_work_buffer; + __Pyx_Buffer __pyx_pybuffer_work_buffer; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyArrayObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + long __pyx_t_10; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + long __pyx_t_17; + int __pyx_t_18; + long __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + __pyx_t_7sklearn_5_hmmc_dtype_t __pyx_t_22; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_backward", 0); + __pyx_pybuffer_work_buffer.pybuffer.buf = NULL; + __pyx_pybuffer_work_buffer.refcount = 0; + __pyx_pybuffernd_work_buffer.data = NULL; + __pyx_pybuffernd_work_buffer.rcbuffer = &__pyx_pybuffer_work_buffer; + __pyx_pybuffer_log_startprob.pybuffer.buf = NULL; + __pyx_pybuffer_log_startprob.refcount = 0; + __pyx_pybuffernd_log_startprob.data = NULL; + __pyx_pybuffernd_log_startprob.rcbuffer = &__pyx_pybuffer_log_startprob; + __pyx_pybuffer_log_transmat.pybuffer.buf = NULL; + __pyx_pybuffer_log_transmat.refcount = 0; + __pyx_pybuffernd_log_transmat.data = NULL; + __pyx_pybuffernd_log_transmat.rcbuffer = &__pyx_pybuffer_log_transmat; + __pyx_pybuffer_framelogprob.pybuffer.buf = NULL; + __pyx_pybuffer_framelogprob.refcount = 0; + __pyx_pybuffernd_framelogprob.data = NULL; + __pyx_pybuffernd_framelogprob.rcbuffer = &__pyx_pybuffer_framelogprob; + __pyx_pybuffer_bwdlattice.pybuffer.buf = NULL; + __pyx_pybuffer_bwdlattice.refcount = 0; + __pyx_pybuffernd_bwdlattice.data = NULL; + __pyx_pybuffernd_bwdlattice.rcbuffer = &__pyx_pybuffer_bwdlattice; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_log_startprob, (PyObject*)__pyx_v_log_startprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_log_startprob.rcbuffer->pybuffer, (PyObject*)__pyx_v_log_startprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_log_startprob = __pyx_bstruct_log_startprob.strides[0]; - __pyx_bshape_0_log_startprob = __pyx_bstruct_log_startprob.shape[0]; + __pyx_pybuffernd_log_startprob.diminfo[0].strides = __pyx_pybuffernd_log_startprob.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_log_startprob.diminfo[0].shape = __pyx_pybuffernd_log_startprob.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_log_transmat, (PyObject*)__pyx_v_log_transmat, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer, (PyObject*)__pyx_v_log_transmat, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_log_transmat = __pyx_bstruct_log_transmat.strides[0]; __pyx_bstride_1_log_transmat = __pyx_bstruct_log_transmat.strides[1]; - __pyx_bshape_0_log_transmat = __pyx_bstruct_log_transmat.shape[0]; __pyx_bshape_1_log_transmat = __pyx_bstruct_log_transmat.shape[1]; + __pyx_pybuffernd_log_transmat.diminfo[0].strides = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_log_transmat.diminfo[0].shape = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_log_transmat.diminfo[1].strides = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_log_transmat.diminfo[1].shape = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_framelogprob, (PyObject*)__pyx_v_framelogprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer, (PyObject*)__pyx_v_framelogprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_framelogprob = __pyx_bstruct_framelogprob.strides[0]; __pyx_bstride_1_framelogprob = __pyx_bstruct_framelogprob.strides[1]; - __pyx_bshape_0_framelogprob = __pyx_bstruct_framelogprob.shape[0]; __pyx_bshape_1_framelogprob = __pyx_bstruct_framelogprob.shape[1]; + __pyx_pybuffernd_framelogprob.diminfo[0].strides = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_framelogprob.diminfo[0].shape = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_framelogprob.diminfo[1].strides = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_framelogprob.diminfo[1].shape = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_bwdlattice, (PyObject*)__pyx_v_bwdlattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer, (PyObject*)__pyx_v_bwdlattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_bwdlattice = __pyx_bstruct_bwdlattice.strides[0]; __pyx_bstride_1_bwdlattice = __pyx_bstruct_bwdlattice.strides[1]; - __pyx_bshape_0_bwdlattice = __pyx_bstruct_bwdlattice.shape[0]; __pyx_bshape_1_bwdlattice = __pyx_bstruct_bwdlattice.shape[1]; + __pyx_pybuffernd_bwdlattice.diminfo[0].strides = __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bwdlattice.diminfo[0].shape = __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_bwdlattice.diminfo[1].strides = __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_bwdlattice.diminfo[1].shape = __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.shape[1]; - /* "sklearn/_hmmc.pyx":56 + /* "sklearn/_hmmc.pyx":55 * cdef double logprob * cdef np.ndarray[dtype_t, ndim = 1] work_buffer * work_buffer = np.zeros(n_components) # <<<<<<<<<<<<<< * * for i in xrange(n_components): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __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 = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __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_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__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 = 56; __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 = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_work_buffer); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_work_buffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer); + __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_5 < 0)) { PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_work_buffer, (PyObject*)__pyx_v_work_buffer, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer, (PyObject*)__pyx_v_work_buffer, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); } } - __pyx_bstride_0_work_buffer = __pyx_bstruct_work_buffer.strides[0]; - __pyx_bshape_0_work_buffer = __pyx_bstruct_work_buffer.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_work_buffer.diminfo[0].strides = __pyx_pybuffernd_work_buffer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_work_buffer.diminfo[0].shape = __pyx_pybuffernd_work_buffer.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_4 = 0; __pyx_v_work_buffer = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/_hmmc.pyx":58 + /* "sklearn/_hmmc.pyx":57 * work_buffer = np.zeros(n_components) * * for i in xrange(n_components): # <<<<<<<<<<<<<< @@ -1820,7 +1967,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_5; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "sklearn/_hmmc.pyx":59 + /* "sklearn/_hmmc.pyx":58 * * for i in xrange(n_components): * bwdlattice[n_observations - 1, i] = 0.0 # <<<<<<<<<<<<<< @@ -1829,12 +1976,12 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj */ __pyx_t_10 = (__pyx_v_n_observations - 1); __pyx_t_11 = __pyx_v_i; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_bwdlattice; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_1_bwdlattice; - *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_bwdlattice.buf, __pyx_t_10, __pyx_bstride_0_bwdlattice, __pyx_t_11, __pyx_bstride_1_bwdlattice) = 0.0; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_bwdlattice.diminfo[0].shape; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_bwdlattice.diminfo[1].shape; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_bwdlattice.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_bwdlattice.diminfo[1].strides) = 0.0; } - /* "sklearn/_hmmc.pyx":61 + /* "sklearn/_hmmc.pyx":60 * bwdlattice[n_observations - 1, i] = 0.0 * * for t in xrange(n_observations - 2, -1, -1): # <<<<<<<<<<<<<< @@ -1844,7 +1991,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj for (__pyx_t_5 = (__pyx_v_n_observations - 2); __pyx_t_5 > -1; __pyx_t_5-=1) { __pyx_v_t = __pyx_t_5; - /* "sklearn/_hmmc.pyx":62 + /* "sklearn/_hmmc.pyx":61 * * for t in xrange(n_observations - 2, -1, -1): * for i in xrange(n_components): # <<<<<<<<<<<<<< @@ -1855,7 +2002,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_9; __pyx_t_12+=1) { __pyx_v_i = __pyx_t_12; - /* "sklearn/_hmmc.pyx":63 + /* "sklearn/_hmmc.pyx":62 * for t in xrange(n_observations - 2, -1, -1): * for i in xrange(n_components): * for j in xrange(n_components): # <<<<<<<<<<<<<< @@ -1866,7 +2013,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_j = __pyx_t_14; - /* "sklearn/_hmmc.pyx":64 + /* "sklearn/_hmmc.pyx":63 * for i in xrange(n_components): * for j in xrange(n_components): * work_buffer[j] = log_transmat[i, j] + framelogprob[t + 1, j] \ # <<<<<<<<<<<<<< @@ -1875,14 +2022,14 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj */ __pyx_t_15 = __pyx_v_i; __pyx_t_16 = __pyx_v_j; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_log_transmat; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_1_log_transmat; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_pybuffernd_log_transmat.diminfo[0].shape; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_pybuffernd_log_transmat.diminfo[1].shape; __pyx_t_17 = (__pyx_v_t + 1); __pyx_t_18 = __pyx_v_j; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_framelogprob; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_1_framelogprob; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_pybuffernd_framelogprob.diminfo[0].shape; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_pybuffernd_framelogprob.diminfo[1].shape; - /* "sklearn/_hmmc.pyx":65 + /* "sklearn/_hmmc.pyx":64 * for j in xrange(n_components): * work_buffer[j] = log_transmat[i, j] + framelogprob[t + 1, j] \ * + bwdlattice[t + 1, j] # <<<<<<<<<<<<<< @@ -1891,10 +2038,10 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj */ __pyx_t_19 = (__pyx_v_t + 1); __pyx_t_20 = __pyx_v_j; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_bwdlattice; - if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_bshape_1_bwdlattice; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_pybuffernd_bwdlattice.diminfo[0].shape; + if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_pybuffernd_bwdlattice.diminfo[1].shape; - /* "sklearn/_hmmc.pyx":64 + /* "sklearn/_hmmc.pyx":63 * for i in xrange(n_components): * for j in xrange(n_components): * work_buffer[j] = log_transmat[i, j] + framelogprob[t + 1, j] \ # <<<<<<<<<<<<<< @@ -1902,40 +2049,40 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj * bwdlattice[t, i] = _logsum(n_components, work_buffer) */ __pyx_t_21 = __pyx_v_j; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_work_buffer; - *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_work_buffer.buf, __pyx_t_21, __pyx_bstride_0_work_buffer) = (((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_log_transmat.buf, __pyx_t_15, __pyx_bstride_0_log_transmat, __pyx_t_16, __pyx_bstride_1_log_transmat)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_framelogprob.buf, __pyx_t_17, __pyx_bstride_0_framelogprob, __pyx_t_18, __pyx_bstride_1_framelogprob))) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_bwdlattice.buf, __pyx_t_19, __pyx_bstride_0_bwdlattice, __pyx_t_20, __pyx_bstride_1_bwdlattice))); + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_pybuffernd_work_buffer.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_work_buffer.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_work_buffer.diminfo[0].strides) = (((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_log_transmat.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_log_transmat.diminfo[1].strides)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_framelogprob.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_framelogprob.diminfo[1].strides))) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_bwdlattice.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_bwdlattice.diminfo[1].strides))); } - /* "sklearn/_hmmc.pyx":66 + /* "sklearn/_hmmc.pyx":65 * work_buffer[j] = log_transmat[i, j] + framelogprob[t + 1, j] \ * + bwdlattice[t + 1, j] * bwdlattice[t, i] = _logsum(n_components, work_buffer) # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___logsum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___logsum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __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_INCREF(((PyObject *)__pyx_v_work_buffer)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_work_buffer)); __Pyx_GIVEREF(((PyObject *)__pyx_v_work_buffer)); __pyx_t_3 = 0; - __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __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_2)); __pyx_t_2 = 0; - __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_22 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_22 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_13 = __pyx_v_t; __pyx_t_14 = __pyx_v_i; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_bwdlattice; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_1_bwdlattice; - *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_bwdlattice.buf, __pyx_t_13, __pyx_bstride_0_bwdlattice, __pyx_t_14, __pyx_bstride_1_bwdlattice) = __pyx_t_22; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_bwdlattice.diminfo[0].shape; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_pybuffernd_bwdlattice.diminfo[1].shape; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_bwdlattice.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_bwdlattice.diminfo[1].strides) = __pyx_t_22; } } @@ -1947,21 +2094,21 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj __Pyx_XDECREF(__pyx_t_3); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_transmat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_framelogprob); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_bwdlattice); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_work_buffer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_startprob); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_startprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn._hmmc._backward", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_transmat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_framelogprob); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_bwdlattice); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_work_buffer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_startprob); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_startprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_work_buffer); __Pyx_XGIVEREF(__pyx_r); @@ -1969,17 +2116,10 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_2_backward(PyObject *__pyx_self, PyObj return __pyx_r; } -/* "sklearn/_hmmc.pyx":70 - * - * @cython.boundscheck(False) - * def _compute_lneta(int n_observations, int n_components, \ # <<<<<<<<<<<<<< - * np.ndarray[dtype_t, ndim=2] fwdlattice, \ - * np.ndarray[dtype_t, ndim=2] log_transmat, \ - */ - -static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7sklearn_5_hmmc_3_compute_lneta = {__Pyx_NAMESTR("_compute_lneta"), (PyCFunction)__pyx_pf_7sklearn_5_hmmc_3_compute_lneta, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5_hmmc_7_compute_lneta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7sklearn_5_hmmc_7_compute_lneta = {__Pyx_NAMESTR("_compute_lneta"), (PyCFunction)__pyx_pw_7sklearn_5_hmmc_7_compute_lneta, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_7sklearn_5_hmmc_7_compute_lneta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_n_observations; int __pyx_v_n_components; PyArrayObject *__pyx_v_fwdlattice = 0; @@ -1988,66 +2128,16 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, PyArrayObject *__pyx_v_framelogprob = 0; double __pyx_v_logprob; PyArrayObject *__pyx_v_lneta = 0; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_t; - Py_buffer __pyx_bstruct_log_transmat; - Py_ssize_t __pyx_bstride_0_log_transmat = 0; - Py_ssize_t __pyx_bstride_1_log_transmat = 0; - Py_ssize_t __pyx_bshape_0_log_transmat = 0; - Py_ssize_t __pyx_bshape_1_log_transmat = 0; - Py_buffer __pyx_bstruct_framelogprob; - Py_ssize_t __pyx_bstride_0_framelogprob = 0; - Py_ssize_t __pyx_bstride_1_framelogprob = 0; - Py_ssize_t __pyx_bshape_0_framelogprob = 0; - Py_ssize_t __pyx_bshape_1_framelogprob = 0; - Py_buffer __pyx_bstruct_lneta; - Py_ssize_t __pyx_bstride_0_lneta = 0; - Py_ssize_t __pyx_bstride_1_lneta = 0; - Py_ssize_t __pyx_bstride_2_lneta = 0; - Py_ssize_t __pyx_bshape_0_lneta = 0; - Py_ssize_t __pyx_bshape_1_lneta = 0; - Py_ssize_t __pyx_bshape_2_lneta = 0; - Py_buffer __pyx_bstruct_bwdlattice; - Py_ssize_t __pyx_bstride_0_bwdlattice = 0; - Py_ssize_t __pyx_bstride_1_bwdlattice = 0; - Py_ssize_t __pyx_bshape_0_bwdlattice = 0; - Py_ssize_t __pyx_bshape_1_bwdlattice = 0; - Py_buffer __pyx_bstruct_fwdlattice; - Py_ssize_t __pyx_bstride_0_fwdlattice = 0; - Py_ssize_t __pyx_bstride_1_fwdlattice = 0; - Py_ssize_t __pyx_bshape_0_fwdlattice = 0; - Py_ssize_t __pyx_bshape_1_fwdlattice = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - long __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - 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; - int __pyx_t_12; - long __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_observations,&__pyx_n_s__n_components,&__pyx_n_s__fwdlattice,&__pyx_n_s__log_transmat,&__pyx_n_s__bwdlattice,&__pyx_n_s__framelogprob,&__pyx_n_s__logprob,&__pyx_n_s__lneta,0}; - __Pyx_RefNannySetupContext("_compute_lneta"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_compute_lneta (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_observations,&__pyx_n_s__n_components,&__pyx_n_s__fwdlattice,&__pyx_n_s__log_transmat,&__pyx_n_s__bwdlattice,&__pyx_n_s__framelogprob,&__pyx_n_s__logprob,&__pyx_n_s__lneta,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -2060,56 +2150,48 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_observations); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_observations)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_components); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_components)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwdlattice); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fwdlattice)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_transmat); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_transmat)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bwdlattice); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bwdlattice)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__framelogprob); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__framelogprob)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__logprob); - if (likely(values[6])) kw_args--; + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__logprob)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lneta); - if (likely(values[7])) kw_args--; + if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lneta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_compute_lneta") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_compute_lneta") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; @@ -2123,65 +2205,129 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } - __pyx_v_n_observations = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_observations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_n_components = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_components == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_observations = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_observations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_components = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_components == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_fwdlattice = ((PyArrayObject *)values[2]); __pyx_v_log_transmat = ((PyArrayObject *)values[3]); __pyx_v_bwdlattice = ((PyArrayObject *)values[4]); __pyx_v_framelogprob = ((PyArrayObject *)values[5]); - __pyx_v_logprob = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_logprob == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_logprob = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_logprob == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_lneta = ((PyArrayObject *)values[7]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_compute_lneta", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn._hmmc._compute_lneta", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_fwdlattice.buf = NULL; - __pyx_bstruct_log_transmat.buf = NULL; - __pyx_bstruct_bwdlattice.buf = NULL; - __pyx_bstruct_framelogprob.buf = NULL; - __pyx_bstruct_lneta.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fwdlattice), __pyx_ptype_5numpy_ndarray, 1, "fwdlattice", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_transmat), __pyx_ptype_5numpy_ndarray, 1, "log_transmat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bwdlattice), __pyx_ptype_5numpy_ndarray, 1, "bwdlattice", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_framelogprob), __pyx_ptype_5numpy_ndarray, 1, "framelogprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lneta), __pyx_ptype_5numpy_ndarray, 1, "lneta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fwdlattice), __pyx_ptype_5numpy_ndarray, 1, "fwdlattice", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_transmat), __pyx_ptype_5numpy_ndarray, 1, "log_transmat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bwdlattice), __pyx_ptype_5numpy_ndarray, 1, "bwdlattice", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_framelogprob), __pyx_ptype_5numpy_ndarray, 1, "framelogprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lneta), __pyx_ptype_5numpy_ndarray, 1, "lneta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5_hmmc_6_compute_lneta(__pyx_self, __pyx_v_n_observations, __pyx_v_n_components, __pyx_v_fwdlattice, __pyx_v_log_transmat, __pyx_v_bwdlattice, __pyx_v_framelogprob, __pyx_v_logprob, __pyx_v_lneta); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/_hmmc.pyx":69 + * + * @cython.boundscheck(False) + * def _compute_lneta(int n_observations, int n_components, \ # <<<<<<<<<<<<<< + * np.ndarray[dtype_t, ndim=2] fwdlattice, \ + * np.ndarray[dtype_t, ndim=2] log_transmat, \ + */ + +static PyObject *__pyx_pf_7sklearn_5_hmmc_6_compute_lneta(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_observations, int __pyx_v_n_components, PyArrayObject *__pyx_v_fwdlattice, PyArrayObject *__pyx_v_log_transmat, PyArrayObject *__pyx_v_bwdlattice, PyArrayObject *__pyx_v_framelogprob, double __pyx_v_logprob, PyArrayObject *__pyx_v_lneta) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_t; + __Pyx_LocalBuf_ND __pyx_pybuffernd_bwdlattice; + __Pyx_Buffer __pyx_pybuffer_bwdlattice; + __Pyx_LocalBuf_ND __pyx_pybuffernd_framelogprob; + __Pyx_Buffer __pyx_pybuffer_framelogprob; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fwdlattice; + __Pyx_Buffer __pyx_pybuffer_fwdlattice; + __Pyx_LocalBuf_ND __pyx_pybuffernd_lneta; + __Pyx_Buffer __pyx_pybuffer_lneta; + __Pyx_LocalBuf_ND __pyx_pybuffernd_log_transmat; + __Pyx_Buffer __pyx_pybuffer_log_transmat; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + long __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + 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; + int __pyx_t_12; + long __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_compute_lneta", 0); + __pyx_pybuffer_fwdlattice.pybuffer.buf = NULL; + __pyx_pybuffer_fwdlattice.refcount = 0; + __pyx_pybuffernd_fwdlattice.data = NULL; + __pyx_pybuffernd_fwdlattice.rcbuffer = &__pyx_pybuffer_fwdlattice; + __pyx_pybuffer_log_transmat.pybuffer.buf = NULL; + __pyx_pybuffer_log_transmat.refcount = 0; + __pyx_pybuffernd_log_transmat.data = NULL; + __pyx_pybuffernd_log_transmat.rcbuffer = &__pyx_pybuffer_log_transmat; + __pyx_pybuffer_bwdlattice.pybuffer.buf = NULL; + __pyx_pybuffer_bwdlattice.refcount = 0; + __pyx_pybuffernd_bwdlattice.data = NULL; + __pyx_pybuffernd_bwdlattice.rcbuffer = &__pyx_pybuffer_bwdlattice; + __pyx_pybuffer_framelogprob.pybuffer.buf = NULL; + __pyx_pybuffer_framelogprob.refcount = 0; + __pyx_pybuffernd_framelogprob.data = NULL; + __pyx_pybuffernd_framelogprob.rcbuffer = &__pyx_pybuffer_framelogprob; + __pyx_pybuffer_lneta.pybuffer.buf = NULL; + __pyx_pybuffer_lneta.refcount = 0; + __pyx_pybuffernd_lneta.data = NULL; + __pyx_pybuffernd_lneta.rcbuffer = &__pyx_pybuffer_lneta; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fwdlattice, (PyObject*)__pyx_v_fwdlattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer, (PyObject*)__pyx_v_fwdlattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_fwdlattice = __pyx_bstruct_fwdlattice.strides[0]; __pyx_bstride_1_fwdlattice = __pyx_bstruct_fwdlattice.strides[1]; - __pyx_bshape_0_fwdlattice = __pyx_bstruct_fwdlattice.shape[0]; __pyx_bshape_1_fwdlattice = __pyx_bstruct_fwdlattice.shape[1]; + __pyx_pybuffernd_fwdlattice.diminfo[0].strides = __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fwdlattice.diminfo[0].shape = __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fwdlattice.diminfo[1].strides = __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fwdlattice.diminfo[1].shape = __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_log_transmat, (PyObject*)__pyx_v_log_transmat, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer, (PyObject*)__pyx_v_log_transmat, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_log_transmat = __pyx_bstruct_log_transmat.strides[0]; __pyx_bstride_1_log_transmat = __pyx_bstruct_log_transmat.strides[1]; - __pyx_bshape_0_log_transmat = __pyx_bstruct_log_transmat.shape[0]; __pyx_bshape_1_log_transmat = __pyx_bstruct_log_transmat.shape[1]; + __pyx_pybuffernd_log_transmat.diminfo[0].strides = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_log_transmat.diminfo[0].shape = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_log_transmat.diminfo[1].strides = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_log_transmat.diminfo[1].shape = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_bwdlattice, (PyObject*)__pyx_v_bwdlattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer, (PyObject*)__pyx_v_bwdlattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_bwdlattice = __pyx_bstruct_bwdlattice.strides[0]; __pyx_bstride_1_bwdlattice = __pyx_bstruct_bwdlattice.strides[1]; - __pyx_bshape_0_bwdlattice = __pyx_bstruct_bwdlattice.shape[0]; __pyx_bshape_1_bwdlattice = __pyx_bstruct_bwdlattice.shape[1]; + __pyx_pybuffernd_bwdlattice.diminfo[0].strides = __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bwdlattice.diminfo[0].shape = __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_bwdlattice.diminfo[1].strides = __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_bwdlattice.diminfo[1].shape = __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_framelogprob, (PyObject*)__pyx_v_framelogprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer, (PyObject*)__pyx_v_framelogprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_framelogprob = __pyx_bstruct_framelogprob.strides[0]; __pyx_bstride_1_framelogprob = __pyx_bstruct_framelogprob.strides[1]; - __pyx_bshape_0_framelogprob = __pyx_bstruct_framelogprob.shape[0]; __pyx_bshape_1_framelogprob = __pyx_bstruct_framelogprob.shape[1]; + __pyx_pybuffernd_framelogprob.diminfo[0].strides = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_framelogprob.diminfo[0].shape = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_framelogprob.diminfo[1].strides = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_framelogprob.diminfo[1].shape = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_lneta, (PyObject*)__pyx_v_lneta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_lneta.rcbuffer->pybuffer, (PyObject*)__pyx_v_lneta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_lneta = __pyx_bstruct_lneta.strides[0]; __pyx_bstride_1_lneta = __pyx_bstruct_lneta.strides[1]; __pyx_bstride_2_lneta = __pyx_bstruct_lneta.strides[2]; - __pyx_bshape_0_lneta = __pyx_bstruct_lneta.shape[0]; __pyx_bshape_1_lneta = __pyx_bstruct_lneta.shape[1]; __pyx_bshape_2_lneta = __pyx_bstruct_lneta.shape[2]; + __pyx_pybuffernd_lneta.diminfo[0].strides = __pyx_pybuffernd_lneta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_lneta.diminfo[0].shape = __pyx_pybuffernd_lneta.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_lneta.diminfo[1].strides = __pyx_pybuffernd_lneta.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_lneta.diminfo[1].shape = __pyx_pybuffernd_lneta.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_lneta.diminfo[2].strides = __pyx_pybuffernd_lneta.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_lneta.diminfo[2].shape = __pyx_pybuffernd_lneta.rcbuffer->pybuffer.shape[2]; - /* "sklearn/_hmmc.pyx":79 + /* "sklearn/_hmmc.pyx":78 * * cdef int i, j, t * for t in xrange(n_observations - 1): # <<<<<<<<<<<<<< @@ -2192,7 +2338,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_t = __pyx_t_2; - /* "sklearn/_hmmc.pyx":80 + /* "sklearn/_hmmc.pyx":79 * cdef int i, j, t * for t in xrange(n_observations - 1): * for i in xrange(n_components): # <<<<<<<<<<<<<< @@ -2203,7 +2349,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "sklearn/_hmmc.pyx":81 + /* "sklearn/_hmmc.pyx":80 * for t in xrange(n_observations - 1): * for i in xrange(n_components): * for j in xrange(n_components): # <<<<<<<<<<<<<< @@ -2214,7 +2360,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6; - /* "sklearn/_hmmc.pyx":82 + /* "sklearn/_hmmc.pyx":81 * for i in xrange(n_components): * for j in xrange(n_components): * lneta[t, i, j] = fwdlattice[t, i] + log_transmat[i, j] \ # <<<<<<<<<<<<<< @@ -2223,14 +2369,14 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, */ __pyx_t_7 = __pyx_v_t; __pyx_t_8 = __pyx_v_i; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_fwdlattice; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_1_fwdlattice; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_fwdlattice.diminfo[0].shape; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_fwdlattice.diminfo[1].shape; __pyx_t_9 = __pyx_v_i; __pyx_t_10 = __pyx_v_j; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_0_log_transmat; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_1_log_transmat; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_log_transmat.diminfo[0].shape; + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_log_transmat.diminfo[1].shape; - /* "sklearn/_hmmc.pyx":83 + /* "sklearn/_hmmc.pyx":82 * for j in xrange(n_components): * lneta[t, i, j] = fwdlattice[t, i] + log_transmat[i, j] \ * + framelogprob[t + 1, j] + bwdlattice[t + 1, j] - logprob # <<<<<<<<<<<<<< @@ -2239,14 +2385,14 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, */ __pyx_t_11 = (__pyx_v_t + 1); __pyx_t_12 = __pyx_v_j; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_0_framelogprob; - if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_bshape_1_framelogprob; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_framelogprob.diminfo[0].shape; + if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_pybuffernd_framelogprob.diminfo[1].shape; __pyx_t_13 = (__pyx_v_t + 1); __pyx_t_14 = __pyx_v_j; - if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_bshape_0_bwdlattice; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_1_bwdlattice; + if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_pybuffernd_bwdlattice.diminfo[0].shape; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_pybuffernd_bwdlattice.diminfo[1].shape; - /* "sklearn/_hmmc.pyx":82 + /* "sklearn/_hmmc.pyx":81 * for i in xrange(n_components): * for j in xrange(n_components): * lneta[t, i, j] = fwdlattice[t, i] + log_transmat[i, j] \ # <<<<<<<<<<<<<< @@ -2256,10 +2402,10 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, __pyx_t_15 = __pyx_v_t; __pyx_t_16 = __pyx_v_i; __pyx_t_17 = __pyx_v_j; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_lneta; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_1_lneta; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_2_lneta; - *__Pyx_BufPtrStrided3d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_lneta.buf, __pyx_t_15, __pyx_bstride_0_lneta, __pyx_t_16, __pyx_bstride_1_lneta, __pyx_t_17, __pyx_bstride_2_lneta) = (((((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_fwdlattice.buf, __pyx_t_7, __pyx_bstride_0_fwdlattice, __pyx_t_8, __pyx_bstride_1_fwdlattice)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_log_transmat.buf, __pyx_t_9, __pyx_bstride_0_log_transmat, __pyx_t_10, __pyx_bstride_1_log_transmat))) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_framelogprob.buf, __pyx_t_11, __pyx_bstride_0_framelogprob, __pyx_t_12, __pyx_bstride_1_framelogprob))) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_bwdlattice.buf, __pyx_t_13, __pyx_bstride_0_bwdlattice, __pyx_t_14, __pyx_bstride_1_bwdlattice))) - __pyx_v_logprob); + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_pybuffernd_lneta.diminfo[0].shape; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_pybuffernd_lneta.diminfo[1].shape; + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_pybuffernd_lneta.diminfo[2].shape; + *__Pyx_BufPtrStrided3d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_lneta.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_lneta.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_lneta.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_lneta.diminfo[2].strides) = (((((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_fwdlattice.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_fwdlattice.diminfo[1].strides)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_log_transmat.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_log_transmat.diminfo[1].strides))) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_framelogprob.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_framelogprob.diminfo[1].strides))) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_bwdlattice.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_bwdlattice.diminfo[1].strides))) - __pyx_v_logprob); } } } @@ -2269,116 +2415,46 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_3_compute_lneta(PyObject *__pyx_self, __pyx_L1_error:; { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_transmat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_framelogprob); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_lneta); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_bwdlattice); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fwdlattice); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lneta.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn._hmmc._compute_lneta", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_transmat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_framelogprob); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_lneta); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_bwdlattice); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fwdlattice); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bwdlattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fwdlattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_lneta.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/_hmmc.pyx":87 - * - * @cython.boundscheck(False) - * def _viterbi(int n_observations, int n_components, \ # <<<<<<<<<<<<<< - * np.ndarray[dtype_t, ndim=1] log_startprob, \ - * np.ndarray[dtype_t, ndim=2] log_transmat, \ - */ - -static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7sklearn_5_hmmc_4_viterbi = {__Pyx_NAMESTR("_viterbi"), (PyCFunction)__pyx_pf_7sklearn_5_hmmc_4_viterbi, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5_hmmc_9_viterbi(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7sklearn_5_hmmc_9_viterbi = {__Pyx_NAMESTR("_viterbi"), (PyCFunction)__pyx_pw_7sklearn_5_hmmc_9_viterbi, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_7sklearn_5_hmmc_9_viterbi(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_n_observations; int __pyx_v_n_components; PyArrayObject *__pyx_v_log_startprob = 0; PyArrayObject *__pyx_v_log_transmat = 0; PyArrayObject *__pyx_v_framelogprob = 0; - int __pyx_v_i; - int __pyx_v_j; - int __pyx_v_t; - int __pyx_v_max_pos; - PyArrayObject *__pyx_v_viterbi_lattice = 0; - PyArrayObject *__pyx_v_state_sequence = 0; - double __pyx_v_logprob; - PyArrayObject *__pyx_v_work_buffer = 0; - Py_buffer __pyx_bstruct_state_sequence; - Py_ssize_t __pyx_bstride_0_state_sequence = 0; - Py_ssize_t __pyx_bshape_0_state_sequence = 0; - Py_buffer __pyx_bstruct_log_transmat; - Py_ssize_t __pyx_bstride_0_log_transmat = 0; - Py_ssize_t __pyx_bstride_1_log_transmat = 0; - Py_ssize_t __pyx_bshape_0_log_transmat = 0; - Py_ssize_t __pyx_bshape_1_log_transmat = 0; - Py_buffer __pyx_bstruct_framelogprob; - Py_ssize_t __pyx_bstride_0_framelogprob = 0; - Py_ssize_t __pyx_bstride_1_framelogprob = 0; - Py_ssize_t __pyx_bshape_0_framelogprob = 0; - Py_ssize_t __pyx_bshape_1_framelogprob = 0; - Py_buffer __pyx_bstruct_viterbi_lattice; - Py_ssize_t __pyx_bstride_0_viterbi_lattice = 0; - Py_ssize_t __pyx_bstride_1_viterbi_lattice = 0; - Py_ssize_t __pyx_bshape_0_viterbi_lattice = 0; - Py_ssize_t __pyx_bshape_1_viterbi_lattice = 0; - Py_buffer __pyx_bstruct_work_buffer; - Py_ssize_t __pyx_bstride_0_work_buffer = 0; - Py_ssize_t __pyx_bshape_0_work_buffer = 0; - Py_buffer __pyx_bstruct_log_startprob; - Py_ssize_t __pyx_bstride_0_log_startprob = 0; - Py_ssize_t __pyx_bshape_0_log_startprob = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyArrayObject *__pyx_t_11 = NULL; - PyArrayObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - long __pyx_t_15; - int __pyx_t_16; - long __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - int __pyx_t_21; - int __pyx_t_22; - __pyx_t_7sklearn_5_hmmc_dtype_t __pyx_t_23; - int __pyx_t_24; - int __pyx_t_25; - long __pyx_t_26; - long __pyx_t_27; - long __pyx_t_28; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_observations,&__pyx_n_s__n_components,&__pyx_n_s__log_startprob,&__pyx_n_s__log_transmat,&__pyx_n_s__framelogprob,0}; - __Pyx_RefNannySetupContext("_viterbi"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_viterbi (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_observations,&__pyx_n_s__n_components,&__pyx_n_s__log_startprob,&__pyx_n_s__log_transmat,&__pyx_n_s__framelogprob,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2388,38 +2464,33 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_observations); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_observations)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_components); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_components)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_startprob); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_startprob)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_transmat); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__log_transmat)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__framelogprob); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__framelogprob)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_viterbi") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_viterbi") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -2430,207 +2501,291 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } - __pyx_v_n_observations = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_observations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_n_components = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_components == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_observations = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_observations == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_components = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_n_components == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_log_startprob = ((PyArrayObject *)values[2]); __pyx_v_log_transmat = ((PyArrayObject *)values[3]); __pyx_v_framelogprob = ((PyArrayObject *)values[4]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_viterbi", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn._hmmc._viterbi", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_viterbi_lattice.buf = NULL; - __pyx_bstruct_state_sequence.buf = NULL; - __pyx_bstruct_work_buffer.buf = NULL; - __pyx_bstruct_log_startprob.buf = NULL; - __pyx_bstruct_log_transmat.buf = NULL; - __pyx_bstruct_framelogprob.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_startprob), __pyx_ptype_5numpy_ndarray, 1, "log_startprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_transmat), __pyx_ptype_5numpy_ndarray, 1, "log_transmat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_framelogprob), __pyx_ptype_5numpy_ndarray, 1, "framelogprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_startprob), __pyx_ptype_5numpy_ndarray, 1, "log_startprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_log_transmat), __pyx_ptype_5numpy_ndarray, 1, "log_transmat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_framelogprob), __pyx_ptype_5numpy_ndarray, 1, "framelogprob", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5_hmmc_8_viterbi(__pyx_self, __pyx_v_n_observations, __pyx_v_n_components, __pyx_v_log_startprob, __pyx_v_log_transmat, __pyx_v_framelogprob); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/_hmmc.pyx":86 + * + * @cython.boundscheck(False) + * def _viterbi(int n_observations, int n_components, \ # <<<<<<<<<<<<<< + * np.ndarray[dtype_t, ndim=1] log_startprob, \ + * np.ndarray[dtype_t, ndim=2] log_transmat, \ + */ + +static PyObject *__pyx_pf_7sklearn_5_hmmc_8_viterbi(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_n_observations, int __pyx_v_n_components, PyArrayObject *__pyx_v_log_startprob, PyArrayObject *__pyx_v_log_transmat, PyArrayObject *__pyx_v_framelogprob) { + int __pyx_v_i; + int __pyx_v_j; + int __pyx_v_t; + int __pyx_v_max_pos; + PyArrayObject *__pyx_v_viterbi_lattice = 0; + PyArrayObject *__pyx_v_state_sequence = 0; + double __pyx_v_logprob; + PyArrayObject *__pyx_v_work_buffer = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_framelogprob; + __Pyx_Buffer __pyx_pybuffer_framelogprob; + __Pyx_LocalBuf_ND __pyx_pybuffernd_log_startprob; + __Pyx_Buffer __pyx_pybuffer_log_startprob; + __Pyx_LocalBuf_ND __pyx_pybuffernd_log_transmat; + __Pyx_Buffer __pyx_pybuffer_log_transmat; + __Pyx_LocalBuf_ND __pyx_pybuffernd_state_sequence; + __Pyx_Buffer __pyx_pybuffer_state_sequence; + __Pyx_LocalBuf_ND __pyx_pybuffernd_viterbi_lattice; + __Pyx_Buffer __pyx_pybuffer_viterbi_lattice; + __Pyx_LocalBuf_ND __pyx_pybuffernd_work_buffer; + __Pyx_Buffer __pyx_pybuffer_work_buffer; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + PyArrayObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + long __pyx_t_15; + int __pyx_t_16; + long __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + __pyx_t_7sklearn_5_hmmc_dtype_t __pyx_t_23; + int __pyx_t_24; + int __pyx_t_25; + long __pyx_t_26; + long __pyx_t_27; + long __pyx_t_28; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_viterbi", 0); + __pyx_pybuffer_viterbi_lattice.pybuffer.buf = NULL; + __pyx_pybuffer_viterbi_lattice.refcount = 0; + __pyx_pybuffernd_viterbi_lattice.data = NULL; + __pyx_pybuffernd_viterbi_lattice.rcbuffer = &__pyx_pybuffer_viterbi_lattice; + __pyx_pybuffer_state_sequence.pybuffer.buf = NULL; + __pyx_pybuffer_state_sequence.refcount = 0; + __pyx_pybuffernd_state_sequence.data = NULL; + __pyx_pybuffernd_state_sequence.rcbuffer = &__pyx_pybuffer_state_sequence; + __pyx_pybuffer_work_buffer.pybuffer.buf = NULL; + __pyx_pybuffer_work_buffer.refcount = 0; + __pyx_pybuffernd_work_buffer.data = NULL; + __pyx_pybuffernd_work_buffer.rcbuffer = &__pyx_pybuffer_work_buffer; + __pyx_pybuffer_log_startprob.pybuffer.buf = NULL; + __pyx_pybuffer_log_startprob.refcount = 0; + __pyx_pybuffernd_log_startprob.data = NULL; + __pyx_pybuffernd_log_startprob.rcbuffer = &__pyx_pybuffer_log_startprob; + __pyx_pybuffer_log_transmat.pybuffer.buf = NULL; + __pyx_pybuffer_log_transmat.refcount = 0; + __pyx_pybuffernd_log_transmat.data = NULL; + __pyx_pybuffernd_log_transmat.rcbuffer = &__pyx_pybuffer_log_transmat; + __pyx_pybuffer_framelogprob.pybuffer.buf = NULL; + __pyx_pybuffer_framelogprob.refcount = 0; + __pyx_pybuffernd_framelogprob.data = NULL; + __pyx_pybuffernd_framelogprob.rcbuffer = &__pyx_pybuffer_framelogprob; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_log_startprob, (PyObject*)__pyx_v_log_startprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_log_startprob.rcbuffer->pybuffer, (PyObject*)__pyx_v_log_startprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_log_startprob = __pyx_bstruct_log_startprob.strides[0]; - __pyx_bshape_0_log_startprob = __pyx_bstruct_log_startprob.shape[0]; + __pyx_pybuffernd_log_startprob.diminfo[0].strides = __pyx_pybuffernd_log_startprob.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_log_startprob.diminfo[0].shape = __pyx_pybuffernd_log_startprob.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_log_transmat, (PyObject*)__pyx_v_log_transmat, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer, (PyObject*)__pyx_v_log_transmat, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_log_transmat = __pyx_bstruct_log_transmat.strides[0]; __pyx_bstride_1_log_transmat = __pyx_bstruct_log_transmat.strides[1]; - __pyx_bshape_0_log_transmat = __pyx_bstruct_log_transmat.shape[0]; __pyx_bshape_1_log_transmat = __pyx_bstruct_log_transmat.shape[1]; + __pyx_pybuffernd_log_transmat.diminfo[0].strides = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_log_transmat.diminfo[0].shape = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_log_transmat.diminfo[1].strides = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_log_transmat.diminfo[1].shape = __pyx_pybuffernd_log_transmat.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_framelogprob, (PyObject*)__pyx_v_framelogprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer, (PyObject*)__pyx_v_framelogprob, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_framelogprob = __pyx_bstruct_framelogprob.strides[0]; __pyx_bstride_1_framelogprob = __pyx_bstruct_framelogprob.strides[1]; - __pyx_bshape_0_framelogprob = __pyx_bstruct_framelogprob.shape[0]; __pyx_bshape_1_framelogprob = __pyx_bstruct_framelogprob.shape[1]; + __pyx_pybuffernd_framelogprob.diminfo[0].strides = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_framelogprob.diminfo[0].shape = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_framelogprob.diminfo[1].strides = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_framelogprob.diminfo[1].shape = __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.shape[1]; - /* "sklearn/_hmmc.pyx":99 + /* "sklearn/_hmmc.pyx":98 * * # Initialize state_sequenceation * state_sequence = np.zeros(n_observations, dtype=np.int) # <<<<<<<<<<<<<< * work_buffer = np.zeros(n_components) * viterbi_lattice = np.zeros((n_observations, n_components)) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_n_observations); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_n_observations); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 98; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_state_sequence); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_state_sequence, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_state_sequence.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_state_sequence.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_state_sequence, (PyObject*)__pyx_v_state_sequence, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_state_sequence.rcbuffer->pybuffer, (PyObject*)__pyx_v_state_sequence, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); } } - __pyx_bstride_0_state_sequence = __pyx_bstruct_state_sequence.strides[0]; - __pyx_bshape_0_state_sequence = __pyx_bstruct_state_sequence.shape[0]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_state_sequence.diminfo[0].strides = __pyx_pybuffernd_state_sequence.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_state_sequence.diminfo[0].shape = __pyx_pybuffernd_state_sequence.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __pyx_v_state_sequence = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/_hmmc.pyx":100 + /* "sklearn/_hmmc.pyx":99 * # Initialize state_sequenceation * state_sequence = np.zeros(n_observations, dtype=np.int) * work_buffer = np.zeros(n_components) # <<<<<<<<<<<<<< * viterbi_lattice = np.zeros((n_observations, n_components)) * */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_work_buffer); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_work_buffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_work_buffer, (PyObject*)__pyx_v_work_buffer, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer, (PyObject*)__pyx_v_work_buffer, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8); } } - __pyx_bstride_0_work_buffer = __pyx_bstruct_work_buffer.strides[0]; - __pyx_bshape_0_work_buffer = __pyx_bstruct_work_buffer.shape[0]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_work_buffer.diminfo[0].strides = __pyx_pybuffernd_work_buffer.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_work_buffer.diminfo[0].shape = __pyx_pybuffernd_work_buffer.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_11 = 0; __pyx_v_work_buffer = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/_hmmc.pyx":101 + /* "sklearn/_hmmc.pyx":100 * state_sequence = np.zeros(n_observations, dtype=np.int) * work_buffer = np.zeros(n_components) * viterbi_lattice = np.zeros((n_observations, n_components)) # <<<<<<<<<<<<<< * * # viterbi_lattice[0,:] = log_startprob[:] + framelogprob[0,:] */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong(__pyx_v_n_observations); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_n_observations); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_n_components); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_5 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __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)); __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 = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 100; __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 = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_12 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_viterbi_lattice); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_viterbi_lattice, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_viterbi_lattice, (PyObject*)__pyx_v_viterbi_lattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer, (PyObject*)__pyx_v_viterbi_lattice, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5_hmmc_dtype_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); } } - __pyx_bstride_0_viterbi_lattice = __pyx_bstruct_viterbi_lattice.strides[0]; __pyx_bstride_1_viterbi_lattice = __pyx_bstruct_viterbi_lattice.strides[1]; - __pyx_bshape_0_viterbi_lattice = __pyx_bstruct_viterbi_lattice.shape[0]; __pyx_bshape_1_viterbi_lattice = __pyx_bstruct_viterbi_lattice.shape[1]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_viterbi_lattice.diminfo[0].strides = __pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_viterbi_lattice.diminfo[0].shape = __pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_viterbi_lattice.diminfo[1].strides = __pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_viterbi_lattice.diminfo[1].shape = __pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer.shape[1]; + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = 0; __pyx_v_viterbi_lattice = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/_hmmc.pyx":104 + /* "sklearn/_hmmc.pyx":103 * * # viterbi_lattice[0,:] = log_startprob[:] + framelogprob[0,:] * for i in xrange(n_components): # <<<<<<<<<<<<<< @@ -2641,7 +2796,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_7; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; - /* "sklearn/_hmmc.pyx":105 + /* "sklearn/_hmmc.pyx":104 * # viterbi_lattice[0,:] = log_startprob[:] + framelogprob[0,:] * for i in xrange(n_components): * viterbi_lattice[0, i] = log_startprob[i] + framelogprob[0, i] # <<<<<<<<<<<<<< @@ -2649,19 +2804,19 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje * # Induction */ __pyx_t_14 = __pyx_v_i; - if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_bshape_0_log_startprob; + if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_pybuffernd_log_startprob.diminfo[0].shape; __pyx_t_15 = 0; __pyx_t_16 = __pyx_v_i; - if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_bshape_0_framelogprob; - if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_bshape_1_framelogprob; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_pybuffernd_framelogprob.diminfo[0].shape; + if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_pybuffernd_framelogprob.diminfo[1].shape; __pyx_t_17 = 0; __pyx_t_18 = __pyx_v_i; - if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_bshape_0_viterbi_lattice; - if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_bshape_1_viterbi_lattice; - *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_viterbi_lattice.buf, __pyx_t_17, __pyx_bstride_0_viterbi_lattice, __pyx_t_18, __pyx_bstride_1_viterbi_lattice) = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_log_startprob.buf, __pyx_t_14, __pyx_bstride_0_log_startprob)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_framelogprob.buf, __pyx_t_15, __pyx_bstride_0_framelogprob, __pyx_t_16, __pyx_bstride_1_framelogprob))); + if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_pybuffernd_viterbi_lattice.diminfo[0].shape; + if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_pybuffernd_viterbi_lattice.diminfo[1].shape; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_viterbi_lattice.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_viterbi_lattice.diminfo[1].strides) = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_log_startprob.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_log_startprob.diminfo[0].strides)) + (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_framelogprob.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_framelogprob.diminfo[1].strides))); } - /* "sklearn/_hmmc.pyx":108 + /* "sklearn/_hmmc.pyx":107 * * # Induction * for t in xrange(1, n_observations): # <<<<<<<<<<<<<< @@ -2672,7 +2827,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje for (__pyx_t_13 = 1; __pyx_t_13 < __pyx_t_7; __pyx_t_13+=1) { __pyx_v_t = __pyx_t_13; - /* "sklearn/_hmmc.pyx":109 + /* "sklearn/_hmmc.pyx":108 * # Induction * for t in xrange(1, n_observations): * for j in xrange(n_components): # <<<<<<<<<<<<<< @@ -2683,128 +2838,128 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { __pyx_v_j = __pyx_t_20; - /* "sklearn/_hmmc.pyx":110 + /* "sklearn/_hmmc.pyx":109 * for t in xrange(1, n_observations): * for j in xrange(n_components): * work_buffer[:] = viterbi_lattice[t - 1, :] + log_transmat[:, j] # <<<<<<<<<<<<<< * viterbi_lattice[t, j] = np.max(work_buffer[:]) + framelogprob[t, j] * */ - __pyx_t_2 = PyInt_FromLong((__pyx_v_t - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong((__pyx_v_t - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_k_slice_1); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_k_slice_1); __Pyx_GIVEREF(__pyx_k_slice_1); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_viterbi_lattice), ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_viterbi_lattice), ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __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 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_j); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_k_slice_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_k_slice_2); __Pyx_GIVEREF(__pyx_k_slice_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_log_transmat), ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_log_transmat), ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_v_work_buffer)) { __Pyx_RaiseUnboundLocalError("work_buffer"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_work_buffer), 0, PY_SSIZE_T_MAX, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_work_buffer), 0, PY_SSIZE_T_MAX, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/_hmmc.pyx":111 + /* "sklearn/_hmmc.pyx":110 * for j in xrange(n_components): * work_buffer[:] = viterbi_lattice[t - 1, :] + log_transmat[:, j] * viterbi_lattice[t, j] = np.max(work_buffer[:]) + framelogprob[t, j] # <<<<<<<<<<<<<< * * # observation traceback */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_work_buffer), 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_work_buffer), 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __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_2)); __pyx_t_2 = 0; __pyx_t_21 = __pyx_v_t; __pyx_t_22 = __pyx_v_j; - if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_bshape_0_framelogprob; - if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_bshape_1_framelogprob; - __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_framelogprob.buf, __pyx_t_21, __pyx_bstride_0_framelogprob, __pyx_t_22, __pyx_bstride_1_framelogprob))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_pybuffernd_framelogprob.diminfo[0].shape; + if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_framelogprob.diminfo[1].shape; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_framelogprob.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_framelogprob.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_framelogprob.diminfo[1].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_23 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_23 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_24 = __pyx_v_t; __pyx_t_25 = __pyx_v_j; - if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_bshape_0_viterbi_lattice; - if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_bshape_1_viterbi_lattice; - *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_viterbi_lattice.buf, __pyx_t_24, __pyx_bstride_0_viterbi_lattice, __pyx_t_25, __pyx_bstride_1_viterbi_lattice) = __pyx_t_23; + if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_pybuffernd_viterbi_lattice.diminfo[0].shape; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_pybuffernd_viterbi_lattice.diminfo[1].shape; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_viterbi_lattice.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_viterbi_lattice.diminfo[1].strides) = __pyx_t_23; } } - /* "sklearn/_hmmc.pyx":114 + /* "sklearn/_hmmc.pyx":113 * * # observation traceback * max_pos = np.argmax(viterbi_lattice[n_observations - 1, :]) # <<<<<<<<<<<<<< * state_sequence[n_observations - 1] = max_pos * logprob = viterbi_lattice[n_observations - 1, max_pos] */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__argmax); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__argmax); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong((__pyx_v_n_observations - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_n_observations - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __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_INCREF(__pyx_k_slice_3); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_k_slice_3); __Pyx_GIVEREF(__pyx_k_slice_3); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_viterbi_lattice), ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_viterbi_lattice), ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __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_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_max_pos = __pyx_t_7; - /* "sklearn/_hmmc.pyx":115 + /* "sklearn/_hmmc.pyx":114 * # observation traceback * max_pos = np.argmax(viterbi_lattice[n_observations - 1, :]) * state_sequence[n_observations - 1] = max_pos # <<<<<<<<<<<<<< @@ -2812,10 +2967,10 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje * */ __pyx_t_26 = (__pyx_v_n_observations - 1); - if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_bshape_0_state_sequence; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_state_sequence.buf, __pyx_t_26, __pyx_bstride_0_state_sequence) = __pyx_v_max_pos; + if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_state_sequence.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_pybuffernd_state_sequence.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_state_sequence.diminfo[0].strides) = __pyx_v_max_pos; - /* "sklearn/_hmmc.pyx":116 + /* "sklearn/_hmmc.pyx":115 * max_pos = np.argmax(viterbi_lattice[n_observations - 1, :]) * state_sequence[n_observations - 1] = max_pos * logprob = viterbi_lattice[n_observations - 1, max_pos] # <<<<<<<<<<<<<< @@ -2824,11 +2979,11 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje */ __pyx_t_27 = (__pyx_v_n_observations - 1); __pyx_t_7 = __pyx_v_max_pos; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_bshape_0_viterbi_lattice; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_1_viterbi_lattice; - __pyx_v_logprob = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_bstruct_viterbi_lattice.buf, __pyx_t_27, __pyx_bstride_0_viterbi_lattice, __pyx_t_7, __pyx_bstride_1_viterbi_lattice)); + if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_pybuffernd_viterbi_lattice.diminfo[0].shape; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_viterbi_lattice.diminfo[1].shape; + __pyx_v_logprob = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5_hmmc_dtype_t *, __pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_viterbi_lattice.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_viterbi_lattice.diminfo[1].strides)); - /* "sklearn/_hmmc.pyx":118 + /* "sklearn/_hmmc.pyx":117 * logprob = viterbi_lattice[n_observations - 1, max_pos] * * for t in xrange(n_observations - 2, -1, -1): # <<<<<<<<<<<<<< @@ -2838,49 +2993,49 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje for (__pyx_t_13 = (__pyx_v_n_observations - 2); __pyx_t_13 > -1; __pyx_t_13-=1) { __pyx_v_t = __pyx_t_13; - /* "sklearn/_hmmc.pyx":119 + /* "sklearn/_hmmc.pyx":118 * * for t in xrange(n_observations - 2, -1, -1): * max_pos = np.argmax(viterbi_lattice[t, :] \ # <<<<<<<<<<<<<< * + log_transmat[:, state_sequence[t + 1]]) * state_sequence[t] = max_pos */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__argmax); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__argmax); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/_hmmc.pyx":120 + /* "sklearn/_hmmc.pyx":119 * for t in xrange(n_observations - 2, -1, -1): * max_pos = np.argmax(viterbi_lattice[t, :] \ * + log_transmat[:, state_sequence[t + 1]]) # <<<<<<<<<<<<<< * state_sequence[t] = max_pos * */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/_hmmc.pyx":119 + /* "sklearn/_hmmc.pyx":118 * * for t in xrange(n_observations - 2, -1, -1): * max_pos = np.argmax(viterbi_lattice[t, :] \ # <<<<<<<<<<<<<< * + log_transmat[:, state_sequence[t + 1]]) * state_sequence[t] = max_pos */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __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_INCREF(__pyx_k_slice_4); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_viterbi_lattice), ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_viterbi_lattice), ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "sklearn/_hmmc.pyx":120 + /* "sklearn/_hmmc.pyx":119 * for t in xrange(n_observations - 2, -1, -1): * max_pos = np.argmax(viterbi_lattice[t, :] \ * + log_transmat[:, state_sequence[t + 1]]) # <<<<<<<<<<<<<< @@ -2888,38 +3043,38 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje * */ __pyx_t_28 = (__pyx_v_t + 1); - if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_bshape_0_state_sequence; - __pyx_t_2 = __Pyx_PyInt_to_py_npy_long((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_state_sequence.buf, __pyx_t_28, __pyx_bstride_0_state_sequence))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_pybuffernd_state_sequence.diminfo[0].shape; + __pyx_t_2 = __Pyx_PyInt_to_py_npy_long((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_pybuffernd_state_sequence.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_state_sequence.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_k_slice_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_log_transmat), ((PyObject *)__pyx_t_5)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_log_transmat), ((PyObject *)__pyx_t_5)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __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[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __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_t_19 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_max_pos = __pyx_t_19; - /* "sklearn/_hmmc.pyx":121 + /* "sklearn/_hmmc.pyx":120 * max_pos = np.argmax(viterbi_lattice[t, :] \ * + log_transmat[:, state_sequence[t + 1]]) * state_sequence[t] = max_pos # <<<<<<<<<<<<<< @@ -2927,20 +3082,20 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje * return state_sequence, logprob */ __pyx_t_19 = __pyx_v_t; - if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_bshape_0_state_sequence; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_state_sequence.buf, __pyx_t_19, __pyx_bstride_0_state_sequence) = __pyx_v_max_pos; + if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_pybuffernd_state_sequence.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_pybuffernd_state_sequence.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_state_sequence.diminfo[0].strides) = __pyx_v_max_pos; } - /* "sklearn/_hmmc.pyx":123 + /* "sklearn/_hmmc.pyx":122 * state_sequence[t] = max_pos * * return state_sequence, logprob # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_logprob); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_logprob); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_state_sequence)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_state_sequence)); __Pyx_GIVEREF(((PyObject *)__pyx_v_state_sequence)); @@ -2961,23 +3116,23 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje __Pyx_XDECREF(__pyx_t_5); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_state_sequence); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_transmat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_framelogprob); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_viterbi_lattice); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_work_buffer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_startprob); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_startprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_state_sequence.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn._hmmc._viterbi", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_state_sequence); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_transmat); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_framelogprob); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_viterbi_lattice); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_work_buffer); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_log_startprob); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_framelogprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_startprob.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_log_transmat.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_state_sequence.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_viterbi_lattice.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_work_buffer.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_viterbi_lattice); __Pyx_XDECREF((PyObject *)__pyx_v_state_sequence); @@ -2987,7 +3142,18 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje return __pyx_r; } -/* "numpy.pxd":190 +/* 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) { + int __pyx_r; + __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)); + __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): # <<<<<<<<<<<<<< @@ -2995,8 +3161,7 @@ static PyObject *__pyx_pf_7sklearn_5_hmmc_4_viterbi(PyObject *__pyx_self, PyObje * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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; int __pyx_v_ndim; @@ -3021,13 +3186,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -3038,11 +3203,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3051,7 +3216,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3060,16 +3225,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3079,7 +3244,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -3087,11 +3252,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -3100,9 +3265,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3112,37 +3277,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * 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") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.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_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3152,46 +3317,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * 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") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.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_9), 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, ((PyObject *)__pyx_k_tuple_9), 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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -3200,7 +3365,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -3209,7 +3374,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.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) # <<<<<<<<<<<<<< @@ -3218,7 +3383,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.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 # <<<<<<<<<<<<<< @@ -3227,7 +3392,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -3238,49 +3403,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -3289,25 +3454,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -3316,17 +3481,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -3335,7 +3502,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -3351,7 +3518,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -3363,49 +3530,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -3416,10 +3584,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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" */ @@ -3436,24 +3604,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), 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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (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" @@ -3462,10 +3630,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -3475,10 +3643,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -3488,10 +3656,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -3501,10 +3669,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -3514,10 +3682,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -3527,10 +3695,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -3540,10 +3708,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -3553,10 +3721,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -3566,10 +3734,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -3579,10 +3747,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -3592,10 +3760,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -3605,10 +3773,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -3618,10 +3786,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -3631,10 +3799,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -3644,10 +3812,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -3657,10 +3825,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -3670,37 +3838,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __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_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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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)); __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -3709,7 +3877,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -3718,57 +3886,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -3793,31 +3961,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* 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)); + __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 CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -3825,11 +4001,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3839,7 +4015,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -3847,14 +4023,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -3869,9 +4045,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -3879,7 +4055,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3897,7 +4073,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -3912,9 +4088,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -3922,7 +4098,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3940,7 +4116,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -3955,9 +4131,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -3965,7 +4141,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3983,7 +4159,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3998,9 +4174,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -4008,7 +4184,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4026,7 +4202,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -4041,9 +4217,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -4051,7 +4227,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4069,7 +4245,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.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: # <<<<<<<<<<<<<< @@ -4092,18 +4268,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -4112,7 +4289,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -4121,7 +4298,7 @@ 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":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -4129,31 +4306,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -4162,20 +4344,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} + #endif + } else if (1) { + __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -4183,99 +4394,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), 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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * 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_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), 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_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -4283,16 +4493,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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -4301,7 +4510,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -4310,430 +4519,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.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_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.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_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_17), 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_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.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 = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.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_12), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -4741,25 +4933,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_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __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_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -4788,7 +4980,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -4800,9 +4992,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -4812,7 +5004,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -4824,7 +5016,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -4833,7 +5025,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -4844,7 +5036,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -4853,7 +5045,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -4865,7 +5057,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -4877,9 +5069,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -4889,7 +5081,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -4904,7 +5096,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -4946,13 +5138,15 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, - {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, + {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, + {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, {&__pyx_n_s__N, __pyx_k__N, sizeof(__pyx_k__N), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 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__Xsum, __pyx_k__Xsum, sizeof(__pyx_k__Xsum), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___backward, __pyx_k___backward, sizeof(__pyx_k___backward), 0, 0, 1, 1}, @@ -4965,30 +5159,38 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__framelogprob, __pyx_k__framelogprob, sizeof(__pyx_k__framelogprob), 0, 0, 1, 1}, {&__pyx_n_s__fwdlattice, __pyx_k__fwdlattice, sizeof(__pyx_k__fwdlattice), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__int, __pyx_k__int, sizeof(__pyx_k__int), 0, 0, 1, 1}, + {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__lneta, __pyx_k__lneta, sizeof(__pyx_k__lneta), 0, 0, 1, 1}, {&__pyx_n_s__log_startprob, __pyx_k__log_startprob, sizeof(__pyx_k__log_startprob), 0, 0, 1, 1}, {&__pyx_n_s__log_transmat, __pyx_k__log_transmat, sizeof(__pyx_k__log_transmat), 0, 0, 1, 1}, {&__pyx_n_s__logprob, __pyx_k__logprob, sizeof(__pyx_k__logprob), 0, 0, 1, 1}, {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, + {&__pyx_n_s__max_pos, __pyx_k__max_pos, sizeof(__pyx_k__max_pos), 0, 0, 1, 1}, + {&__pyx_n_s__maxv, __pyx_k__maxv, sizeof(__pyx_k__maxv), 0, 0, 1, 1}, {&__pyx_n_s__n_components, __pyx_k__n_components, sizeof(__pyx_k__n_components), 0, 0, 1, 1}, {&__pyx_n_s__n_observations, __pyx_k__n_observations, sizeof(__pyx_k__n_observations), 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__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__state_sequence, __pyx_k__state_sequence, sizeof(__pyx_k__state_sequence), 0, 0, 1, 1}, + {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1}, + {&__pyx_n_s__viterbi_lattice, __pyx_k__viterbi_lattice, sizeof(__pyx_k__viterbi_lattice), 0, 0, 1, 1}, + {&__pyx_n_s__work_buffer, __pyx_k__work_buffer, sizeof(__pyx_k__work_buffer), 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) { #if PY_MAJOR_VERSION >= 3 - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -4996,138 +5198,351 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/_hmmc.pyx":110 + /* "sklearn/_hmmc.pyx":109 * for t in xrange(1, n_observations): * for j in xrange(n_components): * work_buffer[:] = viterbi_lattice[t - 1, :] + log_transmat[:, j] # <<<<<<<<<<<<<< * viterbi_lattice[t, j] = np.max(work_buffer[:]) + framelogprob[t, j] * */ - __pyx_k_slice_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_1); __Pyx_GIVEREF(__pyx_k_slice_1); - __pyx_k_slice_2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_2 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_2); __Pyx_GIVEREF(__pyx_k_slice_2); - /* "sklearn/_hmmc.pyx":114 + /* "sklearn/_hmmc.pyx":113 * * # observation traceback * max_pos = np.argmax(viterbi_lattice[n_observations - 1, :]) # <<<<<<<<<<<<<< * state_sequence[n_observations - 1] = max_pos * logprob = viterbi_lattice[n_observations - 1, max_pos] */ - __pyx_k_slice_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_3); __Pyx_GIVEREF(__pyx_k_slice_3); - /* "sklearn/_hmmc.pyx":119 + /* "sklearn/_hmmc.pyx":118 * * for t in xrange(n_observations - 2, -1, -1): * max_pos = np.argmax(viterbi_lattice[t, :] \ # <<<<<<<<<<<<<< * + log_transmat[:, state_sequence[t + 1]]) * state_sequence[t] = max_pos */ - __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); - /* "sklearn/_hmmc.pyx":120 + /* "sklearn/_hmmc.pyx":119 * for t in xrange(n_observations - 2, -1, -1): * max_pos = np.argmax(viterbi_lattice[t, :] \ * + log_transmat[:, state_sequence[t + 1]]) # <<<<<<<<<<<<<< * state_sequence[t] = max_pos * */ - __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); - /* "numpy.pxd":211 + /* "numpy.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_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - /* "numpy.pxd":215 + /* "numpy.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_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); - /* "numpy.pxd":819 + /* "numpy.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_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "sklearn/_hmmc.pyx":12 + * + * @cython.boundscheck(False) + * def _logsum(int N, np.ndarray[dtype_t, ndim=1] X): # <<<<<<<<<<<<<< + * cdef int i + * cdef double maxv, Xsum + */ + __pyx_k_tuple_18 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); + __Pyx_INCREF(((PyObject *)__pyx_n_s__N)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__N)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 1, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 2, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__maxv)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 3, ((PyObject *)__pyx_n_s__maxv)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxv)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Xsum)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 4, ((PyObject *)__pyx_n_s__Xsum)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Xsum)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s___logsum, 12, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/_hmmc.pyx":23 + * + * @cython.boundscheck(False) + * def _forward(int n_observations, int n_components, \ # <<<<<<<<<<<<<< + * np.ndarray[dtype_t, ndim=1] log_startprob, \ + * np.ndarray[dtype_t, ndim=2] log_transmat, \ + */ + __pyx_k_tuple_22 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_22); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_observations)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__n_observations)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_observations)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_components)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 1, ((PyObject *)__pyx_n_s__n_components)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_components)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__log_startprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 2, ((PyObject *)__pyx_n_s__log_startprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__log_startprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__log_transmat)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 3, ((PyObject *)__pyx_n_s__log_transmat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__log_transmat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__framelogprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 4, ((PyObject *)__pyx_n_s__framelogprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__framelogprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fwdlattice)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 5, ((PyObject *)__pyx_n_s__fwdlattice)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fwdlattice)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 6, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 7, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 8, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__logprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 9, ((PyObject *)__pyx_n_s__logprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__logprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__work_buffer)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 10, ((PyObject *)__pyx_n_s__work_buffer)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__work_buffer)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); + __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(6, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s___forward, 23, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/_hmmc.pyx":46 + * + * @cython.boundscheck(False) + * def _backward(int n_observations, int n_components, \ # <<<<<<<<<<<<<< + * np.ndarray[dtype_t, ndim=1] log_startprob, \ + * np.ndarray[dtype_t, ndim=2] log_transmat, \ + */ + __pyx_k_tuple_24 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_24); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_observations)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_n_s__n_observations)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_observations)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_components)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 1, ((PyObject *)__pyx_n_s__n_components)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_components)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__log_startprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 2, ((PyObject *)__pyx_n_s__log_startprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__log_startprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__log_transmat)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 3, ((PyObject *)__pyx_n_s__log_transmat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__log_transmat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__framelogprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 4, ((PyObject *)__pyx_n_s__framelogprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__framelogprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__bwdlattice)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 5, ((PyObject *)__pyx_n_s__bwdlattice)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bwdlattice)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 6, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 7, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 8, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__logprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 9, ((PyObject *)__pyx_n_s__logprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__logprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__work_buffer)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 10, ((PyObject *)__pyx_n_s__work_buffer)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__work_buffer)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + __pyx_k_codeobj_25 = (PyObject*)__Pyx_PyCode_New(6, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s___backward, 46, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/_hmmc.pyx":69 + * + * @cython.boundscheck(False) + * def _compute_lneta(int n_observations, int n_components, \ # <<<<<<<<<<<<<< + * np.ndarray[dtype_t, ndim=2] fwdlattice, \ + * np.ndarray[dtype_t, ndim=2] log_transmat, \ + */ + __pyx_k_tuple_26 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_26); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_observations)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__n_observations)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_observations)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_components)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 1, ((PyObject *)__pyx_n_s__n_components)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_components)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fwdlattice)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 2, ((PyObject *)__pyx_n_s__fwdlattice)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fwdlattice)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__log_transmat)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 3, ((PyObject *)__pyx_n_s__log_transmat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__log_transmat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__bwdlattice)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 4, ((PyObject *)__pyx_n_s__bwdlattice)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bwdlattice)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__framelogprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 5, ((PyObject *)__pyx_n_s__framelogprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__framelogprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__logprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 6, ((PyObject *)__pyx_n_s__logprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__logprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__lneta)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 7, ((PyObject *)__pyx_n_s__lneta)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lneta)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 8, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 9, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 10, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + __pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(8, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s___compute_lneta, 69, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/_hmmc.pyx":86 + * + * @cython.boundscheck(False) + * def _viterbi(int n_observations, int n_components, \ # <<<<<<<<<<<<<< + * np.ndarray[dtype_t, ndim=1] log_startprob, \ + * np.ndarray[dtype_t, ndim=2] log_transmat, \ + */ + __pyx_k_tuple_28 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_28); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_observations)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_n_s__n_observations)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_observations)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_components)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 1, ((PyObject *)__pyx_n_s__n_components)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_components)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__log_startprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 2, ((PyObject *)__pyx_n_s__log_startprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__log_startprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__log_transmat)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 3, ((PyObject *)__pyx_n_s__log_transmat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__log_transmat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__framelogprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 4, ((PyObject *)__pyx_n_s__framelogprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__framelogprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 5, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 6, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 7, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__max_pos)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 8, ((PyObject *)__pyx_n_s__max_pos)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_pos)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__viterbi_lattice)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 9, ((PyObject *)__pyx_n_s__viterbi_lattice)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__viterbi_lattice)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__state_sequence)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 10, ((PyObject *)__pyx_n_s__state_sequence)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__state_sequence)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__logprob)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 11, ((PyObject *)__pyx_n_s__logprob)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__logprob)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__work_buffer)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 12, ((PyObject *)__pyx_n_s__work_buffer)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__work_buffer)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + __pyx_k_codeobj_29 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s___viterbi, 86, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -5162,12 +5577,18 @@ PyMODINIT_FUNC PyInit__hmmc(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__hmmc(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__hmmc(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -5178,16 +5599,23 @@ PyMODINIT_FUNC PyInit__hmmc(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_hmmc"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_hmmc"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__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._hmmc")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn._hmmc", __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); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5203,96 +5631,113 @@ PyMODINIT_FUNC PyInit__hmmc(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "sklearn/_hmmc.pyx":1 + /* "sklearn/_hmmc.pyx":2 + * from libc.math cimport exp, log * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * cimport cython */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/_hmmc.pyx":13 + /* "sklearn/_hmmc.pyx":6 + * cimport cython + * + * np.import_array() # <<<<<<<<<<<<<< + * + * ctypedef np.float64_t dtype_t + */ + import_array(); + + /* "sklearn/_hmmc.pyx":12 * * @cython.boundscheck(False) * def _logsum(int N, np.ndarray[dtype_t, ndim=1] X): # <<<<<<<<<<<<<< * cdef int i * cdef double maxv, Xsum */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc__logsum, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc_1_logsum, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___logsum, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___logsum, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/_hmmc.pyx":24 + /* "sklearn/_hmmc.pyx":23 * * @cython.boundscheck(False) * def _forward(int n_observations, int n_components, \ # <<<<<<<<<<<<<< * np.ndarray[dtype_t, ndim=1] log_startprob, \ * np.ndarray[dtype_t, ndim=2] log_transmat, \ */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc_1_forward, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc_3_forward, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___forward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/_hmmc.pyx":47 + /* "sklearn/_hmmc.pyx":46 * * @cython.boundscheck(False) * def _backward(int n_observations, int n_components, \ # <<<<<<<<<<<<<< * np.ndarray[dtype_t, ndim=1] log_startprob, \ * np.ndarray[dtype_t, ndim=2] log_transmat, \ */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc_2_backward, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc_5_backward, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___backward, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/_hmmc.pyx":70 + /* "sklearn/_hmmc.pyx":69 * * @cython.boundscheck(False) * def _compute_lneta(int n_observations, int n_components, \ # <<<<<<<<<<<<<< * np.ndarray[dtype_t, ndim=2] fwdlattice, \ * np.ndarray[dtype_t, ndim=2] log_transmat, \ */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc_3_compute_lneta, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc_7_compute_lneta, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___compute_lneta, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___compute_lneta, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/_hmmc.pyx":87 + /* "sklearn/_hmmc.pyx":86 * * @cython.boundscheck(False) * def _viterbi(int n_observations, int n_components, \ # <<<<<<<<<<<<<< * np.ndarray[dtype_t, ndim=1] log_startprob, \ * np.ndarray[dtype_t, ndim=2] log_transmat, \ */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc_4_viterbi, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5_hmmc_9_viterbi, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___viterbi, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___viterbi, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/_hmmc.pyx":1 - * import numpy as np # <<<<<<<<<<<<<< + * from libc.math cimport exp, log # <<<<<<<<<<<<<< + * import numpy as np * cimport numpy as np - * cimport cython */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5318,7 +5763,6 @@ PyMODINIT_FUNC PyInit__hmmc(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -5359,7 +5803,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -5371,7 +5814,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -5385,7 +5828,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -5401,55 +5844,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; } - if (*name) { + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -5492,18 +5957,6 @@ static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; -} __Pyx_BufFmt_Context; - static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { @@ -5522,6 +5975,8 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; @@ -5529,7 +5984,6 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, type = type->fields->type; } } - static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; @@ -5545,15 +5999,21 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { *ts = t; return count; } - +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } - static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { - case 'b': return "'char'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; @@ -5569,14 +6029,14 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } - static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; @@ -5592,10 +6052,9 @@ static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { return 0; } } - static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'B': return 1; + case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); @@ -5612,7 +6071,6 @@ static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { } } } - typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; @@ -5623,10 +6081,9 @@ typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); @@ -5642,21 +6099,59 @@ static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { return 0; } } - +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } - static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; @@ -5681,16 +6176,37 @@ static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { parent->type->name, field->name); } } - static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; - size_t size, offset; + size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { @@ -5702,35 +6218,35 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } - offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } - ctx->fmt_offset += size; - + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; @@ -5762,7 +6278,48 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { ctx->is_complex = 0; return 0; } - +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { @@ -5777,7 +6334,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } - return ts; + return ts; case ' ': case 10: case 13: @@ -5809,12 +6366,17 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { @@ -5822,10 +6384,19 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (!ts_after_sub) return NULL; } ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ - ++ts; + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; @@ -5846,13 +6417,11 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': - case 'O': + case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { - /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { - /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; @@ -5868,20 +6437,18 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha while(*ts != ':') ++ts; ++ts; break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; default: { - int number = __Pyx_BufFmt_ParseNumber(&ts); - if (number == -1) { /* First char was not a digit */ - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%c')", *ts); - return NULL; - } - ctx->new_count = (size_t)number; + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } } } } - static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; @@ -5889,8 +6456,10 @@ static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; @@ -5910,7 +6479,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* ob } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; @@ -5921,7 +6490,6 @@ fail:; __Pyx_ZeroBuffer(buf); return -1; } - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; @@ -5929,9 +6497,9 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { } static CYTHON_INLINE void __Pyx_ErrRestore(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->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -5941,20 +6509,24 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); @@ -5972,46 +6544,42 @@ static void __Pyx_RaiseBufferFallbackError(void) { "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } - -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -6034,7 +6602,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -6043,10 +6610,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -6056,7 +6622,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -6065,13 +6630,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } 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; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -6088,14 +6676,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -6105,64 +6688,146 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +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 { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; } - static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { - #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} - #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); + PyObject *obj = view->obj; + CYTHON_UNUSED PyObject *releasebuffer_cobj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: Py_DECREF(obj); view->obj = NULL; - } } +#endif /* PY_MAJOR_VERSION < 3 */ -#endif -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; @@ -6188,12 +6853,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -6894,6 +7580,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -6903,15 +7606,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -6927,7 +7625,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -6937,7 +7635,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -6951,51 +7649,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -7006,28 +7758,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -7035,11 +7804,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -7074,6 +7841,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/sklearn/_hmmc.pyx b/sklearn/_hmmc.pyx index b0c8218d2d5cc..5b054dbaddbc9 100644 --- a/sklearn/_hmmc.pyx +++ b/sklearn/_hmmc.pyx @@ -1,10 +1,9 @@ +from libc.math cimport exp, log import numpy as np cimport numpy as np cimport cython -cdef extern from "math.h": - double exp(double) - double log(double) +np.import_array() ctypedef np.float64_t dtype_t diff --git a/sklearn/cluster/_hierarchical.c b/sklearn/cluster/_hierarchical.c index ae791de8171a2..3181c24ca1473 100644 --- a/sklearn/cluster/_hierarchical.c +++ b/sklearn/cluster/_hierarchical.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17pre on Wed Jul 18 15:14:12 2012 */ +/* Generated by Cython 0.17.4 on Thu Jan 10 17:59:48 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -11,7 +11,6 @@ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -23,22 +22,18 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif - #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 @@ -46,25 +41,28 @@ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #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 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), \ (PyObject*)0)) - #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -72,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -86,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -98,11 +94,9 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) - typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #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) \ @@ -112,21 +106,16 @@ #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) #endif - #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 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)) ? \ @@ -139,10 +128,8 @@ #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])) #endif - #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -150,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -169,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -177,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -196,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -209,7 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -228,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -242,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -251,6 +228,7 @@ #define __Pyx_DOCSTR(n) (n) #endif + #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) @@ -386,6 +364,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "_hierarchical.pyx", "numpy.pxd", + "type.pxd", }; #define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; @@ -396,7 +375,7 @@ typedef struct { size_t size; /* sizeof(type) */ size_t arraysize[8]; /* length of array in each dimension */ int ndim; - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ char is_unsigned; int flags; } __Pyx_TypeInfo; @@ -423,7 +402,7 @@ typedef struct { } __Pyx_BufFmt_Context; -/* "numpy.pxd":722 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -432,7 +411,7 @@ typedef struct { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":723 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -441,7 +420,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":724 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -450,7 +429,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":725 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -459,7 +438,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":729 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -468,7 +447,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":730 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -477,7 +456,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":731 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -486,7 +465,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":732 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -495,7 +474,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":736 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -504,7 +483,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":737 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -513,7 +492,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":746 +/* "numpy.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 # <<<<<<<<<<<<<< @@ -522,7 +501,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":747 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -531,7 +510,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":748 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -540,7 +519,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":750 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -549,7 +528,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":751 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -558,7 +537,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":752 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -567,7 +546,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":754 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -576,7 +555,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":755 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -585,7 +564,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":757 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -594,7 +573,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":758 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -603,7 +582,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":759 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -635,7 +614,7 @@ typedef __pyx_t_5numpy_int_t __pyx_t_7sklearn_7cluster_13_hierarchical_INT; * ctypedef np.int_t INT * ctypedef np.int8_t INT8 # <<<<<<<<<<<<<< * - * + * np.import_array() */ typedef __pyx_t_5numpy_int8_t __pyx_t_7sklearn_7cluster_13_hierarchical_INT8; #if CYTHON_CCOMPLEX @@ -661,7 +640,7 @@ typedef __pyx_t_5numpy_int8_t __pyx_t_7sklearn_7cluster_13_hierarchical_INT8; /*--- Type declarations ---*/ -/* "numpy.pxd":761 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -670,7 +649,7 @@ typedef __pyx_t_5numpy_int8_t __pyx_t_7sklearn_7cluster_13_hierarchical_INT8; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":762 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -679,7 +658,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":763 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -688,7 +667,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":765 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -927,6 +906,7 @@ typedef struct { #define __Pyx_ReleaseBuffer PyBuffer_Release #endif + 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}; @@ -1072,10 +1052,10 @@ static int __Pyx_check_binary_version(void); #endif #endif -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ - static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + typedef struct { int code_line; PyCodeObject* code_object; @@ -1104,6 +1084,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -1120,8 +1105,8 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha /* Module declarations from 'sklearn.cluster._hierarchical' */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE = { "DOUBLE", NULL, sizeof(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT = { "INT", NULL, sizeof(__pyx_t_7sklearn_7cluster_13_hierarchical_INT), { 0 }, 0, 'I', IS_UNSIGNED(__pyx_t_7sklearn_7cluster_13_hierarchical_INT), 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT8 = { "INT8", NULL, sizeof(__pyx_t_7sklearn_7cluster_13_hierarchical_INT8), { 0 }, 0, 'I', IS_UNSIGNED(__pyx_t_7sklearn_7cluster_13_hierarchical_INT8), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT = { "INT", NULL, sizeof(__pyx_t_7sklearn_7cluster_13_hierarchical_INT), { 0 }, 0, IS_UNSIGNED(__pyx_t_7sklearn_7cluster_13_hierarchical_INT) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_7sklearn_7cluster_13_hierarchical_INT), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT8 = { "INT8", NULL, sizeof(__pyx_t_7sklearn_7cluster_13_hierarchical_INT8), { 0 }, 0, IS_UNSIGNED(__pyx_t_7sklearn_7cluster_13_hierarchical_INT8) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_7sklearn_7cluster_13_hierarchical_INT8), 0 }; #define __Pyx_MODULE_NAME "sklearn.cluster._hierarchical" int __pyx_module_is_main_sklearn__cluster___hierarchical = 0; @@ -1141,7 +1126,7 @@ static char __pyx_k_6[] = "Non-native byte order not supported"; static char __pyx_k_8[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_9[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_12[] = "Format string allocated too short."; -static char __pyx_k_16[] = "/volatile/varoquau/dev/scikit-learn/sklearn/cluster/_hierarchical.pyx"; +static char __pyx_k_16[] = "/scratch/apps/src/scikit-learn/sklearn/cluster/_hierarchical.pyx"; static char __pyx_k_17[] = "sklearn.cluster._hierarchical"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; @@ -1297,26 +1282,26 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_1compute_ward_dist(P case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__m_2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coord_row)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coord_col)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__res)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute_ward_dist") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute_ward_dist") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -1335,17 +1320,17 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_1compute_ward_dist(P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("compute_ward_dist", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._hierarchical.compute_ward_dist", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m_1), __pyx_ptype_5numpy_ndarray, 1, "m_1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m_2), __pyx_ptype_5numpy_ndarray, 1, "m_2", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coord_row), __pyx_ptype_5numpy_ndarray, 1, "coord_row", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coord_col), __pyx_ptype_5numpy_ndarray, 1, "coord_col", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_res), __pyx_ptype_5numpy_ndarray, 1, "res", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m_1), __pyx_ptype_5numpy_ndarray, 1, "m_1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_m_2), __pyx_ptype_5numpy_ndarray, 1, "m_2", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coord_row), __pyx_ptype_5numpy_ndarray, 1, "coord_row", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coord_col), __pyx_ptype_5numpy_ndarray, 1, "coord_col", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_res), __pyx_ptype_5numpy_ndarray, 1, "res", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(__pyx_self, __pyx_v_m_1, __pyx_v_m_2, __pyx_v_coord_row, __pyx_v_coord_col, __pyx_v_res); goto __pyx_L0; __pyx_L1_error:; @@ -1355,7 +1340,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_1compute_ward_dist(P return __pyx_r; } -/* "sklearn/cluster/_hierarchical.pyx":12 +/* "sklearn/cluster/_hierarchical.pyx":14 * @cython.wraparound(False) * @cython.cdivision(True) * def compute_ward_dist(np.ndarray[DOUBLE, ndim=1] m_1,\ # <<<<<<<<<<<<<< @@ -1426,31 +1411,31 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY __pyx_pybuffernd_res.rcbuffer = &__pyx_pybuffer_res; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m_1.rcbuffer->pybuffer, (PyObject*)__pyx_v_m_1, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m_1.rcbuffer->pybuffer, (PyObject*)__pyx_v_m_1, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_m_1.diminfo[0].strides = __pyx_pybuffernd_m_1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_m_1.diminfo[0].shape = __pyx_pybuffernd_m_1.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m_2.rcbuffer->pybuffer, (PyObject*)__pyx_v_m_2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m_2.rcbuffer->pybuffer, (PyObject*)__pyx_v_m_2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_m_2.diminfo[0].strides = __pyx_pybuffernd_m_2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_m_2.diminfo[0].shape = __pyx_pybuffernd_m_2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_m_2.diminfo[1].strides = __pyx_pybuffernd_m_2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_m_2.diminfo[1].shape = __pyx_pybuffernd_m_2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coord_row.rcbuffer->pybuffer, (PyObject*)__pyx_v_coord_row, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coord_row.rcbuffer->pybuffer, (PyObject*)__pyx_v_coord_row, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_coord_row.diminfo[0].strides = __pyx_pybuffernd_coord_row.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coord_row.diminfo[0].shape = __pyx_pybuffernd_coord_row.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coord_col.rcbuffer->pybuffer, (PyObject*)__pyx_v_coord_col, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coord_col.rcbuffer->pybuffer, (PyObject*)__pyx_v_coord_col, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_coord_col.diminfo[0].strides = __pyx_pybuffernd_coord_col.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coord_col.diminfo[0].shape = __pyx_pybuffernd_coord_col.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_res.rcbuffer->pybuffer, (PyObject*)__pyx_v_res, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_res.rcbuffer->pybuffer, (PyObject*)__pyx_v_res, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_res.diminfo[0].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_res.diminfo[0].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[0]; - /* "sklearn/cluster/_hierarchical.pyx":17 + /* "sklearn/cluster/_hierarchical.pyx":19 * np.ndarray[INT, ndim=1] coord_col,\ * np.ndarray[DOUBLE, ndim=1] res): * cdef int size_max = coord_row.shape[0] # <<<<<<<<<<<<<< @@ -1459,7 +1444,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY */ __pyx_v_size_max = (__pyx_v_coord_row->dimensions[0]); - /* "sklearn/cluster/_hierarchical.pyx":18 + /* "sklearn/cluster/_hierarchical.pyx":20 * np.ndarray[DOUBLE, ndim=1] res): * cdef int size_max = coord_row.shape[0] * cdef int n_features = m_2.shape[1] # <<<<<<<<<<<<<< @@ -1468,7 +1453,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY */ __pyx_v_n_features = (__pyx_v_m_2->dimensions[1]); - /* "sklearn/cluster/_hierarchical.pyx":21 + /* "sklearn/cluster/_hierarchical.pyx":23 * cdef int i, j, row, col * cdef DOUBLE pa, n * for i in range(size_max): # <<<<<<<<<<<<<< @@ -1479,7 +1464,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/cluster/_hierarchical.pyx":22 + /* "sklearn/cluster/_hierarchical.pyx":24 * cdef DOUBLE pa, n * for i in range(size_max): * row = coord_row[i] # <<<<<<<<<<<<<< @@ -1489,7 +1474,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY __pyx_t_3 = __pyx_v_i; __pyx_v_row = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_INT *, __pyx_pybuffernd_coord_row.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_coord_row.diminfo[0].strides)); - /* "sklearn/cluster/_hierarchical.pyx":23 + /* "sklearn/cluster/_hierarchical.pyx":25 * for i in range(size_max): * row = coord_row[i] * col = coord_col[i] # <<<<<<<<<<<<<< @@ -1499,7 +1484,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY __pyx_t_4 = __pyx_v_i; __pyx_v_col = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_INT *, __pyx_pybuffernd_coord_col.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_coord_col.diminfo[0].strides)); - /* "sklearn/cluster/_hierarchical.pyx":24 + /* "sklearn/cluster/_hierarchical.pyx":26 * row = coord_row[i] * col = coord_col[i] * n = (m_1[row] * m_1[col]) / (m_1[row] + m_1[col]) # <<<<<<<<<<<<<< @@ -1512,7 +1497,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY __pyx_t_8 = __pyx_v_col; __pyx_v_n = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE *, __pyx_pybuffernd_m_1.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_m_1.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE *, __pyx_pybuffernd_m_1.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_m_1.diminfo[0].strides))) / ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE *, __pyx_pybuffernd_m_1.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_m_1.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE *, __pyx_pybuffernd_m_1.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_m_1.diminfo[0].strides)))); - /* "sklearn/cluster/_hierarchical.pyx":25 + /* "sklearn/cluster/_hierarchical.pyx":27 * col = coord_col[i] * n = (m_1[row] * m_1[col]) / (m_1[row] + m_1[col]) * pa = 0. # <<<<<<<<<<<<<< @@ -1521,7 +1506,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY */ __pyx_v_pa = 0.; - /* "sklearn/cluster/_hierarchical.pyx":26 + /* "sklearn/cluster/_hierarchical.pyx":28 * n = (m_1[row] * m_1[col]) / (m_1[row] + m_1[col]) * pa = 0. * for j in range(n_features): # <<<<<<<<<<<<<< @@ -1532,7 +1517,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_j = __pyx_t_10; - /* "sklearn/cluster/_hierarchical.pyx":27 + /* "sklearn/cluster/_hierarchical.pyx":29 * pa = 0. * for j in range(n_features): * pa += (m_2[row, j] / m_1[row] - m_2[col, j] / m_1[col])**2 # <<<<<<<<<<<<<< @@ -1548,7 +1533,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY __pyx_v_pa = (__pyx_v_pa + pow((((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE *, __pyx_pybuffernd_m_2.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_m_2.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_m_2.diminfo[1].strides)) / (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE *, __pyx_pybuffernd_m_1.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_m_1.diminfo[0].strides))) - ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE *, __pyx_pybuffernd_m_2.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_m_2.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_m_2.diminfo[1].strides)) / (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE *, __pyx_pybuffernd_m_1.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_m_1.diminfo[0].strides)))), 2.0)); } - /* "sklearn/cluster/_hierarchical.pyx":28 + /* "sklearn/cluster/_hierarchical.pyx":30 * for j in range(n_features): * pa += (m_2[row, j] / m_1[row] - m_2[col, j] / m_1[col])**2 * res[i] = pa * n # <<<<<<<<<<<<<< @@ -1559,7 +1544,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_compute_ward_dist(CY *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_DOUBLE *, __pyx_pybuffernd_res.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_res.diminfo[0].strides) = (__pyx_v_pa * __pyx_v_n); } - /* "sklearn/cluster/_hierarchical.pyx":29 + /* "sklearn/cluster/_hierarchical.pyx":31 * pa += (m_2[row, j] / m_1[row] - m_2[col, j] / m_1[col])**2 * res[i] = pa * n * return res # <<<<<<<<<<<<<< @@ -1629,16 +1614,16 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_3_hc_get_descendent( case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__children)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_hc_get_descendent", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_hc_get_descendent", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_leaves)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_hc_get_descendent", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_hc_get_descendent", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_hc_get_descendent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_hc_get_descendent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -1647,13 +1632,13 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_3_hc_get_descendent( values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_node = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_node == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_node = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_node == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_children = values[1]; - __pyx_v_n_leaves = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_n_leaves == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_leaves = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_n_leaves == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_hc_get_descendent", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_hc_get_descendent", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._hierarchical._hc_get_descendent", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -1664,7 +1649,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_3_hc_get_descendent( return __pyx_r; } -/* "sklearn/cluster/_hierarchical.pyx":32 +/* "sklearn/cluster/_hierarchical.pyx":34 * * * def _hc_get_descendent(int node, children, int n_leaves): # <<<<<<<<<<<<<< @@ -1690,16 +1675,16 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_2_hc_get_descendent( int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_hc_get_descendent", 0); - /* "sklearn/cluster/_hierarchical.pyx":52 + /* "sklearn/cluster/_hierarchical.pyx":54 * descendent : list of int * """ * ind = [node] # <<<<<<<<<<<<<< * if node < n_leaves: * return ind */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -1707,7 +1692,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_2_hc_get_descendent( __pyx_v_ind = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/cluster/_hierarchical.pyx":53 + /* "sklearn/cluster/_hierarchical.pyx":55 * """ * ind = [node] * if node < n_leaves: # <<<<<<<<<<<<<< @@ -1717,7 +1702,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_2_hc_get_descendent( __pyx_t_3 = (__pyx_v_node < __pyx_v_n_leaves); if (__pyx_t_3) { - /* "sklearn/cluster/_hierarchical.pyx":54 + /* "sklearn/cluster/_hierarchical.pyx":56 * ind = [node] * if node < n_leaves: * return ind # <<<<<<<<<<<<<< @@ -1732,19 +1717,19 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_2_hc_get_descendent( } __pyx_L3:; - /* "sklearn/cluster/_hierarchical.pyx":55 + /* "sklearn/cluster/_hierarchical.pyx":57 * if node < n_leaves: * return ind * descendent = [] # <<<<<<<<<<<<<< * # It is actually faster to do the accounting of the number of * # elements is the list ourselves: len is a lengthy operation on a */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_descendent = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/cluster/_hierarchical.pyx":59 + /* "sklearn/cluster/_hierarchical.pyx":61 * # elements is the list ourselves: len is a lengthy operation on a * # chained list * cdef int n_indices = 1 # <<<<<<<<<<<<<< @@ -1753,7 +1738,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_2_hc_get_descendent( */ __pyx_v_n_indices = 1; - /* "sklearn/cluster/_hierarchical.pyx":61 + /* "sklearn/cluster/_hierarchical.pyx":63 * cdef int n_indices = 1 * cdef int i * while n_indices: # <<<<<<<<<<<<<< @@ -1763,20 +1748,20 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_2_hc_get_descendent( while (1) { if (!__pyx_v_n_indices) break; - /* "sklearn/cluster/_hierarchical.pyx":62 + /* "sklearn/cluster/_hierarchical.pyx":64 * cdef int i * while n_indices: * i = ind.pop() # <<<<<<<<<<<<<< * if i < n_leaves: * descendent.append(i) */ - __pyx_t_2 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_ind)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_ind)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_i = __pyx_t_4; - /* "sklearn/cluster/_hierarchical.pyx":63 + /* "sklearn/cluster/_hierarchical.pyx":65 * while n_indices: * i = ind.pop() * if i < n_leaves: # <<<<<<<<<<<<<< @@ -1786,19 +1771,19 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_2_hc_get_descendent( __pyx_t_3 = (__pyx_v_i < __pyx_v_n_leaves); if (__pyx_t_3) { - /* "sklearn/cluster/_hierarchical.pyx":64 + /* "sklearn/cluster/_hierarchical.pyx":66 * i = ind.pop() * if i < n_leaves: * descendent.append(i) # <<<<<<<<<<<<<< * n_indices -= 1 * else: */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyList_Append(__pyx_v_descendent, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_Append(__pyx_v_descendent, __pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/cluster/_hierarchical.pyx":65 + /* "sklearn/cluster/_hierarchical.pyx":67 * if i < n_leaves: * descendent.append(i) * n_indices -= 1 # <<<<<<<<<<<<<< @@ -1810,30 +1795,30 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_2_hc_get_descendent( } /*else*/ { - /* "sklearn/cluster/_hierarchical.pyx":67 + /* "sklearn/cluster/_hierarchical.pyx":69 * n_indices -= 1 * else: * ind.extend(children[i - n_leaves]) # <<<<<<<<<<<<<< * n_indices += 1 * return descendent */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_ind), __pyx_n_s__extend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_ind), __pyx_n_s__extend); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = (__pyx_v_i - __pyx_v_n_leaves); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_children, __pyx_t_4, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_children, __pyx_t_4, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_hierarchical.pyx":68 + /* "sklearn/cluster/_hierarchical.pyx":70 * else: * ind.extend(children[i - n_leaves]) * n_indices += 1 # <<<<<<<<<<<<<< @@ -1845,7 +1830,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_2_hc_get_descendent( __pyx_L6:; } - /* "sklearn/cluster/_hierarchical.pyx":69 + /* "sklearn/cluster/_hierarchical.pyx":71 * ind.extend(children[i - n_leaves]) * n_indices += 1 * return descendent # <<<<<<<<<<<<<< @@ -1908,7 +1893,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_5hc_get_heads(PyObje } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hc_get_heads") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hc_get_heads") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1923,13 +1908,13 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_5hc_get_heads(PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("hc_get_heads", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("hc_get_heads", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._hierarchical.hc_get_heads", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parents), __pyx_ptype_5numpy_ndarray, 1, "parents", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parents), __pyx_ptype_5numpy_ndarray, 1, "parents", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(__pyx_self, __pyx_v_parents, __pyx_v_copy); goto __pyx_L0; __pyx_L1_error:; @@ -1939,7 +1924,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_5hc_get_heads(PyObje return __pyx_r; } -/* "sklearn/cluster/_hierarchical.pyx":74 +/* "sklearn/cluster/_hierarchical.pyx":76 * @cython.boundscheck(False) * @cython.wraparound(False) * def hc_get_heads(np.ndarray[INT, ndim=1] parents, copy=True): # <<<<<<<<<<<<<< @@ -1981,42 +1966,42 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON __pyx_pybuffernd_parents.rcbuffer = &__pyx_pybuffer_parents; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_parents.rcbuffer->pybuffer, (PyObject*)__pyx_v_parents, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_parents.rcbuffer->pybuffer, (PyObject*)__pyx_v_parents, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_parents.diminfo[0].strides = __pyx_pybuffernd_parents.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_parents.diminfo[0].shape = __pyx_pybuffernd_parents.rcbuffer->pybuffer.shape[0]; - /* "sklearn/cluster/_hierarchical.pyx":91 + /* "sklearn/cluster/_hierarchical.pyx":93 * """ * cdef unsigned int parent, node0, node, size * if copy: # <<<<<<<<<<<<<< * parents = np.copy(parents) * size = parents.size */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "sklearn/cluster/_hierarchical.pyx":92 + /* "sklearn/cluster/_hierarchical.pyx":94 * cdef unsigned int parent, node0, node, size * if copy: * parents = np.copy(parents) # <<<<<<<<<<<<<< * size = parents.size * for node0 in range(size): */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __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 = 92; __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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_parents)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_parents)); __Pyx_GIVEREF(((PyObject *)__pyx_v_parents)); - __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __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; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2032,7 +2017,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON } } __pyx_pybuffernd_parents.diminfo[0].strides = __pyx_pybuffernd_parents.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_parents.diminfo[0].shape = __pyx_pybuffernd_parents.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_parents)); @@ -2042,20 +2027,20 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON } __pyx_L3:; - /* "sklearn/cluster/_hierarchical.pyx":93 + /* "sklearn/cluster/_hierarchical.pyx":95 * if copy: * parents = np.copy(parents) * size = parents.size # <<<<<<<<<<<<<< * for node0 in range(size): * # Start from the top of the tree and go down */ - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_parents), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_parents), __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_10 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_10 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_size = __pyx_t_10; - /* "sklearn/cluster/_hierarchical.pyx":94 + /* "sklearn/cluster/_hierarchical.pyx":96 * parents = np.copy(parents) * size = parents.size * for node0 in range(size): # <<<<<<<<<<<<<< @@ -2066,7 +2051,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_node0 = __pyx_t_11; - /* "sklearn/cluster/_hierarchical.pyx":96 + /* "sklearn/cluster/_hierarchical.pyx":98 * for node0 in range(size): * # Start from the top of the tree and go down * node0 = size - node0 - 1 # <<<<<<<<<<<<<< @@ -2075,7 +2060,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON */ __pyx_v_node0 = ((__pyx_v_size - __pyx_v_node0) - 1); - /* "sklearn/cluster/_hierarchical.pyx":97 + /* "sklearn/cluster/_hierarchical.pyx":99 * # Start from the top of the tree and go down * node0 = size - node0 - 1 * node = node0 # <<<<<<<<<<<<<< @@ -2084,7 +2069,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON */ __pyx_v_node = __pyx_v_node0; - /* "sklearn/cluster/_hierarchical.pyx":98 + /* "sklearn/cluster/_hierarchical.pyx":100 * node0 = size - node0 - 1 * node = node0 * parent = parents[node] # <<<<<<<<<<<<<< @@ -2094,7 +2079,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON __pyx_t_12 = __pyx_v_node; __pyx_v_parent = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_INT *, __pyx_pybuffernd_parents.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_parents.diminfo[0].strides)); - /* "sklearn/cluster/_hierarchical.pyx":99 + /* "sklearn/cluster/_hierarchical.pyx":101 * node = node0 * parent = parents[node] * while parent != node: # <<<<<<<<<<<<<< @@ -2105,7 +2090,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON __pyx_t_1 = (__pyx_v_parent != __pyx_v_node); if (!__pyx_t_1) break; - /* "sklearn/cluster/_hierarchical.pyx":100 + /* "sklearn/cluster/_hierarchical.pyx":102 * parent = parents[node] * while parent != node: * parents[node0] = parent # <<<<<<<<<<<<<< @@ -2115,7 +2100,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON __pyx_t_13 = __pyx_v_node0; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_INT *, __pyx_pybuffernd_parents.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_parents.diminfo[0].strides) = __pyx_v_parent; - /* "sklearn/cluster/_hierarchical.pyx":101 + /* "sklearn/cluster/_hierarchical.pyx":103 * while parent != node: * parents[node0] = parent * node = parent # <<<<<<<<<<<<<< @@ -2124,7 +2109,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON */ __pyx_v_node = __pyx_v_parent; - /* "sklearn/cluster/_hierarchical.pyx":102 + /* "sklearn/cluster/_hierarchical.pyx":104 * parents[node0] = parent * node = parent * parent = parents[node] # <<<<<<<<<<<<<< @@ -2136,7 +2121,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_4hc_get_heads(CYTHON } } - /* "sklearn/cluster/_hierarchical.pyx":103 + /* "sklearn/cluster/_hierarchical.pyx":105 * node = parent * parent = parents[node] * return parents # <<<<<<<<<<<<<< @@ -2204,21 +2189,21 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_7_get_parents(PyObje case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__heads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_get_parents", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_get_parents", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parents)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_get_parents", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_get_parents", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__not_visited)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_get_parents", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_get_parents", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_get_parents") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_get_parents") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -2235,14 +2220,14 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_7_get_parents(PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_get_parents", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_get_parents", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._hierarchical._get_parents", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parents), __pyx_ptype_5numpy_ndarray, 1, "parents", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_not_visited), __pyx_ptype_5numpy_ndarray, 1, "not_visited", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parents), __pyx_ptype_5numpy_ndarray, 1, "parents", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_not_visited), __pyx_ptype_5numpy_ndarray, 1, "not_visited", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(__pyx_self, __pyx_v_nodes, __pyx_v_heads, __pyx_v_parents, __pyx_v_not_visited); goto __pyx_L0; __pyx_L1_error:; @@ -2252,7 +2237,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_13_hierarchical_7_get_parents(PyObje return __pyx_r; } -/* "sklearn/cluster/_hierarchical.pyx":108 +/* "sklearn/cluster/_hierarchical.pyx":110 * @cython.boundscheck(False) * @cython.wraparound(False) * def _get_parents(nodes, heads, np.ndarray[INT, ndim=1] parents, # <<<<<<<<<<<<<< @@ -2294,16 +2279,16 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON __pyx_pybuffernd_not_visited.rcbuffer = &__pyx_pybuffer_not_visited; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_parents.rcbuffer->pybuffer, (PyObject*)__pyx_v_parents, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_parents.rcbuffer->pybuffer, (PyObject*)__pyx_v_parents, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_parents.diminfo[0].strides = __pyx_pybuffernd_parents.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_parents.diminfo[0].shape = __pyx_pybuffernd_parents.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_not_visited.rcbuffer->pybuffer, (PyObject*)__pyx_v_not_visited, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT8, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_not_visited.rcbuffer->pybuffer, (PyObject*)__pyx_v_not_visited, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_13_hierarchical_INT8, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_not_visited.diminfo[0].strides = __pyx_pybuffernd_not_visited.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_not_visited.diminfo[0].shape = __pyx_pybuffernd_not_visited.rcbuffer->pybuffer.shape[0]; - /* "sklearn/cluster/_hierarchical.pyx":127 + /* "sklearn/cluster/_hierarchical.pyx":129 * """ * cdef unsigned int parent, node * for node in nodes: # <<<<<<<<<<<<<< @@ -2314,7 +2299,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON __pyx_t_1 = __pyx_v_nodes; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_nodes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_nodes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -2322,33 +2307,33 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON if (!__pyx_t_3 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_3 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_4); } - __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_node = __pyx_t_5; - /* "sklearn/cluster/_hierarchical.pyx":128 + /* "sklearn/cluster/_hierarchical.pyx":130 * cdef unsigned int parent, node * for node in nodes: * parent = parents[node] # <<<<<<<<<<<<<< @@ -2358,7 +2343,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON __pyx_t_5 = __pyx_v_node; __pyx_v_parent = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_INT *, __pyx_pybuffernd_parents.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_parents.diminfo[0].strides)); - /* "sklearn/cluster/_hierarchical.pyx":129 + /* "sklearn/cluster/_hierarchical.pyx":131 * for node in nodes: * parent = parents[node] * while parent != node: # <<<<<<<<<<<<<< @@ -2369,7 +2354,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON __pyx_t_6 = (__pyx_v_parent != __pyx_v_node); if (!__pyx_t_6) break; - /* "sklearn/cluster/_hierarchical.pyx":130 + /* "sklearn/cluster/_hierarchical.pyx":132 * parent = parents[node] * while parent != node: * node = parent # <<<<<<<<<<<<<< @@ -2378,7 +2363,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON */ __pyx_v_node = __pyx_v_parent; - /* "sklearn/cluster/_hierarchical.pyx":131 + /* "sklearn/cluster/_hierarchical.pyx":133 * while parent != node: * node = parent * parent = parents[node] # <<<<<<<<<<<<<< @@ -2389,7 +2374,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON __pyx_v_parent = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_INT *, __pyx_pybuffernd_parents.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_parents.diminfo[0].strides)); } - /* "sklearn/cluster/_hierarchical.pyx":132 + /* "sklearn/cluster/_hierarchical.pyx":134 * node = parent * parent = parents[node] * if not_visited[node]: # <<<<<<<<<<<<<< @@ -2400,7 +2385,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON __pyx_t_9 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_INT8 *, __pyx_pybuffernd_not_visited.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_not_visited.diminfo[0].strides)); if (__pyx_t_9) { - /* "sklearn/cluster/_hierarchical.pyx":133 + /* "sklearn/cluster/_hierarchical.pyx":135 * parent = parents[node] * if not_visited[node]: * not_visited[node] = 0 # <<<<<<<<<<<<<< @@ -2410,15 +2395,15 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON __pyx_t_10 = __pyx_v_node; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_13_hierarchical_INT8 *, __pyx_pybuffernd_not_visited.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_not_visited.diminfo[0].strides) = 0; - /* "sklearn/cluster/_hierarchical.pyx":134 + /* "sklearn/cluster/_hierarchical.pyx":136 * if not_visited[node]: * not_visited[node] = 0 * heads.append(node) # <<<<<<<<<<<<<< * return heads */ - __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_node); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_heads, __pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_Append(__pyx_v_heads, __pyx_t_4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -2428,7 +2413,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_hierarchical.pyx":135 + /* "sklearn/cluster/_hierarchical.pyx":137 * not_visited[node] = 0 * heads.append(node) * return heads # <<<<<<<<<<<<<< @@ -2462,8 +2447,8 @@ static PyObject *__pyx_pf_7sklearn_7cluster_13_hierarchical_6_get_parents(CYTHON } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -2472,7 +2457,7 @@ static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_bu return __pyx_r; } -/* "numpy.pxd":193 +/* "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): # <<<<<<<<<<<<<< @@ -2511,7 +2496,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":199 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -2526,7 +2511,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L3:; - /* "numpy.pxd":202 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2535,7 +2520,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":203 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2544,7 +2529,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":205 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -2553,7 +2538,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":207 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2563,7 +2548,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":208 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -2575,7 +2560,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":210 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -2586,7 +2571,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L4:; - /* "numpy.pxd":212 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2596,7 +2581,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); if (__pyx_t_1) { - /* "numpy.pxd":213 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -2610,23 +2595,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.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_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), 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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "numpy.pxd":216 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2636,7 +2621,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); if (__pyx_t_3) { - /* "numpy.pxd":217 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -2650,23 +2635,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_2) { - /* "numpy.pxd":218 + /* "numpy.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_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), 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 = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "numpy.pxd":220 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -2675,7 +2660,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":221 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -2684,7 +2669,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":222 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -2693,7 +2678,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":225 + /* "numpy.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) # <<<<<<<<<<<<<< @@ -2702,7 +2687,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":226 + /* "numpy.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 # <<<<<<<<<<<<<< @@ -2711,7 +2696,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":227 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -2722,7 +2707,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":228 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -2731,7 +2716,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":229 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -2744,7 +2729,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":231 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -2753,7 +2738,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":232 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -2764,7 +2749,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L7:; - /* "numpy.pxd":233 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -2773,7 +2758,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":234 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -2782,7 +2767,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":235 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -2791,7 +2776,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":238 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -2800,17 +2785,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_f = NULL; - /* "numpy.pxd":239 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":243 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -2819,7 +2806,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":245 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -2835,7 +2822,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":247 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -2851,7 +2838,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":250 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -2866,7 +2853,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L10:; - /* "numpy.pxd":252 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -2876,16 +2863,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":253 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":254 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -2900,7 +2888,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (!__pyx_t_2) { - /* "numpy.pxd":255 + /* "numpy.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -2920,23 +2908,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":256 + /* "numpy.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_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), 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 = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; - /* "numpy.pxd":257 + /* "numpy.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -2949,7 +2937,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -2962,7 +2950,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2975,7 +2963,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2988,7 +2976,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -3001,7 +2989,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -3014,7 +3002,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -3027,7 +3015,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -3040,7 +3028,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -3053,7 +3041,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -3066,7 +3054,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -3079,7 +3067,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -3092,7 +3080,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -3105,7 +3093,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -3118,7 +3106,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":271 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -3131,7 +3119,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":272 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -3144,7 +3132,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":273 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -3158,33 +3146,33 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":275 + /* "numpy.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 = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __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_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 = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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)); __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 = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__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 = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; - /* "numpy.pxd":276 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -3193,7 +3181,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":277 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -3206,7 +3194,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":279 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -3215,7 +3203,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":280 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -3224,7 +3212,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":281 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -3233,17 +3221,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_offset = 0; - /* "numpy.pxd":284 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = c'\0' # Terminate format string * */ - __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 = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":285 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< @@ -3278,15 +3266,15 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":287 +/* "numpy.pxd":288 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -3299,7 +3287,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":288 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -3309,7 +3297,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":289 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -3321,7 +3309,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L3:; - /* "numpy.pxd":290 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3331,7 +3319,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":291 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -3346,7 +3334,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":767 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -3363,7 +3351,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -3371,7 +3359,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3389,7 +3377,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -3406,7 +3394,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -3414,7 +3402,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3432,7 +3420,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -3449,7 +3437,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -3457,7 +3445,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3475,7 +3463,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3492,7 +3480,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -3500,7 +3488,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3518,7 +3506,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -3535,7 +3523,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":780 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -3543,7 +3531,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3561,7 +3549,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":782 +/* "numpy.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: # <<<<<<<<<<<<<< @@ -3596,7 +3584,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":789 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3605,7 +3593,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":790 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3614,7 +3602,7 @@ 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":793 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -3623,35 +3611,35 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":794 + /* "numpy.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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":795 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -3668,7 +3656,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); @@ -3676,22 +3664,22 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} #endif } else if (1) { - __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; @@ -3699,10 +3687,10 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __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 = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__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 = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -3710,48 +3698,47 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":797 + /* "numpy.pxd":798 * child, new_offset = fields * * 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 = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_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 = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { - /* "numpy.pxd":798 + /* "numpy.pxd":799 * * 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_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_10), 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_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "numpy.pxd":800 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -3766,7 +3753,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } if (!__pyx_t_8) { - /* "numpy.pxd":801 + /* "numpy.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -3786,23 +3773,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } if (__pyx_t_7) { - /* "numpy.pxd":802 + /* "numpy.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_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), 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_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; - /* "numpy.pxd":812 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -3810,16 +3797,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 = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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 = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; - /* "numpy.pxd":813 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -3828,7 +3814,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":814 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -3837,7 +3823,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":815 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -3848,7 +3834,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":817 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -3858,7 +3844,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":819 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -3868,20 +3854,20 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_7) { - /* "numpy.pxd":820 + /* "numpy.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 = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":821 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -3891,282 +3877,268 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_7) { - /* "numpy.pxd":822 + /* "numpy.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_13), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), 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_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; - /* "numpy.pxd":825 + /* "numpy.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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { (__pyx_v_f[0]) = 98; goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { (__pyx_v_f[0]) = 104; goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { (__pyx_v_f[0]) = 105; goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { (__pyx_v_f[0]) = 108; goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { (__pyx_v_f[0]) = 113; goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { (__pyx_v_f[0]) = 102; goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { (__pyx_v_f[0]) = 103; goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; @@ -4175,19 +4147,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L13; } - /* "numpy.pxd":839 + /* "numpy.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 = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_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 = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { (__pyx_v_f[0]) = 90; @@ -4196,19 +4167,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L13; } - /* "numpy.pxd":840 + /* "numpy.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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; @@ -4217,19 +4187,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L13; } - /* "numpy.pxd":841 + /* "numpy.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 = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_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 = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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) { (__pyx_v_f[0]) = 79; @@ -4237,30 +4206,30 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } /*else*/ { - /* "numpy.pxd":843 + /* "numpy.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_8), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __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 = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; - /* "numpy.pxd":844 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -4272,21 +4241,21 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } /*else*/ { - /* "numpy.pxd":848 + /* "numpy.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 = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":849 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -4315,7 +4284,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":964 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -4329,7 +4298,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":966 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -4339,7 +4308,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":967 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -4351,7 +4320,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":969 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -4360,7 +4329,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":970 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -4371,7 +4340,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":971 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -4380,7 +4349,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":972 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -4392,7 +4361,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":974 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -4406,7 +4375,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":975 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -4416,7 +4385,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":976 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -4431,7 +4400,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":978 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -4519,9 +4488,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -4531,98 +4500,98 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numpy.pxd":214 + /* "numpy.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_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_u_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); - /* "numpy.pxd":218 + /* "numpy.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_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_u_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "numpy.pxd":256 + /* "numpy.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_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - /* "numpy.pxd":798 + /* "numpy.pxd":799 * * 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_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "numpy.pxd":802 + /* "numpy.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_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - /* "numpy.pxd":822 + /* "numpy.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_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); - /* "sklearn/cluster/_hierarchical.pyx":12 + /* "sklearn/cluster/_hierarchical.pyx":14 * @cython.wraparound(False) * @cython.cdivision(True) * def compute_ward_dist(np.ndarray[DOUBLE, ndim=1] m_1,\ # <<<<<<<<<<<<<< * np.ndarray[DOUBLE, ndim=2] m_2,\ * np.ndarray[INT, ndim=1] coord_row, */ - __pyx_k_tuple_14 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_14 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_n_s__m_1)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_n_s__m_1)); @@ -4664,16 +4633,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_14, 12, ((PyObject *)__pyx_n_s__n)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - __pyx_k_codeobj_15 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__compute_ward_dist, 12, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_15 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__compute_ward_dist, 14, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/cluster/_hierarchical.pyx":32 + /* "sklearn/cluster/_hierarchical.pyx":34 * * * def _hc_get_descendent(int node, children, int n_leaves): # <<<<<<<<<<<<<< * """ * Function returning all the descendent leaves of a set of nodes in the tree. */ - __pyx_k_tuple_18 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_18 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_18); __Pyx_INCREF(((PyObject *)__pyx_n_s__node)); PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__node)); @@ -4697,16 +4666,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_18, 6, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); - __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s___hc_get_descendent, 32, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s___hc_get_descendent, 34, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/cluster/_hierarchical.pyx":74 + /* "sklearn/cluster/_hierarchical.pyx":76 * @cython.boundscheck(False) * @cython.wraparound(False) * def hc_get_heads(np.ndarray[INT, ndim=1] parents, copy=True): # <<<<<<<<<<<<<< * """ Return the heads of the forest, as defined by parents * */ - __pyx_k_tuple_20 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_20 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_INCREF(((PyObject *)__pyx_n_s__parents)); PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_n_s__parents)); @@ -4727,16 +4696,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_20, 5, ((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - __pyx_k_codeobj_21 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__hc_get_heads, 74, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_21 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__hc_get_heads, 76, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/cluster/_hierarchical.pyx":108 + /* "sklearn/cluster/_hierarchical.pyx":110 * @cython.boundscheck(False) * @cython.wraparound(False) * def _get_parents(nodes, heads, np.ndarray[INT, ndim=1] parents, # <<<<<<<<<<<<<< * np.ndarray[INT8, ndim=1] not_visited): * """ Return the heads of the given nodes, as defined by parents */ - __pyx_k_tuple_22 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_22 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_22); __Pyx_INCREF(((PyObject *)__pyx_n_s__nodes)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__nodes)); @@ -4757,7 +4726,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_22, 5, ((PyObject *)__pyx_n_s__node)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__node)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); - __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s___get_parents, 108, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(4, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s___get_parents, 110, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -4814,16 +4783,20 @@ PyMODINIT_FUNC PyInit__hierarchical(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_hierarchical"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_hierarchical"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__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.cluster._hierarchical")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.cluster._hierarchical", __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 (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __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); #endif @@ -4842,11 +4815,18 @@ PyMODINIT_FUNC PyInit__hierarchical(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -4861,57 +4841,66 @@ PyMODINIT_FUNC PyInit__hierarchical(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_hierarchical.pyx":12 + /* "sklearn/cluster/_hierarchical.pyx":8 + * ctypedef np.int8_t INT8 + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/cluster/_hierarchical.pyx":14 * @cython.wraparound(False) * @cython.cdivision(True) * def compute_ward_dist(np.ndarray[DOUBLE, ndim=1] m_1,\ # <<<<<<<<<<<<<< * np.ndarray[DOUBLE, ndim=2] m_2,\ * np.ndarray[INT, ndim=1] coord_row, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_13_hierarchical_1compute_ward_dist, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_13_hierarchical_1compute_ward_dist, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__compute_ward_dist, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__compute_ward_dist, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_hierarchical.pyx":32 + /* "sklearn/cluster/_hierarchical.pyx":34 * * * def _hc_get_descendent(int node, children, int n_leaves): # <<<<<<<<<<<<<< * """ * Function returning all the descendent leaves of a set of nodes in the tree. */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_13_hierarchical_3_hc_get_descendent, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_13_hierarchical_3_hc_get_descendent, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___hc_get_descendent, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___hc_get_descendent, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_hierarchical.pyx":74 + /* "sklearn/cluster/_hierarchical.pyx":76 * @cython.boundscheck(False) * @cython.wraparound(False) * def hc_get_heads(np.ndarray[INT, ndim=1] parents, copy=True): # <<<<<<<<<<<<<< * """ Return the heads of the forest, as defined by parents * */ - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_1 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_13_hierarchical_5hc_get_heads, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_13_hierarchical_5hc_get_heads, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hc_get_heads, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hc_get_heads, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_hierarchical.pyx":108 + /* "sklearn/cluster/_hierarchical.pyx":110 * @cython.boundscheck(False) * @cython.wraparound(False) * def _get_parents(nodes, heads, np.ndarray[INT, ndim=1] parents, # <<<<<<<<<<<<<< * np.ndarray[INT8, ndim=1] not_visited): * """ Return the heads of the given nodes, as defined by parents */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_13_hierarchical_7_get_parents, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_13_hierarchical_7_get_parents, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___get_parents, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___get_parents, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/cluster/_hierarchical.pyx":1 @@ -4924,7 +4913,7 @@ PyMODINIT_FUNC PyInit__hierarchical(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":974 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5001,7 +4990,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %" PY_FORMAT_SIZE_T "d positional argument%s (%" PY_FORMAT_SIZE_T "d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -5015,7 +5004,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -5036,48 +5025,72 @@ static int __Pyx_ParseOptionalKeywords( while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -5175,7 +5188,8 @@ static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { - case 'b': return "'char'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; @@ -5295,7 +5309,9 @@ static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_compl } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'h': case 'i': + case 'c': + return 'H'; + case 'b': case 'h': case 'i': case 'l': case 'q': case 's': case 'p': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': @@ -5390,13 +5406,16 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { ctx->head->parent_offset = parent_offset; continue; } - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %" PY_FORMAT_SIZE_T "d but %" PY_FORMAT_SIZE_T "d expected", + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } @@ -5636,7 +5655,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate( } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, - "Item size of buffer (%" PY_FORMAT_SIZE_T "d byte%s) does not match size of '%s' (%" PY_FORMAT_SIZE_T "d byte%s)", + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; @@ -5705,33 +5724,38 @@ static void __Pyx_RaiseBufferFallbackError(void) { static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -5764,6 +5788,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -5781,12 +5806,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } 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; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -5803,9 +5852,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); @@ -5819,18 +5865,19 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } } bad: + Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" PY_FORMAT_SIZE_T "d)", expected); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "need more than %" PY_FORMAT_SIZE_T "d value%s to unpack", + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } @@ -5886,19 +5933,15 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { CYTHON_UNUSED PyObject *getbuffer_cobj; - #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); - #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_getbuffer"))) { getbufferproc func; - #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); #else @@ -5907,75 +5950,59 @@ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { Py_DECREF(getbuffer_cobj); if (!func) goto fail; - return func(obj, view, flags); } else { PyErr_Clear(); } #endif - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - #if PY_VERSION_HEX < 0x02060000 fail: #endif - return -1; } - static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *obj = view->obj; CYTHON_UNUSED PyObject *releasebuffer_cobj; - if (!obj) return; - #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) { PyBuffer_Release(view); return; } #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } - #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_releasebuffer"))) { releasebufferproc func; - #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); #else func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); #endif - Py_DECREF(releasebuffer_cobj); - if (!func) goto fail; - func(obj, view); return; } else { PyErr_Clear(); } #endif - goto nofail; - #if PY_VERSION_HEX < 0x02060000 fail: #endif PyErr_WriteUnraisable(obj); - nofail: Py_DECREF(obj); view->obj = NULL; } - #endif /* PY_MAJOR_VERSION < 3 */ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; @@ -6704,6 +6731,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -6756,23 +6800,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { diff --git a/sklearn/cluster/_hierarchical.pyx b/sklearn/cluster/_hierarchical.pyx index 90443084e25c7..551b4b16a05d5 100644 --- a/sklearn/cluster/_hierarchical.pyx +++ b/sklearn/cluster/_hierarchical.pyx @@ -5,6 +5,8 @@ ctypedef np.float64_t DOUBLE ctypedef np.int_t INT ctypedef np.int8_t INT8 +np.import_array() + @cython.boundscheck(False) @cython.wraparound(False) diff --git a/sklearn/cluster/_k_means.c b/sklearn/cluster/_k_means.c index 3bd1a9b4ce4c7..99fb52ac7d79f 100644 --- a/sklearn/cluster/_k_means.c +++ b/sklearn/cluster/_k_means.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17 on Sun Oct 14 18:54:49 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:48 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -53,12 +53,15 @@ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) - #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) @@ -248,11 +251,11 @@ #include #define __PYX_HAVE__sklearn__cluster___k_means #define __PYX_HAVE_API__sklearn__cluster___k_means +#include "math.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#include "math.h" #include "cblas.h" #ifdef _OPENMP #include @@ -590,8 +593,8 @@ typedef npy_double __pyx_t_5numpy_double_t; */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* "sklearn/cluster/_k_means.pyx":17 - * cimport cython +/* "sklearn/cluster/_k_means.pyx":19 + * from ..utils.fixes import bincount * * ctypedef np.float64_t DOUBLE # <<<<<<<<<<<<<< * ctypedef np.int32_t INT @@ -599,12 +602,12 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE; -/* "sklearn/cluster/_k_means.pyx":18 +/* "sklearn/cluster/_k_means.pyx":20 * * ctypedef np.float64_t DOUBLE * ctypedef np.int32_t INT # <<<<<<<<<<<<<< * - * + * cdef extern from "cblas.h": */ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_7cluster_8_k_means_INT; #if CYTHON_CCOMPLEX @@ -1137,6 +1140,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from 'libc.math' */ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -1199,7 +1204,7 @@ static char __pyx_k_21[] = "*"; static char __pyx_k_22[] = "utils.extmath"; static char __pyx_k_23[] = "utils.fixes"; static char __pyx_k_26[] = "_mini_batch_update_csr"; -static char __pyx_k_27[] = "/home/varoquau/dev/scikit-learn/sklearn/cluster/_k_means.pyx"; +static char __pyx_k_27[] = "/scratch/apps/src/scikit-learn/sklearn/cluster/_k_means.pyx"; static char __pyx_k_28[] = "sklearn.cluster._k_means"; static char __pyx_k_31[] = "n_samples_in_cluster"; static char __pyx_k__B[] = "B"; @@ -1386,7 +1391,7 @@ static PyObject *__pyx_k_codeobj_30; static PyObject *__pyx_k_codeobj_33; static PyObject *__pyx_k_codeobj_35; -/* "sklearn/cluster/_k_means.pyx":32 +/* "sklearn/cluster/_k_means.pyx":31 * @cython.wraparound(False) * @cython.cdivision(True) * cpdef DOUBLE _assign_labels_array(np.ndarray[DOUBLE, ndim=2] X, # <<<<<<<<<<<<<< @@ -1450,7 +1455,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ int __pyx_clineno = 0; __Pyx_TraceDeclarations __Pyx_RefNannySetupContext("_assign_labels_array", 0); - __Pyx_TraceCall("_assign_labels_array", __pyx_f[0], 32); + __Pyx_TraceCall("_assign_labels_array", __pyx_f[0], 31); __pyx_pybuffer_center_squared_norms.pybuffer.buf = NULL; __pyx_pybuffer_center_squared_norms.refcount = 0; __pyx_pybuffernd_center_squared_norms.data = NULL; @@ -1477,31 +1482,31 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_pybuffernd_distances.rcbuffer = &__pyx_pybuffer_distances; { __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_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_x_squared_norms.diminfo[0].strides = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_squared_norms.diminfo[0].shape = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_centers.diminfo[0].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centers.diminfo[0].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_centers.diminfo[1].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_centers.diminfo[1].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; - /* "sklearn/cluster/_k_means.pyx":42 + /* "sklearn/cluster/_k_means.pyx":41 * """ * cdef: * unsigned int n_clusters = centers.shape[0] # <<<<<<<<<<<<<< @@ -1510,7 +1515,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_n_clusters = (__pyx_v_centers->dimensions[0]); - /* "sklearn/cluster/_k_means.pyx":43 + /* "sklearn/cluster/_k_means.pyx":42 * cdef: * unsigned int n_clusters = centers.shape[0] * unsigned int n_features = centers.shape[1] # <<<<<<<<<<<<<< @@ -1519,7 +1524,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_n_features = (__pyx_v_centers->dimensions[1]); - /* "sklearn/cluster/_k_means.pyx":44 + /* "sklearn/cluster/_k_means.pyx":43 * unsigned int n_clusters = centers.shape[0] * unsigned int n_features = centers.shape[1] * unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -1528,7 +1533,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/cluster/_k_means.pyx":46 + /* "sklearn/cluster/_k_means.pyx":45 * unsigned int n_samples = X.shape[0] * unsigned int sample_idx, center_idx, feature_idx * unsigned int store_distances = 0 # <<<<<<<<<<<<<< @@ -1537,7 +1542,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_store_distances = 0; - /* "sklearn/cluster/_k_means.pyx":48 + /* "sklearn/cluster/_k_means.pyx":47 * unsigned int store_distances = 0 * unsigned int k * DOUBLE inertia = 0.0 # <<<<<<<<<<<<<< @@ -1546,70 +1551,70 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_inertia = 0.0; - /* "sklearn/cluster/_k_means.pyx":51 + /* "sklearn/cluster/_k_means.pyx":50 * DOUBLE min_dist * DOUBLE dist * np.ndarray[DOUBLE, ndim=1] center_squared_norms = np.zeros( # <<<<<<<<<<<<<< * n_clusters, dtype=np.float64) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_k_means.pyx":52 + /* "sklearn/cluster/_k_means.pyx":51 * DOUBLE dist * np.ndarray[DOUBLE, ndim=1] center_squared_norms = np.zeros( * n_clusters, dtype=np.float64) # <<<<<<<<<<<<<< * * if n_samples == distances.shape[0]: */ - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_clusters); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_clusters); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __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 = 51; __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 = 50; __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; - /* "sklearn/cluster/_k_means.pyx":51 + /* "sklearn/cluster/_k_means.pyx":50 * DOUBLE min_dist * DOUBLE dist * np.ndarray[DOUBLE, ndim=1] center_squared_norms = np.zeros( # <<<<<<<<<<<<<< * n_clusters, dtype=np.float64) * */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - /* "sklearn/cluster/_k_means.pyx":52 + /* "sklearn/cluster/_k_means.pyx":51 * DOUBLE dist * np.ndarray[DOUBLE, ndim=1] center_squared_norms = np.zeros( * n_clusters, dtype=np.float64) # <<<<<<<<<<<<<< * * if n_samples == distances.shape[0]: */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __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 = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 50; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __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_center_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_center_squared_norms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_center_squared_norms.diminfo[0].strides = __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_center_squared_norms.diminfo[0].shape = __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.shape[0]; } } @@ -1617,7 +1622,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_v_center_squared_norms = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/cluster/_k_means.pyx":54 + /* "sklearn/cluster/_k_means.pyx":53 * n_clusters, dtype=np.float64) * * if n_samples == distances.shape[0]: # <<<<<<<<<<<<<< @@ -1627,7 +1632,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_7 = (__pyx_v_n_samples == (__pyx_v_distances->dimensions[0])); if (__pyx_t_7) { - /* "sklearn/cluster/_k_means.pyx":55 + /* "sklearn/cluster/_k_means.pyx":54 * * if n_samples == distances.shape[0]: * store_distances = 1 # <<<<<<<<<<<<<< @@ -1639,7 +1644,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ } __pyx_L3:; - /* "sklearn/cluster/_k_means.pyx":57 + /* "sklearn/cluster/_k_means.pyx":56 * store_distances = 1 * * for center_idx in range(n_clusters): # <<<<<<<<<<<<<< @@ -1650,7 +1655,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_center_idx = __pyx_t_9; - /* "sklearn/cluster/_k_means.pyx":59 + /* "sklearn/cluster/_k_means.pyx":58 * for center_idx in range(n_clusters): * center_squared_norms[center_idx] = ddot( * n_features, ¢ers[center_idx, 0], 1, ¢ers[center_idx, 0], 1) # <<<<<<<<<<<<<< @@ -1662,7 +1667,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_12 = __pyx_v_center_idx; __pyx_t_13 = 0; - /* "sklearn/cluster/_k_means.pyx":58 + /* "sklearn/cluster/_k_means.pyx":57 * * for center_idx in range(n_clusters): * center_squared_norms[center_idx] = ddot( # <<<<<<<<<<<<<< @@ -1673,7 +1678,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_center_squared_norms.diminfo[0].strides) = cblas_ddot(__pyx_v_n_features, (&(*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_centers.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_centers.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_centers.diminfo[1].strides))), 1, (&(*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_centers.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_centers.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_centers.diminfo[1].strides))), 1); } - /* "sklearn/cluster/_k_means.pyx":61 + /* "sklearn/cluster/_k_means.pyx":60 * n_features, ¢ers[center_idx, 0], 1, ¢ers[center_idx, 0], 1) * * for sample_idx in range(n_samples): # <<<<<<<<<<<<<< @@ -1684,7 +1689,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_sample_idx = __pyx_t_9; - /* "sklearn/cluster/_k_means.pyx":62 + /* "sklearn/cluster/_k_means.pyx":61 * * for sample_idx in range(n_samples): * min_dist = -1 # <<<<<<<<<<<<<< @@ -1693,7 +1698,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_min_dist = -1.0; - /* "sklearn/cluster/_k_means.pyx":63 + /* "sklearn/cluster/_k_means.pyx":62 * for sample_idx in range(n_samples): * min_dist = -1 * for center_idx in range(n_clusters): # <<<<<<<<<<<<<< @@ -1704,7 +1709,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_center_idx = __pyx_t_16; - /* "sklearn/cluster/_k_means.pyx":64 + /* "sklearn/cluster/_k_means.pyx":63 * min_dist = -1 * for center_idx in range(n_clusters): * dist = 0.0 # <<<<<<<<<<<<<< @@ -1713,7 +1718,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_dist = 0.0; - /* "sklearn/cluster/_k_means.pyx":67 + /* "sklearn/cluster/_k_means.pyx":66 * # hardcoded: minimize euclidean distance to cluster center: * # ||a - b||^2 = ||a||^2 + ||b||^2 -2 * dist += ddot(n_features, &X[sample_idx, 0], 1, # <<<<<<<<<<<<<< @@ -1723,7 +1728,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_17 = __pyx_v_sample_idx; __pyx_t_18 = 0; - /* "sklearn/cluster/_k_means.pyx":68 + /* "sklearn/cluster/_k_means.pyx":67 * # ||a - b||^2 = ||a||^2 + ||b||^2 -2 * dist += ddot(n_features, &X[sample_idx, 0], 1, * ¢ers[center_idx, 0], 1) # <<<<<<<<<<<<<< @@ -1734,7 +1739,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_20 = 0; __pyx_v_dist = (__pyx_v_dist + cblas_ddot(__pyx_v_n_features, (&(*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_X.diminfo[1].strides))), 1, (&(*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_centers.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_centers.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_centers.diminfo[1].strides))), 1)); - /* "sklearn/cluster/_k_means.pyx":69 + /* "sklearn/cluster/_k_means.pyx":68 * dist += ddot(n_features, &X[sample_idx, 0], 1, * ¢ers[center_idx, 0], 1) * dist *= -2 # <<<<<<<<<<<<<< @@ -1743,7 +1748,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_dist = (__pyx_v_dist * -2.0); - /* "sklearn/cluster/_k_means.pyx":70 + /* "sklearn/cluster/_k_means.pyx":69 * ¢ers[center_idx, 0], 1) * dist *= -2 * dist += center_squared_norms[center_idx] # <<<<<<<<<<<<<< @@ -1753,7 +1758,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_21 = __pyx_v_center_idx; __pyx_v_dist = (__pyx_v_dist + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_center_squared_norms.diminfo[0].strides))); - /* "sklearn/cluster/_k_means.pyx":71 + /* "sklearn/cluster/_k_means.pyx":70 * dist *= -2 * dist += center_squared_norms[center_idx] * dist += x_squared_norms[sample_idx] # <<<<<<<<<<<<<< @@ -1763,7 +1768,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_22 = __pyx_v_sample_idx; __pyx_v_dist = (__pyx_v_dist + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x_squared_norms.diminfo[0].strides))); - /* "sklearn/cluster/_k_means.pyx":72 + /* "sklearn/cluster/_k_means.pyx":71 * dist += center_squared_norms[center_idx] * dist += x_squared_norms[sample_idx] * if min_dist == -1 or dist < min_dist: # <<<<<<<<<<<<<< @@ -1779,7 +1784,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ } if (__pyx_t_24) { - /* "sklearn/cluster/_k_means.pyx":73 + /* "sklearn/cluster/_k_means.pyx":72 * dist += x_squared_norms[sample_idx] * if min_dist == -1 or dist < min_dist: * min_dist = dist # <<<<<<<<<<<<<< @@ -1788,7 +1793,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_min_dist = __pyx_v_dist; - /* "sklearn/cluster/_k_means.pyx":74 + /* "sklearn/cluster/_k_means.pyx":73 * if min_dist == -1 or dist < min_dist: * min_dist = dist * labels[sample_idx] = center_idx # <<<<<<<<<<<<<< @@ -1802,7 +1807,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_L10:; } - /* "sklearn/cluster/_k_means.pyx":76 + /* "sklearn/cluster/_k_means.pyx":75 * labels[sample_idx] = center_idx * * if store_distances: # <<<<<<<<<<<<<< @@ -1811,7 +1816,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ if (__pyx_v_store_distances) { - /* "sklearn/cluster/_k_means.pyx":77 + /* "sklearn/cluster/_k_means.pyx":76 * * if store_distances: * distances[sample_idx] = min_dist # <<<<<<<<<<<<<< @@ -1824,7 +1829,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ } __pyx_L11:; - /* "sklearn/cluster/_k_means.pyx":78 + /* "sklearn/cluster/_k_means.pyx":77 * if store_distances: * distances[sample_idx] = min_dist * inertia += min_dist # <<<<<<<<<<<<<< @@ -1834,7 +1839,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_v_inertia = (__pyx_v_inertia + __pyx_v_min_dist); } - /* "sklearn/cluster/_k_means.pyx":80 + /* "sklearn/cluster/_k_means.pyx":79 * inertia += min_dist * * return inertia # <<<<<<<<<<<<<< @@ -1913,26 +1918,26 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_1_assign_labels_array(PyOb case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_squared_norms)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__centers)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__distances)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_assign_labels_array") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_assign_labels_array") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -1951,17 +1956,17 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_1_assign_labels_array(PyOb } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_array", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._k_means._assign_labels_array", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_squared_norms), __pyx_ptype_5numpy_ndarray, 1, "x_squared_norms", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __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 = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_squared_norms), __pyx_ptype_5numpy_ndarray, 1, "x_squared_norms", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_7cluster_8_k_means__assign_labels_array(__pyx_self, __pyx_v_X, __pyx_v_x_squared_norms, __pyx_v_centers, __pyx_v_labels, __pyx_v_distances); goto __pyx_L0; __pyx_L1_error:; @@ -1971,7 +1976,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_1_assign_labels_array(PyOb return __pyx_r; } -/* "sklearn/cluster/_k_means.pyx":32 +/* "sklearn/cluster/_k_means.pyx":31 * @cython.wraparound(False) * @cython.cdivision(True) * cpdef DOUBLE _assign_labels_array(np.ndarray[DOUBLE, ndim=2] X, # <<<<<<<<<<<<<< @@ -1998,7 +2003,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means__assign_labels_array(CYTHO int __pyx_clineno = 0; __Pyx_TraceDeclarations __Pyx_RefNannySetupContext("_assign_labels_array", 0); - __Pyx_TraceCall("_assign_labels_array", __pyx_f[0], 32); + __Pyx_TraceCall("_assign_labels_array", __pyx_f[0], 31); __pyx_pybuffer_X.pybuffer.buf = NULL; __pyx_pybuffer_X.refcount = 0; __pyx_pybuffernd_X.data = NULL; @@ -2021,31 +2026,31 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means__assign_labels_array(CYTHO __pyx_pybuffernd_distances.rcbuffer = &__pyx_pybuffer_distances; { __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_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_x_squared_norms.diminfo[0].strides = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_squared_norms.diminfo[0].shape = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_centers.diminfo[0].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centers.diminfo[0].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_centers.diminfo[1].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_centers.diminfo[1].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_7cluster_8_k_means__assign_labels_array(__pyx_v_X, __pyx_v_x_squared_norms, __pyx_v_centers, __pyx_v_labels, __pyx_v_distances, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_7cluster_8_k_means__assign_labels_array(__pyx_v_X, __pyx_v_x_squared_norms, __pyx_v_centers, __pyx_v_labels, __pyx_v_distances, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2079,7 +2084,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means__assign_labels_array(CYTHO return __pyx_r; } -/* "sklearn/cluster/_k_means.pyx":86 +/* "sklearn/cluster/_k_means.pyx":85 * @cython.wraparound(False) * @cython.cdivision(True) * cpdef DOUBLE _assign_labels_csr(X, np.ndarray[DOUBLE, ndim=1] x_squared_norms, # <<<<<<<<<<<<<< @@ -2158,7 +2163,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ int __pyx_clineno = 0; __Pyx_TraceDeclarations __Pyx_RefNannySetupContext("_assign_labels_csr", 0); - __Pyx_TraceCall("_assign_labels_csr", __pyx_f[0], 86); + __Pyx_TraceCall("_assign_labels_csr", __pyx_f[0], 85); __pyx_pybuffer_X_data.pybuffer.buf = NULL; __pyx_pybuffer_X_data.refcount = 0; __pyx_pybuffernd_X_data.data = NULL; @@ -2193,41 +2198,41 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_pybuffernd_distances.rcbuffer = &__pyx_pybuffer_distances; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_x_squared_norms.diminfo[0].strides = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_squared_norms.diminfo[0].shape = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_centers.diminfo[0].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centers.diminfo[0].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_centers.diminfo[1].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_centers.diminfo[1].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; - /* "sklearn/cluster/_k_means.pyx":95 + /* "sklearn/cluster/_k_means.pyx":94 * """ * cdef: * np.ndarray[DOUBLE, ndim=1] X_data = X.data # <<<<<<<<<<<<<< * np.ndarray[INT, ndim=1] X_indices = X.indices * np.ndarray[INT, ndim=1] X_indptr = X.indptr */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __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 = 95; __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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; } } @@ -2235,22 +2240,22 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_v_X_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_k_means.pyx":96 + /* "sklearn/cluster/_k_means.pyx":95 * cdef: * np.ndarray[DOUBLE, ndim=1] X_data = X.data * np.ndarray[INT, ndim=1] X_indices = X.indices # <<<<<<<<<<<<<< * np.ndarray[INT, ndim=1] X_indptr = X.indptr * unsigned int n_clusters = centers.shape[0] */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __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 = 96; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; } } @@ -2258,22 +2263,22 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_v_X_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_k_means.pyx":97 + /* "sklearn/cluster/_k_means.pyx":96 * np.ndarray[DOUBLE, ndim=1] X_data = X.data * np.ndarray[INT, ndim=1] X_indices = X.indices * np.ndarray[INT, ndim=1] X_indptr = X.indptr # <<<<<<<<<<<<<< * unsigned int n_clusters = centers.shape[0] * unsigned int n_features = centers.shape[1] */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __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 = 97; __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 = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; } } @@ -2281,7 +2286,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_v_X_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_k_means.pyx":98 + /* "sklearn/cluster/_k_means.pyx":97 * np.ndarray[INT, ndim=1] X_indices = X.indices * np.ndarray[INT, ndim=1] X_indptr = X.indptr * unsigned int n_clusters = centers.shape[0] # <<<<<<<<<<<<<< @@ -2290,7 +2295,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_n_clusters = (__pyx_v_centers->dimensions[0]); - /* "sklearn/cluster/_k_means.pyx":99 + /* "sklearn/cluster/_k_means.pyx":98 * np.ndarray[INT, ndim=1] X_indptr = X.indptr * unsigned int n_clusters = centers.shape[0] * unsigned int n_features = centers.shape[1] # <<<<<<<<<<<<<< @@ -2299,23 +2304,23 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_n_features = (__pyx_v_centers->dimensions[1]); - /* "sklearn/cluster/_k_means.pyx":100 + /* "sklearn/cluster/_k_means.pyx":99 * unsigned int n_clusters = centers.shape[0] * unsigned int n_features = centers.shape[1] * unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< * unsigned int store_distances = 0 * unsigned int sample_idx, center_idx, feature_idx */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __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); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __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_PyInt_AsUnsignedInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_n_samples = __pyx_t_6; - /* "sklearn/cluster/_k_means.pyx":101 + /* "sklearn/cluster/_k_means.pyx":100 * unsigned int n_features = centers.shape[1] * unsigned int n_samples = X.shape[0] * unsigned int store_distances = 0 # <<<<<<<<<<<<<< @@ -2324,7 +2329,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_store_distances = 0; - /* "sklearn/cluster/_k_means.pyx":104 + /* "sklearn/cluster/_k_means.pyx":103 * unsigned int sample_idx, center_idx, feature_idx * unsigned int k * DOUBLE inertia = 0.0 # <<<<<<<<<<<<<< @@ -2333,70 +2338,70 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_inertia = 0.0; - /* "sklearn/cluster/_k_means.pyx":107 + /* "sklearn/cluster/_k_means.pyx":106 * DOUBLE min_dist * DOUBLE dist * np.ndarray[DOUBLE, ndim=1] center_squared_norms = np.zeros( # <<<<<<<<<<<<<< * n_clusters, dtype=np.float64) * */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/cluster/_k_means.pyx":108 + /* "sklearn/cluster/_k_means.pyx":107 * DOUBLE dist * np.ndarray[DOUBLE, ndim=1] center_squared_norms = np.zeros( * n_clusters, dtype=np.float64) # <<<<<<<<<<<<<< * * if n_samples == distances.shape[0]: */ - __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_n_clusters); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_n_clusters); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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); __pyx_t_5 = 0; - /* "sklearn/cluster/_k_means.pyx":107 + /* "sklearn/cluster/_k_means.pyx":106 * DOUBLE min_dist * DOUBLE dist * np.ndarray[DOUBLE, ndim=1] center_squared_norms = np.zeros( # <<<<<<<<<<<<<< * n_clusters, dtype=np.float64) * */ - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - /* "sklearn/cluster/_k_means.pyx":108 + /* "sklearn/cluster/_k_means.pyx":107 * DOUBLE dist * np.ndarray[DOUBLE, ndim=1] center_squared_norms = np.zeros( * n_clusters, dtype=np.float64) # <<<<<<<<<<<<<< * * if n_samples == distances.shape[0]: */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__float64); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_center_squared_norms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_center_squared_norms.diminfo[0].strides = __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_center_squared_norms.diminfo[0].shape = __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.shape[0]; } } @@ -2404,7 +2409,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_v_center_squared_norms = ((PyArrayObject *)__pyx_t_9); __pyx_t_9 = 0; - /* "sklearn/cluster/_k_means.pyx":110 + /* "sklearn/cluster/_k_means.pyx":109 * n_clusters, dtype=np.float64) * * if n_samples == distances.shape[0]: # <<<<<<<<<<<<<< @@ -2414,7 +2419,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_11 = (__pyx_v_n_samples == (__pyx_v_distances->dimensions[0])); if (__pyx_t_11) { - /* "sklearn/cluster/_k_means.pyx":111 + /* "sklearn/cluster/_k_means.pyx":110 * * if n_samples == distances.shape[0]: * store_distances = 1 # <<<<<<<<<<<<<< @@ -2426,7 +2431,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ } __pyx_L3:; - /* "sklearn/cluster/_k_means.pyx":113 + /* "sklearn/cluster/_k_means.pyx":112 * store_distances = 1 * * for center_idx in range(n_clusters): # <<<<<<<<<<<<<< @@ -2437,7 +2442,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_6; __pyx_t_12+=1) { __pyx_v_center_idx = __pyx_t_12; - /* "sklearn/cluster/_k_means.pyx":115 + /* "sklearn/cluster/_k_means.pyx":114 * for center_idx in range(n_clusters): * center_squared_norms[center_idx] = ddot( * n_features, ¢ers[center_idx, 0], 1, ¢ers[center_idx, 0], 1) # <<<<<<<<<<<<<< @@ -2449,7 +2454,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_15 = __pyx_v_center_idx; __pyx_t_16 = 0; - /* "sklearn/cluster/_k_means.pyx":114 + /* "sklearn/cluster/_k_means.pyx":113 * * for center_idx in range(n_clusters): * center_squared_norms[center_idx] = ddot( # <<<<<<<<<<<<<< @@ -2460,7 +2465,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_center_squared_norms.diminfo[0].strides) = cblas_ddot(__pyx_v_n_features, (&(*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_centers.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_centers.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_centers.diminfo[1].strides))), 1, (&(*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_centers.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_centers.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_centers.diminfo[1].strides))), 1); } - /* "sklearn/cluster/_k_means.pyx":117 + /* "sklearn/cluster/_k_means.pyx":116 * n_features, ¢ers[center_idx, 0], 1, ¢ers[center_idx, 0], 1) * * for sample_idx in range(n_samples): # <<<<<<<<<<<<<< @@ -2471,7 +2476,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_6; __pyx_t_12+=1) { __pyx_v_sample_idx = __pyx_t_12; - /* "sklearn/cluster/_k_means.pyx":118 + /* "sklearn/cluster/_k_means.pyx":117 * * for sample_idx in range(n_samples): * min_dist = -1 # <<<<<<<<<<<<<< @@ -2480,7 +2485,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_min_dist = -1.0; - /* "sklearn/cluster/_k_means.pyx":119 + /* "sklearn/cluster/_k_means.pyx":118 * for sample_idx in range(n_samples): * min_dist = -1 * for center_idx in range(n_clusters): # <<<<<<<<<<<<<< @@ -2491,7 +2496,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { __pyx_v_center_idx = __pyx_t_19; - /* "sklearn/cluster/_k_means.pyx":120 + /* "sklearn/cluster/_k_means.pyx":119 * min_dist = -1 * for center_idx in range(n_clusters): * dist = 0.0 # <<<<<<<<<<<<<< @@ -2500,7 +2505,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_dist = 0.0; - /* "sklearn/cluster/_k_means.pyx":123 + /* "sklearn/cluster/_k_means.pyx":122 * # hardcoded: minimize euclidean distance to cluster center: * # ||a - b||^2 = ||a||^2 + ||b||^2 -2 * for k in range(X_indptr[sample_idx], X_indptr[sample_idx + 1]): # <<<<<<<<<<<<<< @@ -2513,7 +2518,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ for (__pyx_t_23 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_INT *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_23 < __pyx_t_21; __pyx_t_23+=1) { __pyx_v_k = __pyx_t_23; - /* "sklearn/cluster/_k_means.pyx":124 + /* "sklearn/cluster/_k_means.pyx":123 * # ||a - b||^2 = ||a||^2 + ||b||^2 -2 * for k in range(X_indptr[sample_idx], X_indptr[sample_idx + 1]): * dist += centers[center_idx, X_indices[k]] * X_data[k] # <<<<<<<<<<<<<< @@ -2527,7 +2532,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_v_dist = (__pyx_v_dist + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_centers.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_centers.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_centers.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_X_data.diminfo[0].strides)))); } - /* "sklearn/cluster/_k_means.pyx":125 + /* "sklearn/cluster/_k_means.pyx":124 * for k in range(X_indptr[sample_idx], X_indptr[sample_idx + 1]): * dist += centers[center_idx, X_indices[k]] * X_data[k] * dist *= -2 # <<<<<<<<<<<<<< @@ -2536,7 +2541,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_dist = (__pyx_v_dist * -2.0); - /* "sklearn/cluster/_k_means.pyx":126 + /* "sklearn/cluster/_k_means.pyx":125 * dist += centers[center_idx, X_indices[k]] * X_data[k] * dist *= -2 * dist += center_squared_norms[center_idx] # <<<<<<<<<<<<<< @@ -2546,7 +2551,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_23 = __pyx_v_center_idx; __pyx_v_dist = (__pyx_v_dist + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_center_squared_norms.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_center_squared_norms.diminfo[0].strides))); - /* "sklearn/cluster/_k_means.pyx":127 + /* "sklearn/cluster/_k_means.pyx":126 * dist *= -2 * dist += center_squared_norms[center_idx] * dist += x_squared_norms[sample_idx] # <<<<<<<<<<<<<< @@ -2556,7 +2561,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_28 = __pyx_v_sample_idx; __pyx_v_dist = (__pyx_v_dist + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_x_squared_norms.diminfo[0].strides))); - /* "sklearn/cluster/_k_means.pyx":128 + /* "sklearn/cluster/_k_means.pyx":127 * dist += center_squared_norms[center_idx] * dist += x_squared_norms[sample_idx] * if min_dist == -1 or dist < min_dist: # <<<<<<<<<<<<<< @@ -2572,7 +2577,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ } if (__pyx_t_30) { - /* "sklearn/cluster/_k_means.pyx":129 + /* "sklearn/cluster/_k_means.pyx":128 * dist += x_squared_norms[sample_idx] * if min_dist == -1 or dist < min_dist: * min_dist = dist # <<<<<<<<<<<<<< @@ -2581,7 +2586,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ __pyx_v_min_dist = __pyx_v_dist; - /* "sklearn/cluster/_k_means.pyx":130 + /* "sklearn/cluster/_k_means.pyx":129 * if min_dist == -1 or dist < min_dist: * min_dist = dist * labels[sample_idx] = center_idx # <<<<<<<<<<<<<< @@ -2591,7 +2596,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_t_31 = __pyx_v_sample_idx; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_INT *, __pyx_pybuffernd_labels.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_labels.diminfo[0].strides) = __pyx_v_center_idx; - /* "sklearn/cluster/_k_means.pyx":131 + /* "sklearn/cluster/_k_means.pyx":130 * min_dist = dist * labels[sample_idx] = center_idx * if store_distances: # <<<<<<<<<<<<<< @@ -2600,7 +2605,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ */ if (__pyx_v_store_distances) { - /* "sklearn/cluster/_k_means.pyx":132 + /* "sklearn/cluster/_k_means.pyx":131 * labels[sample_idx] = center_idx * if store_distances: * distances[sample_idx] = dist # <<<<<<<<<<<<<< @@ -2617,7 +2622,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_L12:; } - /* "sklearn/cluster/_k_means.pyx":133 + /* "sklearn/cluster/_k_means.pyx":132 * if store_distances: * distances[sample_idx] = dist * inertia += min_dist # <<<<<<<<<<<<<< @@ -2627,7 +2632,7 @@ static __pyx_t_7sklearn_7cluster_8_k_means_DOUBLE __pyx_f_7sklearn_7cluster_8_k_ __pyx_v_inertia = (__pyx_v_inertia + __pyx_v_min_dist); } - /* "sklearn/cluster/_k_means.pyx":135 + /* "sklearn/cluster/_k_means.pyx":134 * inertia += min_dist * * return inertia # <<<<<<<<<<<<<< @@ -2713,26 +2718,26 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_3_assign_labels_csr(PyObje case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_squared_norms)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__centers)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__distances)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_assign_labels_csr") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_assign_labels_csr") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -2751,16 +2756,16 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_3_assign_labels_csr(PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_assign_labels_csr", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._k_means._assign_labels_csr", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_squared_norms), __pyx_ptype_5numpy_ndarray, 1, "x_squared_norms", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_squared_norms), __pyx_ptype_5numpy_ndarray, 1, "x_squared_norms", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_7cluster_8_k_means_2_assign_labels_csr(__pyx_self, __pyx_v_X, __pyx_v_x_squared_norms, __pyx_v_centers, __pyx_v_labels, __pyx_v_distances); goto __pyx_L0; __pyx_L1_error:; @@ -2770,7 +2775,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_3_assign_labels_csr(PyObje return __pyx_r; } -/* "sklearn/cluster/_k_means.pyx":86 +/* "sklearn/cluster/_k_means.pyx":85 * @cython.wraparound(False) * @cython.cdivision(True) * cpdef DOUBLE _assign_labels_csr(X, np.ndarray[DOUBLE, ndim=1] x_squared_norms, # <<<<<<<<<<<<<< @@ -2795,7 +2800,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_2_assign_labels_csr(CYTHON int __pyx_clineno = 0; __Pyx_TraceDeclarations __Pyx_RefNannySetupContext("_assign_labels_csr", 0); - __Pyx_TraceCall("_assign_labels_csr", __pyx_f[0], 86); + __Pyx_TraceCall("_assign_labels_csr", __pyx_f[0], 85); __pyx_pybuffer_x_squared_norms.pybuffer.buf = NULL; __pyx_pybuffer_x_squared_norms.refcount = 0; __pyx_pybuffernd_x_squared_norms.data = NULL; @@ -2814,26 +2819,26 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_2_assign_labels_csr(CYTHON __pyx_pybuffernd_distances.rcbuffer = &__pyx_pybuffer_distances; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_x_squared_norms.diminfo[0].strides = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_squared_norms.diminfo[0].shape = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_centers.diminfo[0].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centers.diminfo[0].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_centers.diminfo[1].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_centers.diminfo[1].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_7cluster_8_k_means__assign_labels_csr(__pyx_v_X, __pyx_v_x_squared_norms, __pyx_v_centers, __pyx_v_labels, __pyx_v_distances, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_7cluster_8_k_means__assign_labels_csr(__pyx_v_X, __pyx_v_x_squared_norms, __pyx_v_centers, __pyx_v_labels, __pyx_v_distances, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2905,36 +2910,36 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_5_mini_batch_update_csr(Py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x_squared_norms)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__centers)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__counts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nearest_center)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__old_center)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_mini_batch_update_csr") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_mini_batch_update_csr") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -2953,21 +2958,21 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_5_mini_batch_update_csr(Py __pyx_v_counts = ((PyArrayObject *)values[3]); __pyx_v_nearest_center = ((PyArrayObject *)values[4]); __pyx_v_old_center = ((PyArrayObject *)values[5]); - __pyx_v_compute_squared_diff = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_compute_squared_diff == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_compute_squared_diff = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_compute_squared_diff == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_mini_batch_update_csr", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._k_means._mini_batch_update_csr", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_squared_norms), __pyx_ptype_5numpy_ndarray, 1, "x_squared_norms", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nearest_center), __pyx_ptype_5numpy_ndarray, 1, "nearest_center", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old_center), __pyx_ptype_5numpy_ndarray, 1, "old_center", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x_squared_norms), __pyx_ptype_5numpy_ndarray, 1, "x_squared_norms", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_counts), __pyx_ptype_5numpy_ndarray, 1, "counts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nearest_center), __pyx_ptype_5numpy_ndarray, 1, "nearest_center", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_old_center), __pyx_ptype_5numpy_ndarray, 1, "old_center", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(__pyx_self, __pyx_v_X, __pyx_v_x_squared_norms, __pyx_v_centers, __pyx_v_counts, __pyx_v_nearest_center, __pyx_v_old_center, __pyx_v_compute_squared_diff); goto __pyx_L0; __pyx_L1_error:; @@ -2977,7 +2982,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_5_mini_batch_update_csr(Py return __pyx_r; } -/* "sklearn/cluster/_k_means.pyx":141 +/* "sklearn/cluster/_k_means.pyx":140 * @cython.wraparound(False) * @cython.cdivision(True) * def _mini_batch_update_csr(X, np.ndarray[DOUBLE, ndim=1] x_squared_norms, # <<<<<<<<<<<<<< @@ -3047,7 +3052,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY int __pyx_clineno = 0; __Pyx_TraceDeclarations __Pyx_RefNannySetupContext("_mini_batch_update_csr", 0); - __Pyx_TraceCall("_mini_batch_update_csr", __pyx_f[0], 141); + __Pyx_TraceCall("_mini_batch_update_csr", __pyx_f[0], 140); __pyx_pybuffer_X_data.pybuffer.buf = NULL; __pyx_pybuffer_X_data.refcount = 0; __pyx_pybuffernd_X_data.data = NULL; @@ -3082,46 +3087,46 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_pybuffernd_old_center.rcbuffer = &__pyx_pybuffer_old_center; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer, (PyObject*)__pyx_v_x_squared_norms, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_x_squared_norms.diminfo[0].strides = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x_squared_norms.diminfo[0].shape = __pyx_pybuffernd_x_squared_norms.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_v_centers, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_centers.diminfo[0].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centers.diminfo[0].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_centers.diminfo[1].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_centers.diminfo[1].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_counts.rcbuffer->pybuffer, (PyObject*)__pyx_v_counts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_counts.diminfo[0].strides = __pyx_pybuffernd_counts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_counts.diminfo[0].shape = __pyx_pybuffernd_counts.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nearest_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_nearest_center, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nearest_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_nearest_center, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_nearest_center.diminfo[0].strides = __pyx_pybuffernd_nearest_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nearest_center.diminfo[0].shape = __pyx_pybuffernd_nearest_center.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_old_center, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_old_center.rcbuffer->pybuffer, (PyObject*)__pyx_v_old_center, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_old_center.diminfo[0].strides = __pyx_pybuffernd_old_center.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_old_center.diminfo[0].shape = __pyx_pybuffernd_old_center.rcbuffer->pybuffer.shape[0]; - /* "sklearn/cluster/_k_means.pyx":178 + /* "sklearn/cluster/_k_means.pyx":177 * """ * cdef: * np.ndarray[DOUBLE, ndim=1] X_data = X.data # <<<<<<<<<<<<<< * np.ndarray[int, ndim=1] X_indices = X.indices * np.ndarray[int, ndim=1] X_indptr = X.indptr */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __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 = 178; __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 = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; } } @@ -3129,22 +3134,22 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_v_X_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_k_means.pyx":179 + /* "sklearn/cluster/_k_means.pyx":178 * cdef: * np.ndarray[DOUBLE, ndim=1] X_data = X.data * np.ndarray[int, ndim=1] X_indices = X.indices # <<<<<<<<<<<<<< * np.ndarray[int, ndim=1] X_indptr = X.indptr * unsigned int n_samples = X.shape[0] */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __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 = 179; __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 = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; } } @@ -3152,22 +3157,22 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_v_X_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_k_means.pyx":180 + /* "sklearn/cluster/_k_means.pyx":179 * np.ndarray[DOUBLE, ndim=1] X_data = X.data * np.ndarray[int, ndim=1] X_indices = X.indices * np.ndarray[int, ndim=1] X_indptr = X.indptr # <<<<<<<<<<<<<< * unsigned int n_samples = X.shape[0] * unsigned int n_clusters = centers.shape[0] */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __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 = 180; __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 = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; } } @@ -3175,23 +3180,23 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_v_X_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/cluster/_k_means.pyx":181 + /* "sklearn/cluster/_k_means.pyx":180 * np.ndarray[int, ndim=1] X_indices = X.indices * np.ndarray[int, ndim=1] X_indptr = X.indptr * unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< * unsigned int n_clusters = centers.shape[0] * unsigned int n_features = centers.shape[1] */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __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); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __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_PyInt_AsUnsignedInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_n_samples = __pyx_t_6; - /* "sklearn/cluster/_k_means.pyx":182 + /* "sklearn/cluster/_k_means.pyx":181 * np.ndarray[int, ndim=1] X_indptr = X.indptr * unsigned int n_samples = X.shape[0] * unsigned int n_clusters = centers.shape[0] # <<<<<<<<<<<<<< @@ -3200,7 +3205,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY */ __pyx_v_n_clusters = (__pyx_v_centers->dimensions[0]); - /* "sklearn/cluster/_k_means.pyx":183 + /* "sklearn/cluster/_k_means.pyx":182 * unsigned int n_samples = X.shape[0] * unsigned int n_clusters = centers.shape[0] * unsigned int n_features = centers.shape[1] # <<<<<<<<<<<<<< @@ -3209,7 +3214,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY */ __pyx_v_n_features = (__pyx_v_centers->dimensions[1]); - /* "sklearn/cluster/_k_means.pyx":189 + /* "sklearn/cluster/_k_means.pyx":188 * int old_count, new_count * DOUBLE center_diff * DOUBLE squared_diff = 0.0 # <<<<<<<<<<<<<< @@ -3218,7 +3223,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY */ __pyx_v_squared_diff = 0.0; - /* "sklearn/cluster/_k_means.pyx":192 + /* "sklearn/cluster/_k_means.pyx":191 * * # move centers to the mean of both old and newly assigned samples * for center_idx in range(n_clusters): # <<<<<<<<<<<<<< @@ -3229,7 +3234,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_center_idx = __pyx_t_7; - /* "sklearn/cluster/_k_means.pyx":193 + /* "sklearn/cluster/_k_means.pyx":192 * # move centers to the mean of both old and newly assigned samples * for center_idx in range(n_clusters): * old_count = counts[center_idx] # <<<<<<<<<<<<<< @@ -3239,7 +3244,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_t_8 = __pyx_v_center_idx; __pyx_v_old_count = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_INT *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_counts.diminfo[0].strides)); - /* "sklearn/cluster/_k_means.pyx":194 + /* "sklearn/cluster/_k_means.pyx":193 * for center_idx in range(n_clusters): * old_count = counts[center_idx] * new_count = old_count # <<<<<<<<<<<<<< @@ -3248,7 +3253,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY */ __pyx_v_new_count = __pyx_v_old_count; - /* "sklearn/cluster/_k_means.pyx":197 + /* "sklearn/cluster/_k_means.pyx":196 * * # count the number of samples assigned to this center * for sample_idx in range(n_samples): # <<<<<<<<<<<<<< @@ -3259,7 +3264,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_sample_idx = __pyx_t_10; - /* "sklearn/cluster/_k_means.pyx":198 + /* "sklearn/cluster/_k_means.pyx":197 * # count the number of samples assigned to this center * for sample_idx in range(n_samples): * if nearest_center[sample_idx] == center_idx: # <<<<<<<<<<<<<< @@ -3270,7 +3275,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_INT *, __pyx_pybuffernd_nearest_center.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_nearest_center.diminfo[0].strides)) == __pyx_v_center_idx); if (__pyx_t_12) { - /* "sklearn/cluster/_k_means.pyx":199 + /* "sklearn/cluster/_k_means.pyx":198 * for sample_idx in range(n_samples): * if nearest_center[sample_idx] == center_idx: * new_count += 1 # <<<<<<<<<<<<<< @@ -3283,7 +3288,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_L7:; } - /* "sklearn/cluster/_k_means.pyx":201 + /* "sklearn/cluster/_k_means.pyx":200 * new_count += 1 * * if new_count == old_count: # <<<<<<<<<<<<<< @@ -3293,7 +3298,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_t_12 = (__pyx_v_new_count == __pyx_v_old_count); if (__pyx_t_12) { - /* "sklearn/cluster/_k_means.pyx":203 + /* "sklearn/cluster/_k_means.pyx":202 * if new_count == old_count: * # no new sample: leave this center as it stands * continue # <<<<<<<<<<<<<< @@ -3305,7 +3310,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY } __pyx_L8:; - /* "sklearn/cluster/_k_means.pyx":207 + /* "sklearn/cluster/_k_means.pyx":206 * # rescale the old center to reflect it previous accumulated * # weight w.r.t. the new data that will be incrementally contributed * if compute_squared_diff: # <<<<<<<<<<<<<< @@ -3314,22 +3319,22 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY */ if (__pyx_v_compute_squared_diff) { - /* "sklearn/cluster/_k_means.pyx":208 + /* "sklearn/cluster/_k_means.pyx":207 * # weight w.r.t. the new data that will be incrementally contributed * if compute_squared_diff: * old_center[:] = centers[center_idx] # <<<<<<<<<<<<<< * centers[center_idx] *= old_count * */ - __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_centers), __pyx_v_center_idx, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_centers), __pyx_v_center_idx, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_old_center), 0, PY_SSIZE_T_MAX, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_old_center), 0, PY_SSIZE_T_MAX, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L9; } __pyx_L9:; - /* "sklearn/cluster/_k_means.pyx":209 + /* "sklearn/cluster/_k_means.pyx":208 * if compute_squared_diff: * old_center[:] = centers[center_idx] * centers[center_idx] *= old_count # <<<<<<<<<<<<<< @@ -3337,18 +3342,18 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY * # iterate of over samples assigned to this cluster to move the center */ __pyx_t_9 = __pyx_v_center_idx; - __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_centers), __pyx_t_9, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_centers), __pyx_t_9, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyInt_FromLong(__pyx_v_old_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_old_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PyNumber_InPlaceMultiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyNumber_InPlaceMultiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_centers), __pyx_t_9, __pyx_t_13, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_centers), __pyx_t_9, __pyx_t_13, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "sklearn/cluster/_k_means.pyx":213 + /* "sklearn/cluster/_k_means.pyx":212 * # iterate of over samples assigned to this cluster to move the center * # location by inplace summation * for sample_idx in range(n_samples): # <<<<<<<<<<<<<< @@ -3359,7 +3364,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_sample_idx = __pyx_t_10; - /* "sklearn/cluster/_k_means.pyx":214 + /* "sklearn/cluster/_k_means.pyx":213 * # location by inplace summation * for sample_idx in range(n_samples): * if nearest_center[sample_idx] != center_idx: # <<<<<<<<<<<<<< @@ -3370,7 +3375,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_INT *, __pyx_pybuffernd_nearest_center.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_nearest_center.diminfo[0].strides)) != __pyx_v_center_idx); if (__pyx_t_12) { - /* "sklearn/cluster/_k_means.pyx":215 + /* "sklearn/cluster/_k_means.pyx":214 * for sample_idx in range(n_samples): * if nearest_center[sample_idx] != center_idx: * continue # <<<<<<<<<<<<<< @@ -3382,7 +3387,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY } __pyx_L12:; - /* "sklearn/cluster/_k_means.pyx":220 + /* "sklearn/cluster/_k_means.pyx":219 * # and update of the incremental squared difference update of the * # center position * for k in range(X_indptr[sample_idx], X_indptr[sample_idx + 1]): # <<<<<<<<<<<<<< @@ -3395,7 +3400,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY for (__pyx_t_18 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_18 < __pyx_t_16; __pyx_t_18+=1) { __pyx_v_k = __pyx_t_18; - /* "sklearn/cluster/_k_means.pyx":221 + /* "sklearn/cluster/_k_means.pyx":220 * # center position * for k in range(X_indptr[sample_idx], X_indptr[sample_idx + 1]): * centers[center_idx, X_indices[k]] += X_data[k] # <<<<<<<<<<<<<< @@ -3411,7 +3416,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_L10_continue:; } - /* "sklearn/cluster/_k_means.pyx":224 + /* "sklearn/cluster/_k_means.pyx":223 * * # inplace rescale center with updated count * if new_count > old_count: # <<<<<<<<<<<<<< @@ -3421,7 +3426,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_t_12 = (__pyx_v_new_count > __pyx_v_old_count); if (__pyx_t_12) { - /* "sklearn/cluster/_k_means.pyx":226 + /* "sklearn/cluster/_k_means.pyx":225 * if new_count > old_count: * # update the count statistics for this center * counts[center_idx] = new_count # <<<<<<<<<<<<<< @@ -3431,7 +3436,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_t_9 = __pyx_v_center_idx; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_INT *, __pyx_pybuffernd_counts.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_counts.diminfo[0].strides) = __pyx_v_new_count; - /* "sklearn/cluster/_k_means.pyx":229 + /* "sklearn/cluster/_k_means.pyx":228 * * # re-scale the updated center with the total new counts * centers[center_idx] /= new_count # <<<<<<<<<<<<<< @@ -3439,18 +3444,18 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY * # update the incremental computation of the squared total */ __pyx_t_10 = __pyx_v_center_idx; - __pyx_t_13 = __Pyx_GetItemInt(((PyObject *)__pyx_v_centers), __pyx_t_10, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_GetItemInt(((PyObject *)__pyx_v_centers), __pyx_t_10, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = PyInt_FromLong(__pyx_v_new_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_new_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_13, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyNumber_InPlaceDivide(__pyx_t_13, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_centers), __pyx_t_10, __pyx_t_5, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_centers), __pyx_t_10, __pyx_t_5, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/cluster/_k_means.pyx":233 + /* "sklearn/cluster/_k_means.pyx":232 * # update the incremental computation of the squared total * # centers position change * if compute_squared_diff: # <<<<<<<<<<<<<< @@ -3459,7 +3464,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY */ if (__pyx_v_compute_squared_diff) { - /* "sklearn/cluster/_k_means.pyx":234 + /* "sklearn/cluster/_k_means.pyx":233 * # centers position change * if compute_squared_diff: * for feature_idx in range(n_features): # <<<<<<<<<<<<<< @@ -3470,7 +3475,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_10; __pyx_t_18+=1) { __pyx_v_feature_idx = __pyx_t_18; - /* "sklearn/cluster/_k_means.pyx":235 + /* "sklearn/cluster/_k_means.pyx":234 * if compute_squared_diff: * for feature_idx in range(n_features): * squared_diff += (old_center[feature_idx] # <<<<<<<<<<<<<< @@ -3479,7 +3484,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY */ __pyx_t_23 = __pyx_v_feature_idx; - /* "sklearn/cluster/_k_means.pyx":236 + /* "sklearn/cluster/_k_means.pyx":235 * for feature_idx in range(n_features): * squared_diff += (old_center[feature_idx] * - centers[center_idx, feature_idx]) ** 2 # <<<<<<<<<<<<<< @@ -3499,7 +3504,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY __pyx_L3_continue:; } - /* "sklearn/cluster/_k_means.pyx":238 + /* "sklearn/cluster/_k_means.pyx":237 * - centers[center_idx, feature_idx]) ** 2 * * return squared_diff # <<<<<<<<<<<<<< @@ -3507,7 +3512,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_4_mini_batch_update_csr(CY * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_squared_diff); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_squared_diff); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; @@ -3587,7 +3592,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_7csr_row_norm_l2(PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "csr_row_norm_l2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "csr_row_norm_l2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3602,7 +3607,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_7csr_row_norm_l2(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("csr_row_norm_l2", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_row_norm_l2", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._k_means.csr_row_norm_l2", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3613,7 +3618,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_7csr_row_norm_l2(PyObject return __pyx_r; } -/* "sklearn/cluster/_k_means.pyx":244 +/* "sklearn/cluster/_k_means.pyx":243 * @cython.wraparound(False) * @cython.cdivision(True) * def csr_row_norm_l2(X, squared=True): # <<<<<<<<<<<<<< @@ -3665,7 +3670,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN int __pyx_clineno = 0; __Pyx_TraceDeclarations __Pyx_RefNannySetupContext("csr_row_norm_l2", 0); - __Pyx_TraceCall("csr_row_norm_l2", __pyx_f[0], 244); + __Pyx_TraceCall("csr_row_norm_l2", __pyx_f[0], 243); __pyx_pybuffer_norms.pybuffer.buf = NULL; __pyx_pybuffer_norms.refcount = 0; __pyx_pybuffernd_norms.data = NULL; @@ -3683,91 +3688,91 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN __pyx_pybuffernd_X_indptr.data = NULL; __pyx_pybuffernd_X_indptr.rcbuffer = &__pyx_pybuffer_X_indptr; - /* "sklearn/cluster/_k_means.pyx":251 + /* "sklearn/cluster/_k_means.pyx":250 * """ * cdef: * unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< * unsigned int n_features = X.shape[1] * np.ndarray[DOUBLE, ndim=1] norms = np.zeros((n_samples,), */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __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_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_n_samples = __pyx_t_3; - /* "sklearn/cluster/_k_means.pyx":252 + /* "sklearn/cluster/_k_means.pyx":251 * cdef: * unsigned int n_samples = X.shape[0] * unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< * np.ndarray[DOUBLE, ndim=1] norms = np.zeros((n_samples,), * dtype=np.float64) */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n_features = __pyx_t_3; - /* "sklearn/cluster/_k_means.pyx":253 + /* "sklearn/cluster/_k_means.pyx":252 * unsigned int n_samples = X.shape[0] * unsigned int n_features = X.shape[1] * np.ndarray[DOUBLE, ndim=1] norms = np.zeros((n_samples,), # <<<<<<<<<<<<<< * dtype=np.float64) * np.ndarray[DOUBLE, ndim=1] X_data = X.data */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __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); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __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 = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - /* "sklearn/cluster/_k_means.pyx":254 + /* "sklearn/cluster/_k_means.pyx":253 * unsigned int n_features = X.shape[1] * np.ndarray[DOUBLE, ndim=1] norms = np.zeros((n_samples,), * dtype=np.float64) # <<<<<<<<<<<<<< * np.ndarray[DOUBLE, ndim=1] X_data = X.data * np.ndarray[int, ndim=1] X_indices = X.indices */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); 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_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norms.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_norms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_norms.diminfo[0].strides = __pyx_pybuffernd_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norms.diminfo[0].shape = __pyx_pybuffernd_norms.rcbuffer->pybuffer.shape[0]; } } @@ -3775,22 +3780,22 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN __pyx_v_norms = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/cluster/_k_means.pyx":255 + /* "sklearn/cluster/_k_means.pyx":254 * np.ndarray[DOUBLE, ndim=1] norms = np.zeros((n_samples,), * dtype=np.float64) * np.ndarray[DOUBLE, ndim=1] X_data = X.data # <<<<<<<<<<<<<< * np.ndarray[int, ndim=1] X_indices = X.indices * np.ndarray[int, ndim=1] X_indptr = X.indptr */ - __pyx_t_6 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __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_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; } } @@ -3798,22 +3803,22 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN __pyx_v_X_data = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/cluster/_k_means.pyx":256 + /* "sklearn/cluster/_k_means.pyx":255 * dtype=np.float64) * np.ndarray[DOUBLE, ndim=1] X_data = X.data * np.ndarray[int, ndim=1] X_indices = X.indices # <<<<<<<<<<<<<< * np.ndarray[int, ndim=1] X_indptr = X.indptr * */ - __pyx_t_6 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); 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); - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; } } @@ -3821,22 +3826,22 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN __pyx_v_X_indices = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/cluster/_k_means.pyx":257 + /* "sklearn/cluster/_k_means.pyx":256 * np.ndarray[DOUBLE, ndim=1] X_data = X.data * np.ndarray[int, ndim=1] X_indices = X.indices * np.ndarray[int, ndim=1] X_indptr = X.indptr # <<<<<<<<<<<<<< * * unsigned int i */ - __pyx_t_6 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __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_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; } } @@ -3844,17 +3849,17 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN __pyx_v_X_indptr = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/cluster/_k_means.pyx":262 + /* "sklearn/cluster/_k_means.pyx":261 * unsigned int j * double sum_ * int with_sqrt = not squared # <<<<<<<<<<<<<< * * for i in range(n_samples): */ - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_squared); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_squared); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_with_sqrt = (!__pyx_t_11); - /* "sklearn/cluster/_k_means.pyx":264 + /* "sklearn/cluster/_k_means.pyx":263 * int with_sqrt = not squared * * for i in range(n_samples): # <<<<<<<<<<<<<< @@ -3865,7 +3870,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_3; __pyx_t_12+=1) { __pyx_v_i = __pyx_t_12; - /* "sklearn/cluster/_k_means.pyx":265 + /* "sklearn/cluster/_k_means.pyx":264 * * for i in range(n_samples): * sum_ = 0.0 # <<<<<<<<<<<<<< @@ -3874,7 +3879,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN */ __pyx_v_sum_ = 0.0; - /* "sklearn/cluster/_k_means.pyx":267 + /* "sklearn/cluster/_k_means.pyx":266 * sum_ = 0.0 * * for j in range(X_indptr[i], X_indptr[i + 1]): # <<<<<<<<<<<<<< @@ -3887,7 +3892,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN for (__pyx_t_16 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_16 < __pyx_t_14; __pyx_t_16+=1) { __pyx_v_j = __pyx_t_16; - /* "sklearn/cluster/_k_means.pyx":268 + /* "sklearn/cluster/_k_means.pyx":267 * * for j in range(X_indptr[i], X_indptr[i + 1]): * sum_ += X_data[j] * X_data[j] # <<<<<<<<<<<<<< @@ -3899,7 +3904,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN __pyx_v_sum_ = (__pyx_v_sum_ + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_X_data.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_X_data.diminfo[0].strides)))); } - /* "sklearn/cluster/_k_means.pyx":270 + /* "sklearn/cluster/_k_means.pyx":269 * sum_ += X_data[j] * X_data[j] * * if with_sqrt: # <<<<<<<<<<<<<< @@ -3908,7 +3913,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN */ if (__pyx_v_with_sqrt) { - /* "sklearn/cluster/_k_means.pyx":271 + /* "sklearn/cluster/_k_means.pyx":270 * * if with_sqrt: * sum_ = sqrt(sum_) # <<<<<<<<<<<<<< @@ -3920,7 +3925,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN } __pyx_L7:; - /* "sklearn/cluster/_k_means.pyx":273 + /* "sklearn/cluster/_k_means.pyx":272 * sum_ = sqrt(sum_) * * norms[i] = sum_ # <<<<<<<<<<<<<< @@ -3931,7 +3936,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_6csr_row_norm_l2(CYTHON_UN *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_7cluster_8_k_means_DOUBLE *, __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_norms.diminfo[0].strides) = __pyx_v_sum_; } - /* "sklearn/cluster/_k_means.pyx":274 + /* "sklearn/cluster/_k_means.pyx":273 * * norms[i] = sum_ * return norms # <<<<<<<<<<<<<< @@ -4011,21 +4016,21 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_9_centers_dense(PyObject * case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_centers_dense", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_centers_dense", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_clusters)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_centers_dense", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_centers_dense", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__distances)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_centers_dense", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_centers_dense", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_centers_dense") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_centers_dense") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -4037,20 +4042,20 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_9_centers_dense(PyObject * } __pyx_v_X = ((PyArrayObject *)values[0]); __pyx_v_labels = ((PyArrayObject *)values[1]); - __pyx_v_n_clusters = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_n_clusters == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_clusters = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_n_clusters == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_distances = ((PyArrayObject *)values[3]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_centers_dense", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_centers_dense", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._k_means._centers_dense", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(__pyx_self, __pyx_v_X, __pyx_v_labels, __pyx_v_n_clusters, __pyx_v_distances); goto __pyx_L0; __pyx_L1_error:; @@ -4060,7 +4065,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_9_centers_dense(PyObject * return __pyx_r; } -/* "sklearn/cluster/_k_means.pyx":280 +/* "sklearn/cluster/_k_means.pyx":279 * @cython.wraparound(False) * @cython.cdivision(True) * def _centers_dense(np.ndarray[DOUBLE, ndim=2] X, # <<<<<<<<<<<<<< @@ -4113,7 +4118,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU int __pyx_clineno = 0; __Pyx_TraceDeclarations __Pyx_RefNannySetupContext("_centers_dense", 0); - __Pyx_TraceCall("_centers_dense", __pyx_f[0], 280); + __Pyx_TraceCall("_centers_dense", __pyx_f[0], 279); __pyx_pybuffer_centers.pybuffer.buf = NULL; __pyx_pybuffer_centers.refcount = 0; __pyx_pybuffernd_centers.data = NULL; @@ -4132,21 +4137,21 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU __pyx_pybuffernd_distances.rcbuffer = &__pyx_pybuffer_distances; { __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_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __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_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __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_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; - /* "sklearn/cluster/_k_means.pyx":307 + /* "sklearn/cluster/_k_means.pyx":306 * ## TODO: add support for CSR input * cdef int n_samples, n_features * n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -4155,7 +4160,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/cluster/_k_means.pyx":308 + /* "sklearn/cluster/_k_means.pyx":307 * cdef int n_samples, n_features * n_samples = X.shape[0] * n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -4164,23 +4169,23 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU */ __pyx_v_n_features = (__pyx_v_X->dimensions[1]); - /* "sklearn/cluster/_k_means.pyx":310 + /* "sklearn/cluster/_k_means.pyx":309 * n_features = X.shape[1] * cdef int i, j, c * cdef np.ndarray[DOUBLE, ndim=2] centers = np.zeros((n_clusters, n_features)) # <<<<<<<<<<<<<< * n_samples_in_cluster = bincount(labels, minlength=n_clusters) * empty_clusters = np.where(n_samples_in_cluster == 0)[0] */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_n_clusters); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_n_clusters); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyInt_FromLong(__pyx_v_n_features); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_n_features); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __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); @@ -4188,22 +4193,22 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __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 = 309; __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)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_centers.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_centers = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_centers.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_centers.diminfo[0].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centers.diminfo[0].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_centers.diminfo[1].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_centers.diminfo[1].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[1]; } } @@ -4211,27 +4216,27 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU __pyx_v_centers = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/cluster/_k_means.pyx":311 + /* "sklearn/cluster/_k_means.pyx":310 * cdef int i, j, c * cdef np.ndarray[DOUBLE, ndim=2] centers = np.zeros((n_clusters, n_features)) * n_samples_in_cluster = bincount(labels, minlength=n_clusters) # <<<<<<<<<<<<<< * empty_clusters = np.where(n_samples_in_cluster == 0)[0] * # maybe also relocate small clusters? */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__bincount); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__bincount); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __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 = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_labels)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_labels)); __Pyx_GIVEREF(((PyObject *)__pyx_v_labels)); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_n_clusters); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_n_clusters); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__minlength), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__minlength), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -4239,57 +4244,57 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU __pyx_v_n_samples_in_cluster = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/cluster/_k_means.pyx":312 + /* "sklearn/cluster/_k_means.pyx":311 * cdef np.ndarray[DOUBLE, ndim=2] centers = np.zeros((n_clusters, n_features)) * n_samples_in_cluster = bincount(labels, minlength=n_clusters) * empty_clusters = np.where(n_samples_in_cluster == 0)[0] # <<<<<<<<<<<<<< * # maybe also relocate small clusters? * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__where); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__where); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_v_n_samples_in_cluster, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __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 = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_n_samples_in_cluster, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __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 = 311; __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_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_empty_clusters = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/cluster/_k_means.pyx":315 + /* "sklearn/cluster/_k_means.pyx":314 * # maybe also relocate small clusters? * * if len(empty_clusters): # <<<<<<<<<<<<<< * # find points to reassign empty clusters to * far_from_centers = distances.argsort()[::-1] */ - __pyx_t_6 = PyObject_Length(__pyx_v_empty_clusters); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_v_empty_clusters); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { - /* "sklearn/cluster/_k_means.pyx":317 + /* "sklearn/cluster/_k_means.pyx":316 * if len(empty_clusters): * # find points to reassign empty clusters to * far_from_centers = distances.argsort()[::-1] # <<<<<<<<<<<<<< * * for i, cluster_id in enumerate(empty_clusters): */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__argsort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__argsort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_3); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_3); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_far_from_centers = __pyx_t_3; @@ -4298,7 +4303,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU } __pyx_L3:; - /* "sklearn/cluster/_k_means.pyx":319 + /* "sklearn/cluster/_k_means.pyx":318 * far_from_centers = distances.argsort()[::-1] * * for i, cluster_id in enumerate(empty_clusters): # <<<<<<<<<<<<<< @@ -4310,7 +4315,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU __pyx_t_3 = __pyx_v_empty_clusters; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_empty_clusters); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_empty_clusters); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -4318,23 +4323,23 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -4346,44 +4351,44 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU __pyx_v_i = __pyx_t_7; __pyx_t_7 = (__pyx_t_7 + 1); - /* "sklearn/cluster/_k_means.pyx":321 + /* "sklearn/cluster/_k_means.pyx":320 * for i, cluster_id in enumerate(empty_clusters): * # XXX two relocated clusters could be close to each other * new_center = X[far_from_centers[i]] # <<<<<<<<<<<<<< * centers[cluster_id] = new_center * n_samples_in_cluster[cluster_id] = 1 */ - if (unlikely(!__pyx_v_far_from_centers)) { __Pyx_RaiseUnboundLocalError("far_from_centers"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_far_from_centers, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_far_from_centers)) { __Pyx_RaiseUnboundLocalError("far_from_centers"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_far_from_centers, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_X), __pyx_t_1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_X), __pyx_t_1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_new_center); __pyx_v_new_center = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/cluster/_k_means.pyx":322 + /* "sklearn/cluster/_k_means.pyx":321 * # XXX two relocated clusters could be close to each other * new_center = X[far_from_centers[i]] * centers[cluster_id] = new_center # <<<<<<<<<<<<<< * n_samples_in_cluster[cluster_id] = 1 * */ - if (PyObject_SetItem(((PyObject *)__pyx_v_centers), __pyx_v_cluster_id, __pyx_v_new_center) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_centers), __pyx_v_cluster_id, __pyx_v_new_center) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/cluster/_k_means.pyx":323 + /* "sklearn/cluster/_k_means.pyx":322 * new_center = X[far_from_centers[i]] * centers[cluster_id] = new_center * n_samples_in_cluster[cluster_id] = 1 # <<<<<<<<<<<<<< * * for i in range(n_samples): */ - if (PyObject_SetItem(__pyx_v_n_samples_in_cluster, __pyx_v_cluster_id, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_n_samples_in_cluster, __pyx_v_cluster_id, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/cluster/_k_means.pyx":325 + /* "sklearn/cluster/_k_means.pyx":324 * n_samples_in_cluster[cluster_id] = 1 * * for i in range(n_samples): # <<<<<<<<<<<<<< @@ -4394,7 +4399,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_7; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "sklearn/cluster/_k_means.pyx":326 + /* "sklearn/cluster/_k_means.pyx":325 * * for i in range(n_samples): * for j in range(n_features): # <<<<<<<<<<<<<< @@ -4405,7 +4410,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_j = __pyx_t_11; - /* "sklearn/cluster/_k_means.pyx":327 + /* "sklearn/cluster/_k_means.pyx":326 * for i in range(n_samples): * for j in range(n_features): * centers[labels[i], j] += X[i, j] # <<<<<<<<<<<<<< @@ -4421,19 +4426,19 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU } } - /* "sklearn/cluster/_k_means.pyx":329 + /* "sklearn/cluster/_k_means.pyx":328 * centers[labels[i], j] += X[i, j] * * centers /= n_samples_in_cluster[:, np.newaxis] # <<<<<<<<<<<<<< * * return centers */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__newaxis); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__newaxis); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __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 = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_k_slice_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_k_slice_4); @@ -4441,13 +4446,13 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(__pyx_v_n_samples_in_cluster, ((PyObject *)__pyx_t_3)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_n_samples_in_cluster, ((PyObject *)__pyx_t_3)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_centers), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_centers), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __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 = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4463,14 +4468,14 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_8_centers_dense(CYTHON_UNU } } __pyx_pybuffernd_centers.diminfo[0].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_centers.diminfo[0].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_centers.diminfo[1].strides = __pyx_pybuffernd_centers.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_centers.diminfo[1].shape = __pyx_pybuffernd_centers.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_centers)); __pyx_v_centers = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/cluster/_k_means.pyx":331 + /* "sklearn/cluster/_k_means.pyx":330 * centers /= n_samples_in_cluster[:, np.newaxis] * * return centers # <<<<<<<<<<<<<< @@ -4551,21 +4556,21 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_11_centers_sparse(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__labels)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_centers_sparse", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_centers_sparse", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_clusters)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_centers_sparse", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_centers_sparse", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__distances)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_centers_sparse", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_centers_sparse", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_centers_sparse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_centers_sparse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -4582,14 +4587,14 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_11_centers_sparse(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_centers_sparse", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_centers_sparse", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.cluster._k_means._centers_sparse", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_labels), __pyx_ptype_5numpy_ndarray, 1, "labels", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(__pyx_self, __pyx_v_X, __pyx_v_labels, __pyx_v_n_clusters, __pyx_v_distances); goto __pyx_L0; __pyx_L1_error:; @@ -4599,7 +4604,7 @@ static PyObject *__pyx_pw_7sklearn_7cluster_8_k_means_11_centers_sparse(PyObject return __pyx_r; } -/* "sklearn/cluster/_k_means.pyx":334 +/* "sklearn/cluster/_k_means.pyx":333 * * * def _centers_sparse(X, np.ndarray[INT, ndim=1] labels, n_clusters, # <<<<<<<<<<<<<< @@ -4637,7 +4642,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U int __pyx_clineno = 0; __Pyx_TraceDeclarations __Pyx_RefNannySetupContext("_centers_sparse", 0); - __Pyx_TraceCall("_centers_sparse", __pyx_f[0], 334); + __Pyx_TraceCall("_centers_sparse", __pyx_f[0], 333); __pyx_pybuffer_labels.pybuffer.buf = NULL; __pyx_pybuffer_labels.refcount = 0; __pyx_pybuffernd_labels.data = NULL; @@ -4648,43 +4653,43 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __pyx_pybuffernd_distances.rcbuffer = &__pyx_pybuffer_distances; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_labels.rcbuffer->pybuffer, (PyObject*)__pyx_v_labels, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_labels.diminfo[0].strides = __pyx_pybuffernd_labels.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_labels.diminfo[0].shape = __pyx_pybuffernd_labels.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_7cluster_8_k_means_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; - /* "sklearn/cluster/_k_means.pyx":359 + /* "sklearn/cluster/_k_means.pyx":358 * """ * ## TODO: add support for CSR input * n_features = X.shape[1] # <<<<<<<<<<<<<< * * centers = np.zeros((n_clusters, n_features), dtype=X.dtype) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n_features = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/cluster/_k_means.pyx":361 + /* "sklearn/cluster/_k_means.pyx":360 * n_features = X.shape[1] * * centers = np.zeros((n_clusters, n_features), dtype=X.dtype) # <<<<<<<<<<<<<< * n_samples_in_cluster = bincount(labels, minlength=n_clusters) * empty_clusters = np.where(n_samples_in_cluster == 0)[0] */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __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(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n_clusters); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n_clusters); @@ -4692,18 +4697,18 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __Pyx_INCREF(__pyx_v_n_features); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_n_features); __Pyx_GIVEREF(__pyx_v_n_features); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __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 = 360; __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)); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __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_3)); __pyx_t_3 = 0; @@ -4711,24 +4716,24 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __pyx_v_centers = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/cluster/_k_means.pyx":362 + /* "sklearn/cluster/_k_means.pyx":361 * * centers = np.zeros((n_clusters, n_features), dtype=X.dtype) * n_samples_in_cluster = bincount(labels, minlength=n_clusters) # <<<<<<<<<<<<<< * empty_clusters = np.where(n_samples_in_cluster == 0)[0] * # maybe also relocate small clusters? */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__bincount); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__bincount); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __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 = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_labels)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_labels)); __Pyx_GIVEREF(((PyObject *)__pyx_v_labels)); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__minlength), __pyx_v_n_clusters) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__minlength), __pyx_v_n_clusters) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -4736,57 +4741,57 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __pyx_v_n_samples_in_cluster = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/cluster/_k_means.pyx":363 + /* "sklearn/cluster/_k_means.pyx":362 * centers = np.zeros((n_clusters, n_features), dtype=X.dtype) * n_samples_in_cluster = bincount(labels, minlength=n_clusters) * empty_clusters = np.where(n_samples_in_cluster == 0)[0] # <<<<<<<<<<<<<< * # maybe also relocate small clusters? * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__where); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__where); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __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_RichCompare(__pyx_v_n_samples_in_cluster, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __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 = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_n_samples_in_cluster, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __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 = 362; __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_empty_clusters = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/cluster/_k_means.pyx":366 + /* "sklearn/cluster/_k_means.pyx":365 * # maybe also relocate small clusters? * * if len(empty_clusters): # <<<<<<<<<<<<<< * # find points to reassign empty clusters to * far_from_centers = distances.argsort()[::-1] */ - __pyx_t_5 = PyObject_Length(__pyx_v_empty_clusters); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Length(__pyx_v_empty_clusters); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { - /* "sklearn/cluster/_k_means.pyx":368 + /* "sklearn/cluster/_k_means.pyx":367 * if len(empty_clusters): * # find points to reassign empty clusters to * far_from_centers = distances.argsort()[::-1] # <<<<<<<<<<<<<< * * for i, cluster_id in enumerate(empty_clusters): */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __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 = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_5); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_5); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_far_from_centers = __pyx_t_2; @@ -4795,7 +4800,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U } __pyx_L3:; - /* "sklearn/cluster/_k_means.pyx":370 + /* "sklearn/cluster/_k_means.pyx":369 * far_from_centers = distances.argsort()[::-1] * * for i, cluster_id in enumerate(empty_clusters): # <<<<<<<<<<<<<< @@ -4808,7 +4813,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __pyx_t_1 = __pyx_v_empty_clusters; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_empty_clusters); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_empty_clusters); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -4816,23 +4821,23 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -4844,80 +4849,80 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __Pyx_INCREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_2; - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/cluster/_k_means.pyx":372 + /* "sklearn/cluster/_k_means.pyx":371 * for i, cluster_id in enumerate(empty_clusters): * # XXX two relocated clusters could be close to each other * new_center = X[far_from_centers[i]] # <<<<<<<<<<<<<< * new_center = new_center.todense().ravel() * centers[cluster_id] = new_center */ - if (unlikely(!__pyx_v_far_from_centers)) { __Pyx_RaiseUnboundLocalError("far_from_centers"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_3 = PyObject_GetItem(__pyx_v_far_from_centers, __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_far_from_centers)) { __Pyx_RaiseUnboundLocalError("far_from_centers"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_3 = PyObject_GetItem(__pyx_v_far_from_centers, __pyx_v_i); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetItem(__pyx_v_X, __pyx_t_3); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_X, __pyx_t_3); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_center); __pyx_v_new_center = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/cluster/_k_means.pyx":373 + /* "sklearn/cluster/_k_means.pyx":372 * # XXX two relocated clusters could be close to each other * new_center = X[far_from_centers[i]] * new_center = new_center.todense().ravel() # <<<<<<<<<<<<<< * centers[cluster_id] = new_center * n_samples_in_cluster[cluster_id] = 1 */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_new_center, __pyx_n_s__todense); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_new_center, __pyx_n_s__todense); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ravel); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_new_center); __pyx_v_new_center = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/cluster/_k_means.pyx":374 + /* "sklearn/cluster/_k_means.pyx":373 * new_center = X[far_from_centers[i]] * new_center = new_center.todense().ravel() * centers[cluster_id] = new_center # <<<<<<<<<<<<<< * n_samples_in_cluster[cluster_id] = 1 * */ - if (PyObject_SetItem(__pyx_v_centers, __pyx_v_cluster_id, __pyx_v_new_center) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_centers, __pyx_v_cluster_id, __pyx_v_new_center) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/cluster/_k_means.pyx":375 + /* "sklearn/cluster/_k_means.pyx":374 * new_center = new_center.todense().ravel() * centers[cluster_id] = new_center * n_samples_in_cluster[cluster_id] = 1 # <<<<<<<<<<<<<< * * for label, sample in zip(labels, X): */ - if (PyObject_SetItem(__pyx_v_n_samples_in_cluster, __pyx_v_cluster_id, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_n_samples_in_cluster, __pyx_v_cluster_id, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __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; - /* "sklearn/cluster/_k_means.pyx":377 + /* "sklearn/cluster/_k_means.pyx":376 * n_samples_in_cluster[cluster_id] = 1 * * for label, sample in zip(labels, X): # <<<<<<<<<<<<<< * centers[label, :] += sample.toarray().ravel() * */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_labels)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_labels)); @@ -4925,14 +4930,14 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __Pyx_INCREF(__pyx_v_X); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_X); __Pyx_GIVEREF(__pyx_v_X); - __pyx_t_1 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -4941,23 +4946,23 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -4973,7 +4978,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -4986,14 +4991,14 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; @@ -5001,7 +5006,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L9_unpacking_done; @@ -5009,7 +5014,7 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L9_unpacking_done:; } __Pyx_XDECREF(__pyx_v_label); @@ -5019,14 +5024,14 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __pyx_v_sample = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/cluster/_k_means.pyx":378 + /* "sklearn/cluster/_k_means.pyx":377 * * for label, sample in zip(labels, X): * centers[label, :] += sample.toarray().ravel() # <<<<<<<<<<<<<< * * centers /= n_samples_in_cluster[:, np.newaxis] */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_label); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_label); @@ -5034,42 +5039,42 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U __Pyx_INCREF(__pyx_k_slice_6); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_k_slice_6); __Pyx_GIVEREF(__pyx_k_slice_6); - __pyx_t_4 = PyObject_GetItem(__pyx_v_centers, ((PyObject *)__pyx_t_1)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_centers, ((PyObject *)__pyx_t_1)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_sample, __pyx_n_s__toarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_sample, __pyx_n_s__toarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__ravel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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_7); __pyx_t_7 = 0; - if (PyObject_SetItem(__pyx_v_centers, ((PyObject *)__pyx_t_1), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_centers, ((PyObject *)__pyx_t_1), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/cluster/_k_means.pyx":380 + /* "sklearn/cluster/_k_means.pyx":379 * centers[label, :] += sample.toarray().ravel() * * centers /= n_samples_in_cluster[:, np.newaxis] # <<<<<<<<<<<<<< * * return centers */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__newaxis); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__newaxis); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __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(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_k_slice_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_k_slice_7); @@ -5077,17 +5082,17 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(__pyx_v_n_samples_in_cluster, ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_n_samples_in_cluster, ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __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_PyNumber_InPlaceDivide(__pyx_v_centers, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_centers, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_centers); __pyx_v_centers = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/cluster/_k_means.pyx":382 + /* "sklearn/cluster/_k_means.pyx":381 * centers /= n_samples_in_cluster[:, np.newaxis] * * return centers # <<<<<<<<<<<<<< @@ -5134,8 +5139,8 @@ static PyObject *__pyx_pf_7sklearn_7cluster_8_k_means_10_centers_sparse(CYTHON_U } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -5481,8 +5486,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset @@ -5557,7 +5564,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: @@ -5953,8 +5961,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -7236,9 +7244,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_zip = __Pyx_GetName(__pyx_b, __pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_zip = __Pyx_GetName(__pyx_b, __pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -7250,58 +7258,58 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/cluster/_k_means.pyx":317 + /* "sklearn/cluster/_k_means.pyx":316 * if len(empty_clusters): * # find points to reassign empty clusters to * far_from_centers = distances.argsort()[::-1] # <<<<<<<<<<<<<< * * for i, cluster_id in enumerate(empty_clusters): */ - __pyx_k_slice_3 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_3 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_3); __Pyx_GIVEREF(__pyx_k_slice_3); - /* "sklearn/cluster/_k_means.pyx":329 + /* "sklearn/cluster/_k_means.pyx":328 * centers[labels[i], j] += X[i, j] * * centers /= n_samples_in_cluster[:, np.newaxis] # <<<<<<<<<<<<<< * * return centers */ - __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); - /* "sklearn/cluster/_k_means.pyx":368 + /* "sklearn/cluster/_k_means.pyx":367 * if len(empty_clusters): * # find points to reassign empty clusters to * far_from_centers = distances.argsort()[::-1] # <<<<<<<<<<<<<< * * for i, cluster_id in enumerate(empty_clusters): */ - __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); - /* "sklearn/cluster/_k_means.pyx":378 + /* "sklearn/cluster/_k_means.pyx":377 * * for label, sample in zip(labels, X): * centers[label, :] += sample.toarray().ravel() # <<<<<<<<<<<<<< * * centers /= n_samples_in_cluster[:, np.newaxis] */ - __pyx_k_slice_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_6); __Pyx_GIVEREF(__pyx_k_slice_6); - /* "sklearn/cluster/_k_means.pyx":380 + /* "sklearn/cluster/_k_means.pyx":379 * centers[label, :] += sample.toarray().ravel() * * centers /= n_samples_in_cluster[:, np.newaxis] # <<<<<<<<<<<<<< * * return centers */ - __pyx_k_slice_7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_7); __Pyx_GIVEREF(__pyx_k_slice_7); @@ -7389,14 +7397,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_18)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); - /* "sklearn/cluster/_k_means.pyx":141 + /* "sklearn/cluster/_k_means.pyx":140 * @cython.wraparound(False) * @cython.cdivision(True) * def _mini_batch_update_csr(X, np.ndarray[DOUBLE, ndim=1] x_squared_norms, # <<<<<<<<<<<<<< * np.ndarray[DOUBLE, ndim=2] centers, * np.ndarray[INT, ndim=1] counts, */ - __pyx_k_tuple_24 = PyTuple_New(21); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_24 = PyTuple_New(21); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_n_s__X)); @@ -7462,16 +7470,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_24, 20, ((PyObject *)__pyx_n_s__squared_diff)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__squared_diff)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - __pyx_k_codeobj_25 = (PyObject*)__Pyx_PyCode_New(7, 0, 21, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_27, __pyx_n_s_26, 141, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_25 = (PyObject*)__Pyx_PyCode_New(7, 0, 21, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_27, __pyx_n_s_26, 140, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/cluster/_k_means.pyx":244 + /* "sklearn/cluster/_k_means.pyx":243 * @cython.wraparound(False) * @cython.cdivision(True) * def csr_row_norm_l2(X, squared=True): # <<<<<<<<<<<<<< * """Get L2 norm of each row in CSR matrix X. * */ - __pyx_k_tuple_29 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_29 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_29); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_n_s__X)); @@ -7510,16 +7518,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_29, 11, ((PyObject *)__pyx_n_s__with_sqrt)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__with_sqrt)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); - __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_27, __pyx_n_s__csr_row_norm_l2, 244, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_27, __pyx_n_s__csr_row_norm_l2, 243, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/cluster/_k_means.pyx":280 + /* "sklearn/cluster/_k_means.pyx":279 * @cython.wraparound(False) * @cython.cdivision(True) * def _centers_dense(np.ndarray[DOUBLE, ndim=2] X, # <<<<<<<<<<<<<< * np.ndarray[INT, ndim=1] labels, int n_clusters, * np.ndarray[DOUBLE, ndim=1] distances): */ - __pyx_k_tuple_32 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_32 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_32); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_n_s__X)); @@ -7567,16 +7575,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_32, 14, ((PyObject *)__pyx_n_s__new_center)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__new_center)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); - __pyx_k_codeobj_33 = (PyObject*)__Pyx_PyCode_New(4, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_27, __pyx_n_s___centers_dense, 280, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_33 = (PyObject*)__Pyx_PyCode_New(4, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_27, __pyx_n_s___centers_dense, 279, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/cluster/_k_means.pyx":334 + /* "sklearn/cluster/_k_means.pyx":333 * * * def _centers_sparse(X, np.ndarray[INT, ndim=1] labels, n_clusters, # <<<<<<<<<<<<<< * np.ndarray[DOUBLE, ndim=1] distances): * """M step of the K-means EM algorithm */ - __pyx_k_tuple_34 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_34 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_34); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_n_s__X)); @@ -7621,7 +7629,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_34, 13, ((PyObject *)__pyx_n_s__sample)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sample)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); - __pyx_k_codeobj_35 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_27, __pyx_n_s___centers_sparse, 334, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_35 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_27, __pyx_n_s___centers_sparse, 333, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -7687,6 +7695,14 @@ PyMODINIT_FUNC PyInit__k_means(void) __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__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.cluster._k_means")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.cluster._k_means", __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); @@ -7722,137 +7738,146 @@ PyMODINIT_FUNC PyInit__k_means(void) /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "sklearn/cluster/_k_means.pyx":10 - * # License: BSD Style. + /* "sklearn/cluster/_k_means.pyx":11 * + * from libc.math cimport sqrt * import numpy as np # <<<<<<<<<<<<<< * import scipy.sparse as sp - * from ..utils.extmath import norm + * cimport numpy as np */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __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/cluster/_k_means.pyx":11 - * + /* "sklearn/cluster/_k_means.pyx":12 + * from libc.math cimport sqrt * import numpy as np * import scipy.sparse as sp # <<<<<<<<<<<<<< - * from ..utils.extmath import norm - * from ..utils.fixes import bincount + * cimport numpy as np + * cimport cython */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s_21)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_21)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s_21)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_20), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_20), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sp, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sp, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/cluster/_k_means.pyx":12 - * import numpy as np - * import scipy.sparse as sp + /* "sklearn/cluster/_k_means.pyx":16 + * cimport cython + * * from ..utils.extmath import norm # <<<<<<<<<<<<<< * from ..utils.fixes import bincount - * cimport numpy as np + * */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__norm)); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__norm)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__norm)); - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_22), ((PyObject *)__pyx_t_2), 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_22), ((PyObject *)__pyx_t_2), 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __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 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (__pyx_t_2 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__norm); - if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__norm, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__norm, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __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; - /* "sklearn/cluster/_k_means.pyx":13 - * import scipy.sparse as sp + /* "sklearn/cluster/_k_means.pyx":17 + * * from ..utils.extmath import norm * from ..utils.fixes import bincount # <<<<<<<<<<<<<< - * cimport numpy as np - * cimport cython + * + * ctypedef np.float64_t DOUBLE */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__bincount)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__bincount)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bincount)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_23), ((PyObject *)__pyx_t_1), 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_23), ((PyObject *)__pyx_t_1), 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __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 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bincount); if (__pyx_t_1 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__bincount); - if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bincount, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bincount, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __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; - /* "sklearn/cluster/_k_means.pyx":141 + /* "sklearn/cluster/_k_means.pyx":25 + * double ddot "cblas_ddot"(int N, double *X, int incX, double *Y, int incY) + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/cluster/_k_means.pyx":140 * @cython.wraparound(False) * @cython.cdivision(True) * def _mini_batch_update_csr(X, np.ndarray[DOUBLE, ndim=1] x_squared_norms, # <<<<<<<<<<<<<< * np.ndarray[DOUBLE, ndim=2] centers, * np.ndarray[INT, ndim=1] counts, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_8_k_means_5_mini_batch_update_csr, NULL, __pyx_n_s_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_8_k_means_5_mini_batch_update_csr, NULL, __pyx_n_s_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_26, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_26, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/cluster/_k_means.pyx":244 + /* "sklearn/cluster/_k_means.pyx":243 * @cython.wraparound(False) * @cython.cdivision(True) * def csr_row_norm_l2(X, squared=True): # <<<<<<<<<<<<<< * """Get L2 norm of each row in CSR matrix X. * */ - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_k_2 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_8_k_means_7csr_row_norm_l2, NULL, __pyx_n_s_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_8_k_means_7csr_row_norm_l2, NULL, __pyx_n_s_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__csr_row_norm_l2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__csr_row_norm_l2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/cluster/_k_means.pyx":280 + /* "sklearn/cluster/_k_means.pyx":279 * @cython.wraparound(False) * @cython.cdivision(True) * def _centers_dense(np.ndarray[DOUBLE, ndim=2] X, # <<<<<<<<<<<<<< * np.ndarray[INT, ndim=1] labels, int n_clusters, * np.ndarray[DOUBLE, ndim=1] distances): */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_8_k_means_9_centers_dense, NULL, __pyx_n_s_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_8_k_means_9_centers_dense, NULL, __pyx_n_s_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___centers_dense, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___centers_dense, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/cluster/_k_means.pyx":334 + /* "sklearn/cluster/_k_means.pyx":333 * * * def _centers_sparse(X, np.ndarray[INT, ndim=1] labels, n_clusters, # <<<<<<<<<<<<<< * np.ndarray[DOUBLE, ndim=1] distances): * """M step of the K-means EM algorithm */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_8_k_means_11_centers_sparse, NULL, __pyx_n_s_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_7cluster_8_k_means_11_centers_sparse, NULL, __pyx_n_s_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___centers_sparse, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___centers_sparse, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/cluster/_k_means.pyx":1 diff --git a/sklearn/cluster/_k_means.pyx b/sklearn/cluster/_k_means.pyx index 495bcf1f94509..e415059665ef1 100644 --- a/sklearn/cluster/_k_means.pyx +++ b/sklearn/cluster/_k_means.pyx @@ -7,24 +7,23 @@ # # License: BSD Style. +from libc.math cimport sqrt import numpy as np import scipy.sparse as sp -from ..utils.extmath import norm -from ..utils.fixes import bincount cimport numpy as np cimport cython +from ..utils.extmath import norm +from ..utils.fixes import bincount + ctypedef np.float64_t DOUBLE ctypedef np.int32_t INT - -cdef extern from "math.h": - double sqrt(double f) - - cdef extern from "cblas.h": double ddot "cblas_ddot"(int N, double *X, int incX, double *Y, int incY) +np.import_array() + @cython.boundscheck(False) @cython.wraparound(False) diff --git a/sklearn/datasets/_svmlight_format.c b/sklearn/datasets/_svmlight_format.c index 2702c85b1a855..b7b92f856be76 100644 --- a/sklearn/datasets/_svmlight_format.c +++ b/sklearn/datasets/_svmlight_format.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Fri Sep 28 11:13:00 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:28:40 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #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 PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #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) #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) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 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_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])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -267,7 +286,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -291,8 +310,12 @@ 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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -317,7 +340,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -327,7 +349,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -335,18 +356,19 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "_svmlight_format.pyx", "numpy.pxd", + "type.pxd", }; -/* "numpy.pxd":719 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -355,7 +377,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -364,7 +386,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -373,7 +395,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -382,7 +404,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -391,7 +413,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -400,7 +422,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -409,7 +431,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -418,7 +440,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -427,7 +449,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -436,7 +458,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.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 # <<<<<<<<<<<<<< @@ -445,7 +467,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -454,7 +476,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -463,7 +485,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -472,7 +494,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -481,7 +503,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -490,7 +512,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -499,7 +521,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -508,7 +530,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -517,7 +539,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -526,7 +548,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -534,7 +556,6 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -555,9 +576,10 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -566,7 +588,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -575,7 +597,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -584,7 +606,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -592,11 +614,9 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -609,8 +629,21 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -621,7 +654,7 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -632,17 +665,19 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; @@ -651,85 +686,119 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j Py_DECREF(j); return r; } - - #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - - #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { /* inlined PySequence_GetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } + return m->sq_item(o, i); + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; } - return r; + return PyList_Append(list, x); } +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ - +#if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_AsDouble(obj) \ - ((likely(PyFloat_CheckExact(obj))) ? \ - PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) +(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \ + likely(PyInt_CheckExact(obj)) ? \ + PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj)) +#else +#define __Pyx_PyObject_AsDouble(obj) \ +((likely(PyFloat_CheckExact(obj))) ? \ + PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj)) +#endif static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; + if (unlikely(PyList_Append(L, x) < 0)) return NULL; Py_INCREF(Py_None); return Py_None; /* this is just to have an accurate signature */ - } - else { + } else { PyObject *r, *m; m = __Pyx_GetAttrString(L, "append"); if (!m) return NULL; @@ -739,12 +808,53 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { } } +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ +static PyObject* __Pyx_PyObject_PopIndex(PyObject* L, Py_ssize_t ix) { + PyObject *r, *m, *t, *py_ix; +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000 + if (likely(PyList_CheckExact(L))) { + Py_ssize_t size = PyList_GET_SIZE(L); + if (likely(size > (((PyListObject*)L)->allocated >> 1))) { + if (ix < 0) { + ix += size; + } + if (likely(0 <= ix && ix < size)) { + PyObject* v = PyList_GET_ITEM(L, ix); + Py_SIZE(L) -= 1; + size -= 1; + memmove(&PyList_GET_ITEM(L, ix), &PyList_GET_ITEM(L, ix+1), (size-ix)*sizeof(PyObject*)); + return v; + } + } + } +#endif + py_ix = t = NULL; + m = __Pyx_GetAttrString(L, "pop"); + if (!m) goto bad; + py_ix = PyInt_FromSsize_t(ix); + if (!py_ix) goto bad; + t = PyTuple_New(1); + if (!t) goto bad; + PyTuple_SET_ITEM(t, 0, py_ix); + py_ix = NULL; + r = PyObject_CallObject(m, t); + Py_DECREF(m); + Py_DECREF(t); + return r; +bad: + Py_XDECREF(m); + Py_XDECREF(t); + Py_XDECREF(py_ix); + return NULL; +} + static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ @@ -752,12 +862,12 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); + static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *); static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32); @@ -774,7 +884,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -895,15 +1004,38 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject * static int __Pyx_check_binary_version(void); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + /* Module declarations from 'libc.string' */ /* Module declarations from 'cpython.buffer' */ @@ -914,6 +1046,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -924,14 +1061,7 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from 'sklearn.datasets._svmlight_format' */ static PyObject *__pyx_v_7sklearn_8datasets_16_svmlight_format_COMMA = 0; @@ -944,20 +1074,23 @@ static PyObject *__pyx_builtin_xrange; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_3[] = "Invalid index %d in SVMlight/LibSVM data file."; -static char __pyx_k_4[] = "Feature ndices in SVMlight/LibSVM data file should be sorted and unique."; -static char __pyx_k_6[] = "Malformed svmlight file: there should be one query id (qid) for\n each sample"; -static char __pyx_k_8[] = "ndarray is not C contiguous"; -static char __pyx_k_10[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_12[] = "Non-native byte order not supported"; -static char __pyx_k_14[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_15[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_18[] = "Format string allocated too short."; -static char __pyx_k_20[] = "scipy.sparse"; -static char __pyx_k_21[] = "*"; -static char __pyx_k_22[] = "utils.arraybuilder"; -static char __pyx_k_24[] = ","; -static char __pyx_k_25[] = ":"; +static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_dtype, int __pyx_v_multilabel, int __pyx_v_zero_based, int __pyx_v_query_id); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static char __pyx_k_2[] = "Invalid index %d in SVMlight/LibSVM data file."; +static char __pyx_k_3[] = "Feature ndices in SVMlight/LibSVM data file should be sorted and unique."; +static char __pyx_k_5[] = "ndarray is not C contiguous"; +static char __pyx_k_7[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_9[] = "Non-native byte order not supported"; +static char __pyx_k_11[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_12[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_15[] = "Format string allocated too short."; +static char __pyx_k_17[] = "scipy.sparse"; +static char __pyx_k_18[] = "*"; +static char __pyx_k_19[] = "utils.arraybuilder"; +static char __pyx_k_21[] = ","; +static char __pyx_k_22[] = ":"; +static char __pyx_k_25[] = "/scratch/apps/src/scikit-learn/sklearn/datasets/_svmlight_format.pyx"; static char __pyx_k_26[] = "sklearn.datasets._svmlight_format"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; @@ -965,6 +1098,7 @@ 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___[] = "_"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; @@ -973,57 +1107,71 @@ 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__sp[] = "sp"; static char __pyx_k__get[] = "get"; +static char __pyx_k__idx[] = "idx"; static char __pyx_k__int[] = "int"; -static char __pyx_k__pop[] = "pop"; static char __pyx_k__qid[] = "qid"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__line[] = "line"; static char __pyx_k__sort[] = "sort"; static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__idx_s[] = "idx_s"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; static char __pyx_k__split[] = "split"; +static char __pyx_k__value[] = "value"; static char __pyx_k__double[] = "double"; static char __pyx_k__indptr[] = "indptr"; +static char __pyx_k__labels[] = "labels"; +static char __pyx_k__target[] = "target"; static char __pyx_k__xrange[] = "xrange"; static char __pyx_k__indices[] = "indices"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__features[] = "features"; +static char __pyx_k__hash_ptr[] = "hash_ptr"; +static char __pyx_k__prev_idx[] = "prev_idx"; static char __pyx_k__query_id[] = "query_id"; static char __pyx_k___temp_csr[] = "_temp_csr"; +static char __pyx_k__line_cstr[] = "line_cstr"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__csr_matrix[] = "csr_matrix"; +static char __pyx_k__line_parts[] = "line_parts"; static char __pyx_k__multilabel[] = "multilabel"; +static char __pyx_k__n_features[] = "n_features"; static char __pyx_k__startswith[] = "startswith"; static char __pyx_k__zero_based[] = "zero_based"; static char __pyx_k__ArrayBuilder[] = "ArrayBuilder"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__query_values[] = "query_values"; static char __pyx_k___INDPTR_DTYPE[] = "_INDPTR_DTYPE"; static char __pyx_k___INDICES_DTYPE[] = "_INDICES_DTYPE"; static char __pyx_k___load_svmlight_file[] = "_load_svmlight_file"; -static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_12; -static PyObject *__pyx_kp_u_14; static PyObject *__pyx_kp_u_15; -static PyObject *__pyx_kp_u_18; -static PyObject *__pyx_n_s_20; -static PyObject *__pyx_n_s_21; -static PyObject *__pyx_n_s_22; -static PyObject *__pyx_kp_b_24; -static PyObject *__pyx_kp_b_25; +static PyObject *__pyx_n_s_17; +static PyObject *__pyx_n_s_18; +static PyObject *__pyx_n_s_19; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_b_21; +static PyObject *__pyx_kp_b_22; +static PyObject *__pyx_kp_s_25; static PyObject *__pyx_n_s_26; static PyObject *__pyx_kp_s_3; -static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_kp_s_6; -static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_5; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__ArrayBuilder; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s___; static PyObject *__pyx_n_s___INDICES_DTYPE; static PyObject *__pyx_n_s___INDPTR_DTYPE; static PyObject *__pyx_n_s____main__; @@ -1031,108 +1179,75 @@ static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___load_svmlight_file; static PyObject *__pyx_n_s___temp_csr; static PyObject *__pyx_n_s__csr_matrix; +static PyObject *__pyx_n_s__data; static PyObject *__pyx_n_s__double; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__f; +static PyObject *__pyx_n_s__features; static PyObject *__pyx_n_s__get; +static PyObject *__pyx_n_s__hash_ptr; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__idx; +static PyObject *__pyx_n_s__idx_s; static PyObject *__pyx_n_s__indices; static PyObject *__pyx_n_s__indptr; static PyObject *__pyx_n_s__int; +static PyObject *__pyx_n_s__labels; +static PyObject *__pyx_n_s__line; +static PyObject *__pyx_n_s__line_cstr; +static PyObject *__pyx_n_s__line_parts; static PyObject *__pyx_n_s__multilabel; +static PyObject *__pyx_n_s__n_features; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__pop; +static PyObject *__pyx_n_s__prev_idx; static PyObject *__pyx_n_s__qid; static PyObject *__pyx_n_s__query_id; +static PyObject *__pyx_n_s__query_values; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__shape; static PyObject *__pyx_n_s__sort; static PyObject *__pyx_n_s__sp; static PyObject *__pyx_n_s__split; static PyObject *__pyx_n_s__startswith; +static PyObject *__pyx_n_s__target; +static PyObject *__pyx_n_s__value; static PyObject *__pyx_n_s__xrange; +static PyObject *__pyx_n_s__y; static PyObject *__pyx_n_s__zero_based; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_1; -static PyObject *__pyx_k_tuple_2; -static PyObject *__pyx_k_tuple_5; -static PyObject *__pyx_k_tuple_7; -static PyObject *__pyx_k_tuple_9; -static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_8; +static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_16; -static PyObject *__pyx_k_tuple_17; -static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_20; static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_codeobj_24; -/* "sklearn/datasets/_svmlight_format.pyx":28 - * - * - * def _load_svmlight_file(f, dtype, bint multilabel, bint zero_based, bint query_id): # <<<<<<<<<<<<<< - * cdef bytes line - * cdef char *hash_ptr, *line_cstr - */ - -static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7sklearn_8datasets_16_svmlight_format__load_svmlight_file = {__Pyx_NAMESTR("_load_svmlight_file"), (PyCFunction)__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_8datasets_16_svmlight_format_1_load_svmlight_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7sklearn_8datasets_16_svmlight_format_1_load_svmlight_file = {__Pyx_NAMESTR("_load_svmlight_file"), (PyCFunction)__pyx_pw_7sklearn_8datasets_16_svmlight_format_1_load_svmlight_file, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_7sklearn_8datasets_16_svmlight_format_1_load_svmlight_file(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_f = 0; PyObject *__pyx_v_dtype = 0; int __pyx_v_multilabel; int __pyx_v_zero_based; int __pyx_v_query_id; - PyObject *__pyx_v_line = 0; - char *__pyx_v_hash_ptr; - char *__pyx_v_line_cstr; - __pyx_t_5numpy_int32_t __pyx_v_idx; - __pyx_t_5numpy_int32_t __pyx_v_prev_idx; - Py_ssize_t __pyx_v_i; - PyObject *__pyx_v_data = NULL; - PyObject *__pyx_v_indptr = NULL; - PyObject *__pyx_v_indices = NULL; - PyObject *__pyx_v_query_values = NULL; - PyObject *__pyx_v_labels = NULL; - PyObject *__pyx_v_line_parts = NULL; - PyObject *__pyx_v_target = NULL; - PyObject *__pyx_v_features = NULL; - PyObject *__pyx_v_n_features = NULL; - PyObject *__pyx_v__ = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_idx_s = NULL; - PyObject *__pyx_v_y = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - char *__pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *(*__pyx_t_11)(PyObject *); - double __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - PyObject *(*__pyx_t_15)(PyObject *); - long __pyx_t_16; - __pyx_t_5numpy_int32_t __pyx_t_17; - int __pyx_t_18; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__dtype,&__pyx_n_s__multilabel,&__pyx_n_s__zero_based,&__pyx_n_s__query_id,0}; - __Pyx_RefNannySetupContext("_load_svmlight_file"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_load_svmlight_file (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__dtype,&__pyx_n_s__multilabel,&__pyx_n_s__zero_based,&__pyx_n_s__query_id,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -1142,38 +1257,33 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__multilabel); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__multilabel)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zero_based); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zero_based)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__query_id); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__query_id)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_load_svmlight_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_load_svmlight_file") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -1186,108 +1296,165 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f } __pyx_v_f = values[0]; __pyx_v_dtype = values[1]; - __pyx_v_multilabel = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_multilabel == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_zero_based = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_zero_based == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_query_id = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_query_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_multilabel = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_multilabel == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_zero_based = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_zero_based == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_query_id = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_query_id == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_load_svmlight_file", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.datasets._svmlight_format._load_svmlight_file", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_file(__pyx_self, __pyx_v_f, __pyx_v_dtype, __pyx_v_multilabel, __pyx_v_zero_based, __pyx_v_query_id); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/datasets/_svmlight_format.pyx":30 + * + * + * def _load_svmlight_file(f, dtype, bint multilabel, bint zero_based, bint query_id): # <<<<<<<<<<<<<< + * cdef bytes line + * cdef char *hash_ptr, *line_cstr + */ + +static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_file(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_dtype, int __pyx_v_multilabel, int __pyx_v_zero_based, int __pyx_v_query_id) { + PyObject *__pyx_v_line = 0; + char *__pyx_v_hash_ptr; + char *__pyx_v_line_cstr; + __pyx_t_5numpy_int32_t __pyx_v_idx; + __pyx_t_5numpy_int32_t __pyx_v_prev_idx; + Py_ssize_t __pyx_v_i; + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_v_indptr = NULL; + PyObject *__pyx_v_indices = NULL; + PyObject *__pyx_v_query_values = NULL; + PyObject *__pyx_v_labels = NULL; + PyObject *__pyx_v_line_parts = NULL; + PyObject *__pyx_v_target = NULL; + PyObject *__pyx_v_features = NULL; + PyObject *__pyx_v_n_features = NULL; + CYTHON_UNUSED PyObject *__pyx_v__ = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_idx_s = NULL; + PyObject *__pyx_v_y = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + double __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + PyObject *(*__pyx_t_15)(PyObject *); + long __pyx_t_16; + __pyx_t_5numpy_int32_t __pyx_t_17; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_load_svmlight_file", 0); - /* "sklearn/datasets/_svmlight_format.pyx":34 + /* "sklearn/datasets/_svmlight_format.pyx":36 * cdef Py_ssize_t i * * data = ArrayBuilder(dtype=dtype) # <<<<<<<<<<<<<< * indptr = ArrayBuilder(dtype=_INDPTR_DTYPE) * indices = ArrayBuilder(dtype=_INDICES_DTYPE) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __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_2)); __pyx_t_2 = 0; __pyx_v_data = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":35 + /* "sklearn/datasets/_svmlight_format.pyx":37 * * data = ArrayBuilder(dtype=dtype) * indptr = ArrayBuilder(dtype=_INDPTR_DTYPE) # <<<<<<<<<<<<<< * indices = ArrayBuilder(dtype=_INDICES_DTYPE) * query_values = ArrayBuilder(dtype=np.int) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___INDPTR_DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___INDPTR_DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_indptr = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":36 + /* "sklearn/datasets/_svmlight_format.pyx":38 * data = ArrayBuilder(dtype=dtype) * indptr = ArrayBuilder(dtype=_INDPTR_DTYPE) * indices = ArrayBuilder(dtype=_INDICES_DTYPE) # <<<<<<<<<<<<<< * query_values = ArrayBuilder(dtype=np.int) * if multilabel: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); 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_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___INDICES_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___INDICES_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __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_2)); __pyx_t_2 = 0; __pyx_v_indices = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":37 + /* "sklearn/datasets/_svmlight_format.pyx":39 * indptr = ArrayBuilder(dtype=_INDPTR_DTYPE) * indices = ArrayBuilder(dtype=_INDICES_DTYPE) * query_values = ArrayBuilder(dtype=np.int) # <<<<<<<<<<<<<< * if multilabel: * labels = [] */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __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_v_query_values = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":38 + /* "sklearn/datasets/_svmlight_format.pyx":40 * indices = ArrayBuilder(dtype=_INDICES_DTYPE) * query_values = ArrayBuilder(dtype=np.int) * if multilabel: # <<<<<<<<<<<<<< @@ -1296,49 +1463,49 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f */ if (__pyx_v_multilabel) { - /* "sklearn/datasets/_svmlight_format.pyx":39 + /* "sklearn/datasets/_svmlight_format.pyx":41 * query_values = ArrayBuilder(dtype=np.int) * if multilabel: * labels = [] # <<<<<<<<<<<<<< * else: * labels = ArrayBuilder(dtype=np.double) */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_v_labels = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L6; + goto __pyx_L3; } /*else*/ { - /* "sklearn/datasets/_svmlight_format.pyx":41 + /* "sklearn/datasets/_svmlight_format.pyx":43 * labels = [] * else: * labels = ArrayBuilder(dtype=np.double) # <<<<<<<<<<<<<< * * for line in f: */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__double); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__double); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_labels = __pyx_t_1; __pyx_t_1 = 0; } - __pyx_L6:; + __pyx_L3:; - /* "sklearn/datasets/_svmlight_format.pyx":43 + /* "sklearn/datasets/_svmlight_format.pyx":45 * labels = ArrayBuilder(dtype=np.double) * * for line in f: # <<<<<<<<<<<<<< @@ -1349,44 +1516,52 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f __pyx_t_1 = __pyx_v_f; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_f); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_1)) { + if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; - } else if (PyTuple_CheckExact(__pyx_t_1)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_2 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_2); } - if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_line)); __pyx_v_line = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":45 + /* "sklearn/datasets/_svmlight_format.pyx":47 * for line in f: * # skip comments * line_cstr = line # <<<<<<<<<<<<<< * hash_ptr = strchr(line_cstr, '#') * if hash_ptr != NULL: */ - __pyx_t_7 = PyBytes_AsString(((PyObject *)__pyx_v_line)); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyBytes_AsString(((PyObject *)__pyx_v_line)); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_line_cstr = __pyx_t_7; - /* "sklearn/datasets/_svmlight_format.pyx":46 + /* "sklearn/datasets/_svmlight_format.pyx":48 * # skip comments * line_cstr = line * hash_ptr = strchr(line_cstr, '#') # <<<<<<<<<<<<<< @@ -1395,7 +1570,7 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f */ __pyx_v_hash_ptr = strchr(__pyx_v_line_cstr, '#'); - /* "sklearn/datasets/_svmlight_format.pyx":47 + /* "sklearn/datasets/_svmlight_format.pyx":49 * line_cstr = line * hash_ptr = strchr(line_cstr, '#') * if hash_ptr != NULL: # <<<<<<<<<<<<<< @@ -1405,71 +1580,71 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f __pyx_t_8 = (__pyx_v_hash_ptr != NULL); if (__pyx_t_8) { - /* "sklearn/datasets/_svmlight_format.pyx":48 + /* "sklearn/datasets/_svmlight_format.pyx":50 * hash_ptr = strchr(line_cstr, '#') * if hash_ptr != NULL: * line = line[:hash_ptr - line_cstr] # <<<<<<<<<<<<<< * * line_parts = line.split() */ - __pyx_t_2 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_line), 0, (__pyx_v_hash_ptr - __pyx_v_line_cstr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_line), 0, (__pyx_v_hash_ptr - __pyx_v_line_cstr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_v_line)); __pyx_v_line = __pyx_t_2; __pyx_t_2 = 0; - goto __pyx_L9; + goto __pyx_L6; } - __pyx_L9:; + __pyx_L6:; - /* "sklearn/datasets/_svmlight_format.pyx":50 + /* "sklearn/datasets/_svmlight_format.pyx":52 * line = line[:hash_ptr - line_cstr] * * line_parts = line.split() # <<<<<<<<<<<<<< * if len(line_parts) == 0: * continue */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_line), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_line), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_v_line_parts); __pyx_v_line_parts = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":51 + /* "sklearn/datasets/_svmlight_format.pyx":53 * * line_parts = line.split() * if len(line_parts) == 0: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_9 = PyObject_Length(__pyx_v_line_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Length(__pyx_v_line_parts); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = (__pyx_t_9 == 0); if (__pyx_t_8) { - /* "sklearn/datasets/_svmlight_format.pyx":52 + /* "sklearn/datasets/_svmlight_format.pyx":54 * line_parts = line.split() * if len(line_parts) == 0: * continue # <<<<<<<<<<<<<< * * target, features = line_parts[0], line_parts[1:] */ - goto __pyx_L7_continue; - goto __pyx_L10; + goto __pyx_L4_continue; + goto __pyx_L7; } - __pyx_L10:; + __pyx_L7:; - /* "sklearn/datasets/_svmlight_format.pyx":54 + /* "sklearn/datasets/_svmlight_format.pyx":56 * continue * * target, features = line_parts[0], line_parts[1:] # <<<<<<<<<<<<<< * if multilabel: * target = [float(y) for y in target.split(COMMA)] */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_line_parts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_line_parts, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_line_parts, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_line_parts, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_target); __pyx_v_target = __pyx_t_4; @@ -1478,7 +1653,7 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f __pyx_v_features = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":55 + /* "sklearn/datasets/_svmlight_format.pyx":57 * * target, features = line_parts[0], line_parts[1:] * if multilabel: # <<<<<<<<<<<<<< @@ -1487,23 +1662,23 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f */ if (__pyx_v_multilabel) { - /* "sklearn/datasets/_svmlight_format.pyx":56 + /* "sklearn/datasets/_svmlight_format.pyx":58 * target, features = line_parts[0], line_parts[1:] * if multilabel: * target = [float(y) for y in target.split(COMMA)] # <<<<<<<<<<<<<< * target.sort() * labels.append(tuple(target)) */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_4 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COMMA)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COMMA)); __Pyx_GIVEREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COMMA)); - __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -1511,24 +1686,32 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f __pyx_t_3 = __pyx_t_10; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_3)) { + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_10); __pyx_t_9++; - } else if (PyTuple_CheckExact(__pyx_t_3)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_10 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_10); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_10); __pyx_t_9++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_10); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_10 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_10 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_10)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -1537,88 +1720,90 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f __Pyx_XDECREF(__pyx_v_y); __pyx_v_y = __pyx_t_10; __pyx_t_10 = 0; - __pyx_t_12 = __Pyx_PyObject_AsDouble(__pyx_v_y); if (unlikely(__pyx_t_12 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_AsDouble(__pyx_v_y); if (unlikely(__pyx_t_12 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_v_target); - __pyx_v_target = ((PyObject *)__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_target); + __pyx_v_target = __pyx_t_3; + __pyx_t_3 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":57 + /* "sklearn/datasets/_svmlight_format.pyx":59 * if multilabel: * target = [float(y) for y in target.split(COMMA)] * target.sort() # <<<<<<<<<<<<<< * labels.append(tuple(target)) * else: */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__sort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_target, __pyx_n_s__sort); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":58 + /* "sklearn/datasets/_svmlight_format.pyx":60 * target = [float(y) for y in target.split(COMMA)] * target.sort() * labels.append(tuple(target)) # <<<<<<<<<<<<<< * else: * labels.append(float(target)) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_target); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_target); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_target); __Pyx_GIVEREF(__pyx_v_target); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_labels, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __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_2)); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_labels, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L11; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L8; } /*else*/ { - /* "sklearn/datasets/_svmlight_format.pyx":60 + /* "sklearn/datasets/_svmlight_format.pyx":62 * labels.append(tuple(target)) * else: * labels.append(float(target)) # <<<<<<<<<<<<<< * indptr.append(len(data)) * */ - __pyx_t_12 = __Pyx_PyObject_AsDouble(__pyx_v_target); if (unlikely(__pyx_t_12 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_labels, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_AsDouble(__pyx_v_target); if (unlikely(__pyx_t_12 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_labels, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __pyx_L11:; + __pyx_L8:; - /* "sklearn/datasets/_svmlight_format.pyx":61 + /* "sklearn/datasets/_svmlight_format.pyx":63 * else: * labels.append(float(target)) * indptr.append(len(data)) # <<<<<<<<<<<<<< * * prev_idx = -1 */ - __pyx_t_9 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_indptr, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_indptr, __pyx_t_3); 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(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":63 + /* "sklearn/datasets/_svmlight_format.pyx":65 * indptr.append(len(data)) * * prev_idx = -1 # <<<<<<<<<<<<<< @@ -1627,119 +1812,126 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f */ __pyx_v_prev_idx = -1; - /* "sklearn/datasets/_svmlight_format.pyx":64 + /* "sklearn/datasets/_svmlight_format.pyx":66 * * prev_idx = -1 * n_features = len(features) # <<<<<<<<<<<<<< * * if n_features and line_parts[1].startswith('qid'): */ - __pyx_t_9 = PyObject_Length(__pyx_v_features); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = PyObject_Length(__pyx_v_features); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_n_features); - __pyx_v_n_features = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_n_features = __pyx_t_2; + __pyx_t_2 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":66 + /* "sklearn/datasets/_svmlight_format.pyx":68 * n_features = len(features) * * if n_features and line_parts[1].startswith('qid'): # <<<<<<<<<<<<<< * _, value = line_parts[1].split(COLON, 1) * if query_id: */ - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_n_features); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_n_features); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_8) { - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_line_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_line_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__startswith); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_14 = __pyx_t_13; } else { __pyx_t_14 = __pyx_t_8; } if (__pyx_t_14) { - /* "sklearn/datasets/_svmlight_format.pyx":67 + /* "sklearn/datasets/_svmlight_format.pyx":69 * * if n_features and line_parts[1].startswith('qid'): * _, value = line_parts[1].split(COLON, 1) # <<<<<<<<<<<<<< * if query_id: * query_values.append(int(value)) */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_line_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_line_parts, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); __Pyx_GIVEREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_10 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); 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); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { PyObject* sequence = __pyx_t_10; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_3 = PyList_GET_ITEM(sequence, 0); - __pyx_t_2 = PyList_GET_ITEM(sequence, 1); + __pyx_t_2 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else { + } else + { Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext; - index = 0; __pyx_t_3 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L15_unpacking_failed; - __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_2 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L15_unpacking_failed; + index = 0; __pyx_t_2 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L12_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + index = 1; __pyx_t_3 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L12_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L16_unpacking_done; - __pyx_L15_unpacking_failed:; + goto __pyx_L13_unpacking_done; + __pyx_L12_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L16_unpacking_done:; + __pyx_t_15 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L13_unpacking_done:; } __Pyx_XDECREF(__pyx_v__); - __pyx_v__ = __pyx_t_3; - __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_v_value); - __pyx_v_value = __pyx_t_2; + __pyx_v__ = __pyx_t_2; __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_3; + __pyx_t_3 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":68 + /* "sklearn/datasets/_svmlight_format.pyx":70 * if n_features and line_parts[1].startswith('qid'): * _, value = line_parts[1].split(COLON, 1) * if query_id: # <<<<<<<<<<<<<< @@ -1748,167 +1940,171 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f */ if (__pyx_v_query_id) { - /* "sklearn/datasets/_svmlight_format.pyx":69 + /* "sklearn/datasets/_svmlight_format.pyx":71 * _, value = line_parts[1].split(COLON, 1) * if query_id: * query_values.append(int(value)) # <<<<<<<<<<<<<< * line_parts.pop(1) * n_features -= 1 */ - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_query_values, __pyx_t_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_query_values, __pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L17; + goto __pyx_L14; } - __pyx_L17:; + __pyx_L14:; - /* "sklearn/datasets/_svmlight_format.pyx":70 + /* "sklearn/datasets/_svmlight_format.pyx":72 * if query_id: * query_values.append(int(value)) * line_parts.pop(1) # <<<<<<<<<<<<<< * n_features -= 1 * */ - __pyx_t_10 = PyObject_GetAttr(__pyx_v_line_parts, __pyx_n_s__pop); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_PopIndex(__pyx_v_line_parts, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":71 + /* "sklearn/datasets/_svmlight_format.pyx":73 * query_values.append(int(value)) * line_parts.pop(1) * n_features -= 1 # <<<<<<<<<<<<<< * * for i in xrange(1, n_features + 1): */ - __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_v_n_features, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyNumber_InPlaceSubtract(__pyx_v_n_features, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_v_n_features); - __pyx_v_n_features = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L14; + __pyx_v_n_features = __pyx_t_10; + __pyx_t_10 = 0; + goto __pyx_L11; } - __pyx_L14:; + __pyx_L11:; - /* "sklearn/datasets/_svmlight_format.pyx":73 + /* "sklearn/datasets/_svmlight_format.pyx":75 * n_features -= 1 * * for i in xrange(1, n_features + 1): # <<<<<<<<<<<<<< * idx_s, value = line_parts[i].split(COLON, 1) * # XXX if we replace int with np.int32 in the line below, this */ - __pyx_t_2 = PyNumber_Add(__pyx_v_n_features, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_16 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = PyNumber_Add(__pyx_v_n_features, __pyx_int_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_16 = __Pyx_PyInt_AsLong(__pyx_t_10); if (unlikely((__pyx_t_16 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; for (__pyx_t_9 = 1; __pyx_t_9 < __pyx_t_16; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "sklearn/datasets/_svmlight_format.pyx":74 + /* "sklearn/datasets/_svmlight_format.pyx":76 * * for i in xrange(1, n_features + 1): * idx_s, value = line_parts[i].split(COLON, 1) # <<<<<<<<<<<<<< * # XXX if we replace int with np.int32 in the line below, this * # function becomes twice as slow. */ - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_line_parts, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__split); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_line_parts, __pyx_v_i, sizeof(Py_ssize_t), PyInt_FromSsize_t); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__split); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); __Pyx_GIVEREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_3 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __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_10)); __pyx_t_10 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { + PyObject* sequence = __pyx_t_2; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { - if (unlikely(PyList_GET_SIZE(sequence) != 2)) { - if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_10 = PyList_GET_ITEM(sequence, 1); + __pyx_t_10 = PyList_GET_ITEM(sequence, 0); + __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } - __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { + __Pyx_INCREF(__pyx_t_3); + #else + __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + { Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L20_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_10 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_10)) goto __pyx_L20_unpacking_failed; + index = 0; __pyx_t_10 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_10)) goto __pyx_L17_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + index = 1; __pyx_t_3 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L17_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L21_unpacking_done; - __pyx_L20_unpacking_failed:; + goto __pyx_L18_unpacking_done; + __pyx_L17_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); - if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L21_unpacking_done:; + __pyx_t_15 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L18_unpacking_done:; } __Pyx_XDECREF(__pyx_v_idx_s); - __pyx_v_idx_s = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_v_value); - __pyx_v_value = __pyx_t_10; + __pyx_v_idx_s = __pyx_t_10; __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_v_value); + __pyx_v_value = __pyx_t_3; + __pyx_t_3 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":78 + /* "sklearn/datasets/_svmlight_format.pyx":79 + * # XXX if we replace int with np.int32 in the line below, this * # function becomes twice as slow. - * * idx = int(idx_s) # <<<<<<<<<<<<<< * if idx < 0 or not zero_based and idx == 0: * raise ValueError( */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_idx_s); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_idx_s); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_idx_s); __Pyx_GIVEREF(__pyx_v_idx_s); - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_17 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_10); if (unlikely((__pyx_t_17 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_17 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_3); if (unlikely((__pyx_t_17 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_idx = __pyx_t_17; - /* "sklearn/datasets/_svmlight_format.pyx":79 - * + /* "sklearn/datasets/_svmlight_format.pyx":80 + * # function becomes twice as slow. * idx = int(idx_s) * if idx < 0 or not zero_based and idx == 0: # <<<<<<<<<<<<<< * raise ValueError( @@ -1929,34 +2125,34 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f } if (__pyx_t_8) { - /* "sklearn/datasets/_svmlight_format.pyx":81 + /* "sklearn/datasets/_svmlight_format.pyx":82 * if idx < 0 or not zero_based and idx == 0: * raise ValueError( * "Invalid index %d in SVMlight/LibSVM data file." % idx) # <<<<<<<<<<<<<< * if idx <= prev_idx: * raise ValueError("Feature ndices in SVMlight/LibSVM data " */ - __pyx_t_10 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_idx); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_t_10); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L22; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__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[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L19; } - __pyx_L22:; + __pyx_L19:; - /* "sklearn/datasets/_svmlight_format.pyx":82 + /* "sklearn/datasets/_svmlight_format.pyx":83 * raise ValueError( * "Invalid index %d in SVMlight/LibSVM data file." % idx) * if idx <= prev_idx: # <<<<<<<<<<<<<< @@ -1966,57 +2162,57 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f __pyx_t_8 = (__pyx_v_idx <= __pyx_v_prev_idx); if (__pyx_t_8) { - /* "sklearn/datasets/_svmlight_format.pyx":83 + /* "sklearn/datasets/_svmlight_format.pyx":84 * "Invalid index %d in SVMlight/LibSVM data file." % idx) * if idx <= prev_idx: * raise ValueError("Feature ndices in SVMlight/LibSVM data " # <<<<<<<<<<<<<< * "file should be sorted and unique.") * indices.append(idx) */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __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[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L23; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __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[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L20; } - __pyx_L23:; + __pyx_L20:; - /* "sklearn/datasets/_svmlight_format.pyx":85 + /* "sklearn/datasets/_svmlight_format.pyx":86 * raise ValueError("Feature ndices in SVMlight/LibSVM data " * "file should be sorted and unique.") * indices.append(idx) # <<<<<<<<<<<<<< * data.append(dtype(value)) * prev_idx = idx */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_idx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_indices, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_indices, __pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":86 + /* "sklearn/datasets/_svmlight_format.pyx":87 * "file should be sorted and unique.") * indices.append(idx) * data.append(dtype(value)) # <<<<<<<<<<<<<< * prev_idx = idx * */ - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_10)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); - __pyx_t_3 = PyObject_Call(__pyx_v_dtype, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_v_dtype, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_data, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_data, __pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":87 + /* "sklearn/datasets/_svmlight_format.pyx":88 * indices.append(idx) * data.append(dtype(value)) * prev_idx = idx # <<<<<<<<<<<<<< @@ -2025,90 +2221,90 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f */ __pyx_v_prev_idx = __pyx_v_idx; } - __pyx_L7_continue:; + __pyx_L4_continue:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":89 + /* "sklearn/datasets/_svmlight_format.pyx":90 * prev_idx = idx * * indptr.append(len(data)) # <<<<<<<<<<<<<< * * indptr = indptr.get() */ - __pyx_t_5 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_indptr, __pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_indptr, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __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_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":91 + /* "sklearn/datasets/_svmlight_format.pyx":92 * indptr.append(len(data)) * * indptr = indptr.get() # <<<<<<<<<<<<<< * data = data.get() * indices = indices.get() */ - __pyx_t_10 = PyObject_GetAttr(__pyx_v_indptr, __pyx_n_s__get); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_indptr, __pyx_n_s__get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_indptr); __pyx_v_indptr = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":92 + /* "sklearn/datasets/_svmlight_format.pyx":93 * * indptr = indptr.get() * data = data.get() # <<<<<<<<<<<<<< * indices = indices.get() * query_values = query_values.get() */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __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 = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_data); - __pyx_v_data = __pyx_t_10; - __pyx_t_10 = 0; + __pyx_v_data = __pyx_t_3; + __pyx_t_3 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":93 + /* "sklearn/datasets/_svmlight_format.pyx":94 * indptr = indptr.get() * data = data.get() * indices = indices.get() # <<<<<<<<<<<<<< * query_values = query_values.get() * */ - __pyx_t_10 = PyObject_GetAttr(__pyx_v_indices, __pyx_n_s__get); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_indices, __pyx_n_s__get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_indices); __pyx_v_indices = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":94 + /* "sklearn/datasets/_svmlight_format.pyx":95 * data = data.get() * indices = indices.get() * query_values = query_values.get() # <<<<<<<<<<<<<< * * if not multilabel: */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_query_values, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_query_values, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_query_values); - __pyx_v_query_values = __pyx_t_10; - __pyx_t_10 = 0; + __pyx_v_query_values = __pyx_t_3; + __pyx_t_3 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":96 + /* "sklearn/datasets/_svmlight_format.pyx":97 * query_values = query_values.get() * * if not multilabel: # <<<<<<<<<<<<<< @@ -2118,86 +2314,33 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f __pyx_t_8 = (!__pyx_v_multilabel); if (__pyx_t_8) { - /* "sklearn/datasets/_svmlight_format.pyx":97 + /* "sklearn/datasets/_svmlight_format.pyx":98 * * if not multilabel: * labels = labels.get() # <<<<<<<<<<<<<< * - * if query_id: + * return data, indices, indptr, labels, query_values */ - __pyx_t_10 = PyObject_GetAttr(__pyx_v_labels, __pyx_n_s__get); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_labels, __pyx_n_s__get); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_labels); __pyx_v_labels = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L24; + goto __pyx_L21; } - __pyx_L24:; + __pyx_L21:; - /* "sklearn/datasets/_svmlight_format.pyx":99 + /* "sklearn/datasets/_svmlight_format.pyx":100 * labels = labels.get() * - * if query_id: # <<<<<<<<<<<<<< - * if query_values.shape[0] != labels.shape[0]: - * raise ValueError( - */ - if (__pyx_v_query_id) { - - /* "sklearn/datasets/_svmlight_format.pyx":100 - * - * if query_id: - * if query_values.shape[0] != labels.shape[0]: # <<<<<<<<<<<<<< - * raise ValueError( - * """Malformed svmlight file: there should be one query id (qid) for - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_query_values, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_labels, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __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_RichCompare(__pyx_t_10, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_8) { - - /* "sklearn/datasets/_svmlight_format.pyx":101 - * if query_id: - * if query_values.shape[0] != labels.shape[0]: - * raise ValueError( # <<<<<<<<<<<<<< - * """Malformed svmlight file: there should be one query id (qid) for - * each sample""") - */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __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 = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L26; - } - __pyx_L26:; - goto __pyx_L25; - } - __pyx_L25:; - - /* "sklearn/datasets/_svmlight_format.pyx":104 - * """Malformed svmlight file: there should be one query id (qid) for - * each sample""") * return data, indices, indptr, labels, query_values # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_data); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data); __Pyx_GIVEREF(__pyx_v_data); @@ -2247,7 +2390,18 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f return __pyx_r; } -/* "numpy.pxd":190 +/* 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) { + int __pyx_r; + __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)); + __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): # <<<<<<<<<<<<<< @@ -2255,8 +2409,7 @@ static PyObject *__pyx_pf_7sklearn_8datasets_16_svmlight_format__load_svmlight_f * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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; int __pyx_v_ndim; @@ -2281,13 +2434,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -2298,11 +2451,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2311,7 +2464,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2320,16 +2473,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2339,7 +2492,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -2347,11 +2500,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -2360,9 +2513,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2372,37 +2525,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * 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") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.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_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2412,46 +2565,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * 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") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.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_11), 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, ((PyObject *)__pyx_k_tuple_8), 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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -2460,7 +2613,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -2469,7 +2622,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.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) # <<<<<<<<<<<<<< @@ -2478,7 +2631,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.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 # <<<<<<<<<<<<<< @@ -2487,7 +2640,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -2498,49 +2651,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -2549,25 +2702,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -2576,17 +2729,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -2595,7 +2750,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -2611,7 +2766,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -2623,49 +2778,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -2676,10 +2832,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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" */ @@ -2696,24 +2852,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), 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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (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" @@ -2722,10 +2878,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -2735,10 +2891,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2748,10 +2904,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2761,10 +2917,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -2774,10 +2930,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -2787,10 +2943,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -2800,10 +2956,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -2813,10 +2969,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -2826,10 +2982,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -2839,10 +2995,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -2852,10 +3008,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2865,10 +3021,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -2878,10 +3034,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2891,10 +3047,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2904,10 +3060,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2917,10 +3073,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2930,37 +3086,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __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_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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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)); __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2969,7 +3125,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2978,57 +3134,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -3053,31 +3209,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* 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)); + __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 CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -3085,11 +3249,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3099,7 +3263,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -3107,14 +3271,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -3129,9 +3293,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -3139,7 +3303,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3157,7 +3321,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -3172,9 +3336,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -3182,7 +3346,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3200,7 +3364,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -3215,9 +3379,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -3225,7 +3389,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3243,7 +3407,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3258,9 +3422,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -3268,7 +3432,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3286,7 +3450,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -3301,9 +3465,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -3311,7 +3475,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3329,7 +3493,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.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: # <<<<<<<<<<<<<< @@ -3352,18 +3516,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3372,7 +3537,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3381,7 +3546,7 @@ 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":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -3389,31 +3554,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -3422,20 +3592,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} + #endif + } else if (1) { + __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -3443,99 +3642,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), 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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * 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_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), 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_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -3543,16 +3741,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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -3561,7 +3758,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -3570,430 +3767,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.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_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.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_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), 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_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.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 = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.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_14), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -4001,25 +4181,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_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __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_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -4048,7 +4228,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -4060,9 +4240,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -4072,7 +4252,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -4084,7 +4264,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -4093,7 +4273,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -4104,7 +4284,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -4113,7 +4293,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -4125,7 +4305,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -4137,9 +4317,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -4149,7 +4329,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -4164,7 +4344,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -4202,24 +4382,25 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, - {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, - {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0, 0}, - {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, - {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, - {&__pyx_n_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 1}, - {&__pyx_kp_b_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 0, 0}, - {&__pyx_kp_b_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0, 0}, + {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, + {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_b_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 0, 0}, + {&__pyx_kp_b_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 0, 0}, + {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, {&__pyx_n_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 1}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, - {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, - {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, - {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 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__ArrayBuilder, __pyx_k__ArrayBuilder, sizeof(__pyx_k__ArrayBuilder), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s___, __pyx_k___, sizeof(__pyx_k___), 0, 0, 1, 1}, {&__pyx_n_s___INDICES_DTYPE, __pyx_k___INDICES_DTYPE, sizeof(__pyx_k___INDICES_DTYPE), 0, 0, 1, 1}, {&__pyx_n_s___INDPTR_DTYPE, __pyx_k___INDPTR_DTYPE, sizeof(__pyx_k___INDPTR_DTYPE), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, @@ -4227,38 +4408,52 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s___load_svmlight_file, __pyx_k___load_svmlight_file, sizeof(__pyx_k___load_svmlight_file), 0, 0, 1, 1}, {&__pyx_n_s___temp_csr, __pyx_k___temp_csr, sizeof(__pyx_k___temp_csr), 0, 0, 1, 1}, {&__pyx_n_s__csr_matrix, __pyx_k__csr_matrix, sizeof(__pyx_k__csr_matrix), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 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__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, + {&__pyx_n_s__features, __pyx_k__features, sizeof(__pyx_k__features), 0, 0, 1, 1}, {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, + {&__pyx_n_s__hash_ptr, __pyx_k__hash_ptr, sizeof(__pyx_k__hash_ptr), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1}, + {&__pyx_n_s__idx_s, __pyx_k__idx_s, sizeof(__pyx_k__idx_s), 0, 0, 1, 1}, {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1}, {&__pyx_n_s__indptr, __pyx_k__indptr, sizeof(__pyx_k__indptr), 0, 0, 1, 1}, {&__pyx_n_s__int, __pyx_k__int, sizeof(__pyx_k__int), 0, 0, 1, 1}, + {&__pyx_n_s__labels, __pyx_k__labels, sizeof(__pyx_k__labels), 0, 0, 1, 1}, + {&__pyx_n_s__line, __pyx_k__line, sizeof(__pyx_k__line), 0, 0, 1, 1}, + {&__pyx_n_s__line_cstr, __pyx_k__line_cstr, sizeof(__pyx_k__line_cstr), 0, 0, 1, 1}, + {&__pyx_n_s__line_parts, __pyx_k__line_parts, sizeof(__pyx_k__line_parts), 0, 0, 1, 1}, {&__pyx_n_s__multilabel, __pyx_k__multilabel, sizeof(__pyx_k__multilabel), 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__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__pop, __pyx_k__pop, sizeof(__pyx_k__pop), 0, 0, 1, 1}, + {&__pyx_n_s__prev_idx, __pyx_k__prev_idx, sizeof(__pyx_k__prev_idx), 0, 0, 1, 1}, {&__pyx_n_s__qid, __pyx_k__qid, sizeof(__pyx_k__qid), 0, 0, 1, 1}, {&__pyx_n_s__query_id, __pyx_k__query_id, sizeof(__pyx_k__query_id), 0, 0, 1, 1}, + {&__pyx_n_s__query_values, __pyx_k__query_values, sizeof(__pyx_k__query_values), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {&__pyx_n_s__sort, __pyx_k__sort, sizeof(__pyx_k__sort), 0, 0, 1, 1}, {&__pyx_n_s__sp, __pyx_k__sp, sizeof(__pyx_k__sp), 0, 0, 1, 1}, {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, {&__pyx_n_s__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 0, 0, 1, 1}, + {&__pyx_n_s__target, __pyx_k__target, sizeof(__pyx_k__target), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, {&__pyx_n_s__zero_based, __pyx_k__zero_based, sizeof(__pyx_k__zero_based), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { #if PY_MAJOR_VERSION >= 3 - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -4266,161 +4461,217 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/datasets/_svmlight_format.pyx":66 + /* "sklearn/datasets/_svmlight_format.pyx":68 * n_features = len(features) * * if n_features and line_parts[1].startswith('qid'): # <<<<<<<<<<<<<< * _, value = line_parts[1].split(COLON, 1) * if query_id: */ - __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_1)); + __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__qid)); PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__qid)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__qid)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); - /* "sklearn/datasets/_svmlight_format.pyx":70 - * if query_id: - * query_values.append(int(value)) - * line_parts.pop(1) # <<<<<<<<<<<<<< - * n_features -= 1 - * - */ - __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); - __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - - /* "sklearn/datasets/_svmlight_format.pyx":83 + /* "sklearn/datasets/_svmlight_format.pyx":84 * "Invalid index %d in SVMlight/LibSVM data file." % idx) * if idx <= prev_idx: * raise ValueError("Feature ndices in SVMlight/LibSVM data " # <<<<<<<<<<<<<< * "file should be sorted and unique.") * indices.append(idx) */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); - PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - - /* "sklearn/datasets/_svmlight_format.pyx":101 - * if query_id: - * if query_values.shape[0] != labels.shape[0]: - * raise ValueError( # <<<<<<<<<<<<<< - * """Malformed svmlight file: there should be one query id (qid) for - * each sample""") - */ - __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); - PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - - /* "numpy.pxd":211 + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.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_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); - PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "numpy.pxd":215 + /* "numpy.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_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); - PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); - PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); - PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_15)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_13); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); + PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); - PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - /* "numpy.pxd":819 + /* "numpy.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_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_18)); - PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_u_18)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_18)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_16); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); + PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); - /* "sklearn/datasets/_svmlight_format.pyx":18 + /* "sklearn/datasets/_svmlight_format.pyx":20 * # csr_matrix.indices and .indptr's dtypes are undocumented. We derive them * # empirically. * _temp_csr = sp.csr_matrix(0) # <<<<<<<<<<<<<< * _INDICES_DTYPE = _temp_csr.indices.dtype * _INDPTR_DTYPE = _temp_csr.indptr.dtype */ - __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, __pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); + + /* "sklearn/datasets/_svmlight_format.pyx":30 + * + * + * def _load_svmlight_file(f, dtype, bint multilabel, bint zero_based, bint query_id): # <<<<<<<<<<<<<< + * cdef bytes line + * cdef char *hash_ptr, *line_cstr + */ + __pyx_k_tuple_23 = PyTuple_New(24); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_INCREF(((PyObject *)__pyx_n_s__f)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__f)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dtype)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 1, ((PyObject *)__pyx_n_s__dtype)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dtype)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multilabel)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 2, ((PyObject *)__pyx_n_s__multilabel)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multilabel)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__zero_based)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 3, ((PyObject *)__pyx_n_s__zero_based)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zero_based)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__query_id)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 4, ((PyObject *)__pyx_n_s__query_id)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__query_id)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__line)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 5, ((PyObject *)__pyx_n_s__line)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__hash_ptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 6, ((PyObject *)__pyx_n_s__hash_ptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__hash_ptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__line_cstr)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 7, ((PyObject *)__pyx_n_s__line_cstr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line_cstr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 8, ((PyObject *)__pyx_n_s__idx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__prev_idx)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 9, ((PyObject *)__pyx_n_s__prev_idx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev_idx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 10, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 11, ((PyObject *)__pyx_n_s__data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__indptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 12, ((PyObject *)__pyx_n_s__indptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__indices)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 13, ((PyObject *)__pyx_n_s__indices)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indices)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__query_values)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 14, ((PyObject *)__pyx_n_s__query_values)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__query_values)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__labels)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 15, ((PyObject *)__pyx_n_s__labels)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__labels)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__line_parts)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 16, ((PyObject *)__pyx_n_s__line_parts)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__line_parts)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__target)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 17, ((PyObject *)__pyx_n_s__target)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__target)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__features)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 18, ((PyObject *)__pyx_n_s__features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 19, ((PyObject *)__pyx_n_s__n_features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s___)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 20, ((PyObject *)__pyx_n_s___)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s___)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__value)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 21, ((PyObject *)__pyx_n_s__value)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx_s)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 22, ((PyObject *)__pyx_n_s__idx_s)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx_s)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 23, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(5, 0, 24, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___load_svmlight_file, 30, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -4458,12 +4709,18 @@ PyMODINIT_FUNC PyInit__svmlight_format(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__svmlight_format(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__svmlight_format(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -4474,16 +4731,23 @@ PyMODINIT_FUNC PyInit__svmlight_format(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_svmlight_format"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_svmlight_format"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__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.datasets._svmlight_format")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.datasets._svmlight_format", __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); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4501,11 +4765,18 @@ PyMODINIT_FUNC PyInit__svmlight_format(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -4530,11 +4801,11 @@ PyMODINIT_FUNC PyInit__svmlight_format(void) * from ..utils.arraybuilder import ArrayBuilder */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_n_s_21)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_21)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s_21)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_20), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s_18)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_18)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_17), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sp, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4545,123 +4816,136 @@ PyMODINIT_FUNC PyInit__svmlight_format(void) * * from ..utils.arraybuilder import ArrayBuilder # <<<<<<<<<<<<<< * - * + * np.import_array() */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__ArrayBuilder)); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__ArrayBuilder)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ArrayBuilder)); - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_22), ((PyObject *)__pyx_t_2), 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_19), ((PyObject *)__pyx_t_2), 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ArrayBuilder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ArrayBuilder); + if (__pyx_t_2 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__ArrayBuilder); + if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ArrayBuilder, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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; - /* "sklearn/datasets/_svmlight_format.pyx":18 + /* "sklearn/datasets/_svmlight_format.pyx":15 + * from ..utils.arraybuilder import ArrayBuilder + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/datasets/_svmlight_format.pyx":20 * # csr_matrix.indices and .indptr's dtypes are undocumented. We derive them * # empirically. * _temp_csr = sp.csr_matrix(0) # <<<<<<<<<<<<<< * _INDICES_DTYPE = _temp_csr.indices.dtype * _INDPTR_DTYPE = _temp_csr.indptr.dtype */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___temp_csr, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___temp_csr, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":19 + /* "sklearn/datasets/_svmlight_format.pyx":21 * # empirically. * _temp_csr = sp.csr_matrix(0) * _INDICES_DTYPE = _temp_csr.indices.dtype # <<<<<<<<<<<<<< * _INDPTR_DTYPE = _temp_csr.indptr.dtype * del _temp_csr */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___temp_csr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___temp_csr); 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_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__indices); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__indices); 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(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dtype); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___INDICES_DTYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___INDICES_DTYPE, __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; - /* "sklearn/datasets/_svmlight_format.pyx":20 + /* "sklearn/datasets/_svmlight_format.pyx":22 * _temp_csr = sp.csr_matrix(0) * _INDICES_DTYPE = _temp_csr.indices.dtype * _INDPTR_DTYPE = _temp_csr.indptr.dtype # <<<<<<<<<<<<<< * del _temp_csr * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___temp_csr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___temp_csr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__indptr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__indptr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___INDPTR_DTYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___INDPTR_DTYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/datasets/_svmlight_format.pyx":21 + /* "sklearn/datasets/_svmlight_format.pyx":23 * _INDICES_DTYPE = _temp_csr.indices.dtype * _INDPTR_DTYPE = _temp_csr.indptr.dtype * del _temp_csr # <<<<<<<<<<<<<< * * */ - if (__Pyx_DelAttrString(__pyx_m, "_temp_csr") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_DelAttrString(__pyx_m, "_temp_csr") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/datasets/_svmlight_format.pyx":24 + /* "sklearn/datasets/_svmlight_format.pyx":26 * * * cdef bytes COMMA = u','.encode('ascii') # <<<<<<<<<<<<<< * cdef bytes COLON = u':'.encode('ascii') * */ - if (!(likely(PyBytes_CheckExact(((PyObject *)__pyx_kp_b_24)))||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(((PyObject *)__pyx_kp_b_24))->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_kp_b_24); + if (!(likely(PyBytes_CheckExact(((PyObject *)__pyx_kp_b_21)))||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(((PyObject *)__pyx_kp_b_21))->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_kp_b_21); __Pyx_XGOTREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COMMA)); __Pyx_DECREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COMMA)); - __Pyx_GIVEREF(__pyx_kp_b_24); - __pyx_v_7sklearn_8datasets_16_svmlight_format_COMMA = ((PyObject*)__pyx_kp_b_24); + __Pyx_GIVEREF(__pyx_kp_b_21); + __pyx_v_7sklearn_8datasets_16_svmlight_format_COMMA = ((PyObject*)__pyx_kp_b_21); - /* "sklearn/datasets/_svmlight_format.pyx":25 + /* "sklearn/datasets/_svmlight_format.pyx":27 * * cdef bytes COMMA = u','.encode('ascii') * cdef bytes COLON = u':'.encode('ascii') # <<<<<<<<<<<<<< * * */ - if (!(likely(PyBytes_CheckExact(((PyObject *)__pyx_kp_b_25)))||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(((PyObject *)__pyx_kp_b_25))->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(__pyx_kp_b_25); + if (!(likely(PyBytes_CheckExact(((PyObject *)__pyx_kp_b_22)))||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(((PyObject *)__pyx_kp_b_22))->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_kp_b_22); __Pyx_XGOTREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); __Pyx_DECREF(((PyObject *)__pyx_v_7sklearn_8datasets_16_svmlight_format_COLON)); - __Pyx_GIVEREF(__pyx_kp_b_25); - __pyx_v_7sklearn_8datasets_16_svmlight_format_COLON = ((PyObject*)__pyx_kp_b_25); + __Pyx_GIVEREF(__pyx_kp_b_22); + __pyx_v_7sklearn_8datasets_16_svmlight_format_COLON = ((PyObject*)__pyx_kp_b_22); - /* "sklearn/datasets/_svmlight_format.pyx":28 + /* "sklearn/datasets/_svmlight_format.pyx":30 * * * def _load_svmlight_file(f, dtype, bint multilabel, bint zero_based, bint query_id): # <<<<<<<<<<<<<< * cdef bytes line * cdef char *hash_ptr, *line_cstr */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_8datasets_16_svmlight_format__load_svmlight_file, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_8datasets_16_svmlight_format_1_load_svmlight_file, NULL, __pyx_n_s_26); 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); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___load_svmlight_file, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___load_svmlight_file, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/datasets/_svmlight_format.pyx":1 @@ -4674,7 +4958,7 @@ PyMODINIT_FUNC PyInit__svmlight_format(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -4701,7 +4985,6 @@ PyMODINIT_FUNC PyInit__svmlight_format(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -4742,7 +5025,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -4754,7 +5036,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -4768,7 +5050,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -4784,55 +5066,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -4851,9 +5155,11 @@ static int __Pyx_ParseOptionalKeywords( return -1; } - static double __Pyx__PyObject_AsDouble(PyObject* obj) { PyObject* float_value; +#if CYTHON_COMPILING_IN_PYPY + float_value = PyNumber_Float(obj); +#else if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) { return PyFloat_AsDouble(obj); } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) { @@ -4870,6 +5176,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) { PyTuple_SET_ITEM(args, 0, 0); Py_DECREF(args); } +#endif if (likely(float_value)) { double value = PyFloat_AS_DOUBLE(float_value); Py_DECREF(float_value); @@ -4879,23 +5186,40 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj) { return (double)-1; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else if (PyErr_Occurred()) { +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; @@ -4904,12 +5228,24 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { } } 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 void __Pyx_ErrRestore(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->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -4919,55 +5255,60 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -4990,7 +5331,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -4999,10 +5339,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -5012,7 +5351,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -5021,13 +5359,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } 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; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -5044,14 +5405,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -5061,8 +5417,8 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif @@ -5071,16 +5427,6 @@ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(index); - } -} - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); @@ -5119,12 +5465,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -5141,6 +5508,15 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { return module; } +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { +#if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", + PyString_AsString(name)); +#else + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); +#endif +} + 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; @@ -5170,6 +5546,10 @@ static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* 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_VERSION_HEX < 0x03000000 @@ -5189,6 +5569,7 @@ static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) { if (likely(!ret)) return val; } + #endif return (npy_int32)-1; } } @@ -5877,6 +6258,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -5886,15 +6284,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -5910,7 +6303,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -5920,7 +6313,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -5934,51 +6327,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -5989,28 +6436,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -6018,11 +6482,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -6057,6 +6519,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/sklearn/datasets/_svmlight_format.pyx b/sklearn/datasets/_svmlight_format.pyx index 4e06a7b80568d..2132fe56f21fd 100644 --- a/sklearn/datasets/_svmlight_format.pyx +++ b/sklearn/datasets/_svmlight_format.pyx @@ -12,6 +12,8 @@ import scipy.sparse as sp from ..utils.arraybuilder import ArrayBuilder +np.import_array() + # csr_matrix.indices and .indptr's dtypes are undocumented. We derive them # empirically. diff --git a/sklearn/ensemble/_gradient_boosting.c b/sklearn/ensemble/_gradient_boosting.c index 2f1e20838f431..c66fb61675277 100644 --- a/sklearn/ensemble/_gradient_boosting.c +++ b/sklearn/ensemble/_gradient_boosting.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.2 on Sun Jan 6 00:23:40 2013 */ +/* Generated by Cython 0.17.4 on Thu Jan 10 11:15:34 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -369,6 +369,8 @@ static const char *__pyx_f[] = { "numpy.pxd", "stringsource", "type.pxd", + "bool.pxd", + "complex.pxd", "_tree.pxd", }; #define IS_UNSIGNED(type) (((type) -1) > 0) @@ -653,8 +655,8 @@ typedef npy_double __pyx_t_5numpy_double_t; */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* "sklearn/tree/_tree.pxd":8 - * cimport numpy as np +/* "sklearn/tree/_tree.pxd":9 + * from cpython cimport bool * * ctypedef np.float32_t DTYPE_t # <<<<<<<<<<<<<< * ctypedef np.float64_t DOUBLE_t @@ -662,7 +664,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef __pyx_t_5numpy_float32_t __pyx_t_7sklearn_4tree_5_tree_DTYPE_t; -/* "sklearn/tree/_tree.pxd":9 +/* "sklearn/tree/_tree.pxd":10 * * ctypedef np.float32_t DTYPE_t * ctypedef np.float64_t DOUBLE_t # <<<<<<<<<<<<<< @@ -671,7 +673,7 @@ typedef __pyx_t_5numpy_float32_t __pyx_t_7sklearn_4tree_5_tree_DTYPE_t; */ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t; -/* "sklearn/tree/_tree.pxd":10 +/* "sklearn/tree/_tree.pxd":11 * ctypedef np.float32_t DTYPE_t * ctypedef np.float64_t DOUBLE_t * ctypedef np.int8_t BOOL_t # <<<<<<<<<<<<<< @@ -680,7 +682,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t; */ typedef __pyx_t_5numpy_int8_t __pyx_t_7sklearn_4tree_5_tree_BOOL_t; -/* "sklearn/ensemble/_gradient_boosting.pyx":17 +/* "sklearn/ensemble/_gradient_boosting.pyx":18 * from sklearn.tree._tree cimport Tree * * ctypedef np.int32_t int32 # <<<<<<<<<<<<<< @@ -689,7 +691,7 @@ typedef __pyx_t_5numpy_int8_t __pyx_t_7sklearn_4tree_5_tree_BOOL_t; */ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32; -/* "sklearn/ensemble/_gradient_boosting.pyx":18 +/* "sklearn/ensemble/_gradient_boosting.pyx":19 * * ctypedef np.int32_t int32 * ctypedef np.float64_t float64 # <<<<<<<<<<<<<< @@ -698,7 +700,7 @@ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_8ensemble_18_gradient_boosting_i */ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_8ensemble_18_gradient_boosting_float64; -/* "sklearn/ensemble/_gradient_boosting.pyx":22 +/* "sklearn/ensemble/_gradient_boosting.pyx":23 * # Define a datatype for the data array * DTYPE = np.float32 * ctypedef np.float32_t DTYPE_t # <<<<<<<<<<<<<< @@ -774,7 +776,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_resize; struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_build; struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_compute_feature_importances; -/* "sklearn/tree/_tree.pxd":87 +/* "sklearn/tree/_tree.pxd":88 * * # Methods * cdef void resize(self, int capacity=*) # <<<<<<<<<<<<<< @@ -786,7 +788,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_resize { int capacity; }; -/* "sklearn/tree/_tree.pxd":89 +/* "sklearn/tree/_tree.pxd":90 * cdef void resize(self, int capacity=*) * * cpdef build(self, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -800,7 +802,7 @@ struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_build { PyArrayObject *sample_weight; }; -/* "sklearn/tree/_tree.pxd":154 +/* "sklearn/tree/_tree.pxd":155 * cpdef apply(self, np.ndarray[DTYPE_t, ndim=2] X) * * cpdef compute_feature_importances(self, method=*) # <<<<<<<<<<<<<< @@ -848,7 +850,7 @@ struct __pyx_memoryview_obj { }; -/* "sklearn/tree/_tree.pxd":17 +/* "sklearn/tree/_tree.pxd":18 * # ============================================================================= * * cdef class Criterion: # <<<<<<<<<<<<<< @@ -908,7 +910,7 @@ struct __pyx_array_obj { }; -/* "sklearn/tree/_tree.pxd":53 +/* "sklearn/tree/_tree.pxd":54 * # ============================================================================= * * cdef class Tree: # <<<<<<<<<<<<<< @@ -998,7 +1000,7 @@ struct __pyx_vtabstruct__memoryviewslice { static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; -/* "sklearn/tree/_tree.pxd":17 +/* "sklearn/tree/_tree.pxd":18 * # ============================================================================= * * cdef class Criterion: # <<<<<<<<<<<<<< @@ -1009,7 +1011,7 @@ static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice; struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion { void (*init)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, int, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, __pyx_t_7sklearn_4tree_5_tree_BOOL_t *, int, double, int); void (*reset)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *); - void (*update)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, int, int, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, int, int *, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, __pyx_t_7sklearn_4tree_5_tree_BOOL_t *); + PyBoolObject *(*update)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, int, int, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, int, int *, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, __pyx_t_7sklearn_4tree_5_tree_BOOL_t *); double (*eval)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *); void (*init_value)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *); }; @@ -1147,7 +1149,7 @@ 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 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); /*proto*/ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/ @@ -1246,7 +1248,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -static 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); /*proto*/ static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/ @@ -1532,6 +1534,74 @@ static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +/* Module declarations from 'cpython.version' */ + +/* Module declarations from 'cpython.exc' */ + +/* Module declarations from 'cpython.module' */ + +/* Module declarations from 'cpython.mem' */ + +/* Module declarations from 'cpython.tuple' */ + +/* Module declarations from 'cpython.list' */ + +/* Module declarations from 'cpython.sequence' */ + +/* Module declarations from 'cpython.mapping' */ + +/* Module declarations from 'cpython.iterator' */ + +/* Module declarations from 'cpython.number' */ + +/* Module declarations from 'cpython.int' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.bool' */ +static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; + +/* Module declarations from 'cpython.long' */ + +/* Module declarations from 'cpython.float' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.complex' */ +static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; + +/* Module declarations from 'cpython.string' */ + +/* Module declarations from 'cpython.unicode' */ + +/* Module declarations from 'cpython.dict' */ + +/* Module declarations from 'cpython.instance' */ + +/* Module declarations from 'cpython.function' */ + +/* Module declarations from 'cpython.method' */ + +/* Module declarations from 'cpython.weakref' */ + +/* Module declarations from 'cpython.getargs' */ + +/* Module declarations from 'cpython.pythread' */ + +/* Module declarations from 'cpython.pystate' */ + +/* Module declarations from 'cpython.cobject' */ + +/* Module declarations from 'cpython.oldbuffer' */ + +/* Module declarations from 'cpython.set' */ + +/* Module declarations from 'cpython.bytes' */ + +/* Module declarations from 'cpython.pycapsule' */ + +/* Module declarations from 'cpython' */ + /* Module declarations from 'sklearn.tree._tree' */ static PyTypeObject *__pyx_ptype_7sklearn_4tree_5_tree_Criterion = 0; static PyTypeObject *__pyx_ptype_7sklearn_4tree_5_tree_Tree = 0; @@ -1666,7 +1736,7 @@ 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[] = "/home/gilles/Sources/scikit-learn/sklearn/ensemble/_gradient_boosting.pyx"; +static char __pyx_k_50[] = "/scratch/apps/src/scikit-learn/sklearn/ensemble/_gradient_boosting.pyx"; static char __pyx_k_51[] = "sklearn.ensemble._gradient_boosting"; static char __pyx_k_54[] = "getbuffer(obj, view, flags)"; static char __pyx_k_55[] = ""; @@ -1891,7 +1961,7 @@ static PyObject *__pyx_k_tuple_64; static PyObject *__pyx_k_codeobj_49; static PyObject *__pyx_k_codeobj_53; -/* "sklearn/ensemble/_gradient_boosting.pyx":27 +/* "sklearn/ensemble/_gradient_boosting.pyx":28 * cdef int LEAF = -1 * * cdef void _predict_regression_tree_inplace_fast(DTYPE_t *X, # <<<<<<<<<<<<<< @@ -1912,7 +1982,7 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ Py_ssize_t __pyx_t_6; __Pyx_RefNannySetupContext("_predict_regression_tree_inplace_fast", 0); - /* "sklearn/ensemble/_gradient_boosting.pyx":87 + /* "sklearn/ensemble/_gradient_boosting.pyx":88 * cdef int32 node_id * cdef int32 feature_idx * for i in range(n_samples): # <<<<<<<<<<<<<< @@ -1923,7 +1993,7 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/ensemble/_gradient_boosting.pyx":88 + /* "sklearn/ensemble/_gradient_boosting.pyx":89 * cdef int32 feature_idx * for i in range(n_samples): * node_id = 0 # <<<<<<<<<<<<<< @@ -1932,7 +2002,7 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ */ __pyx_v_node_id = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":90 + /* "sklearn/ensemble/_gradient_boosting.pyx":91 * node_id = 0 * # While node_id not a leaf * while children_left[node_id] != -1 and \ # <<<<<<<<<<<<<< @@ -1943,7 +2013,7 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ __pyx_t_3 = ((__pyx_v_children_left[__pyx_v_node_id]) != -1); if (__pyx_t_3) { - /* "sklearn/ensemble/_gradient_boosting.pyx":91 + /* "sklearn/ensemble/_gradient_boosting.pyx":92 * # While node_id not a leaf * while children_left[node_id] != -1 and \ * children_right[node_id] != -1: # <<<<<<<<<<<<<< @@ -1957,7 +2027,7 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ } if (!__pyx_t_5) break; - /* "sklearn/ensemble/_gradient_boosting.pyx":92 + /* "sklearn/ensemble/_gradient_boosting.pyx":93 * while children_left[node_id] != -1 and \ * children_right[node_id] != -1: * feature_idx = feature[node_id] # <<<<<<<<<<<<<< @@ -1966,7 +2036,7 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ */ __pyx_v_feature_idx = (__pyx_v_feature[__pyx_v_node_id]); - /* "sklearn/ensemble/_gradient_boosting.pyx":93 + /* "sklearn/ensemble/_gradient_boosting.pyx":94 * children_right[node_id] != -1: * feature_idx = feature[node_id] * if X[(i * n_features) + feature_idx] <= threshold[node_id]: # <<<<<<<<<<<<<< @@ -1976,7 +2046,7 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ __pyx_t_5 = ((__pyx_v_X[((__pyx_v_i * __pyx_v_n_features) + __pyx_v_feature_idx)]) <= (__pyx_v_threshold[__pyx_v_node_id])); if (__pyx_t_5) { - /* "sklearn/ensemble/_gradient_boosting.pyx":94 + /* "sklearn/ensemble/_gradient_boosting.pyx":95 * feature_idx = feature[node_id] * if X[(i * n_features) + feature_idx] <= threshold[node_id]: * node_id = children_left[node_id] # <<<<<<<<<<<<<< @@ -1988,7 +2058,7 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ } /*else*/ { - /* "sklearn/ensemble/_gradient_boosting.pyx":96 + /* "sklearn/ensemble/_gradient_boosting.pyx":97 * node_id = children_left[node_id] * else: * node_id = children_right[node_id] # <<<<<<<<<<<<<< @@ -2000,7 +2070,7 @@ static void __pyx_f_7sklearn_8ensemble_18_gradient_boosting__predict_regression_ __pyx_L7:; } - /* "sklearn/ensemble/_gradient_boosting.pyx":97 + /* "sklearn/ensemble/_gradient_boosting.pyx":98 * else: * node_id = children_right[node_id] * out[(i * K) + k] += scale * value[node_id] # <<<<<<<<<<<<<< @@ -2048,21 +2118,21 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_1predict_stage case 1: 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 = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_stages", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: 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 = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_stages", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: 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 = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_stages", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_stages") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_stages") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -2074,20 +2144,20 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_1predict_stage } __pyx_v_estimators = ((PyArrayObject *)values[0]); __pyx_v_X = ((PyArrayObject *)values[1]); - __pyx_v_scale = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_scale == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_scale = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_scale == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_out = ((PyArrayObject *)values[3]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict_stages", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_stages", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.ensemble._gradient_boosting.predict_stages", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_estimators), __pyx_ptype_5numpy_ndarray, 1, "estimators", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __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 = 102; __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_estimators), __pyx_ptype_5numpy_ndarray, 1, "estimators", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __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 = 103; __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 = 104; __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); goto __pyx_L0; __pyx_L1_error:; @@ -2097,7 +2167,7 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_1predict_stage return __pyx_r; } -/* "sklearn/ensemble/_gradient_boosting.pyx":101 +/* "sklearn/ensemble/_gradient_boosting.pyx":102 * * @cython.nonecheck(False) * def predict_stages(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< @@ -2147,21 +2217,21 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_estimators.rcbuffer->pybuffer, (PyObject*)__pyx_v_estimators, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_estimators.rcbuffer->pybuffer, (PyObject*)__pyx_v_estimators, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_estimators.diminfo[0].strides = __pyx_pybuffernd_estimators.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_estimators.diminfo[0].shape = __pyx_pybuffernd_estimators.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_estimators.diminfo[1].strides = __pyx_pybuffernd_estimators.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_estimators.diminfo[1].shape = __pyx_pybuffernd_estimators.rcbuffer->pybuffer.shape[1]; { __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_8ensemble_18_gradient_boosting_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __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_8ensemble_18_gradient_boosting_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __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_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_8ensemble_18_gradient_boosting_float64, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_8ensemble_18_gradient_boosting_float64, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __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]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1]; - /* "sklearn/ensemble/_gradient_boosting.pyx":111 + /* "sklearn/ensemble/_gradient_boosting.pyx":112 * cdef Py_ssize_t i * cdef Py_ssize_t k * cdef Py_ssize_t n_estimators = estimators.shape[0] # <<<<<<<<<<<<<< @@ -2170,7 +2240,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages */ __pyx_v_n_estimators = (__pyx_v_estimators->dimensions[0]); - /* "sklearn/ensemble/_gradient_boosting.pyx":112 + /* "sklearn/ensemble/_gradient_boosting.pyx":113 * cdef Py_ssize_t k * cdef Py_ssize_t n_estimators = estimators.shape[0] * cdef Py_ssize_t n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -2179,7 +2249,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/ensemble/_gradient_boosting.pyx":113 + /* "sklearn/ensemble/_gradient_boosting.pyx":114 * cdef Py_ssize_t n_estimators = estimators.shape[0] * cdef Py_ssize_t n_samples = X.shape[0] * cdef Py_ssize_t n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -2188,7 +2258,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages */ __pyx_v_n_features = (__pyx_v_X->dimensions[1]); - /* "sklearn/ensemble/_gradient_boosting.pyx":114 + /* "sklearn/ensemble/_gradient_boosting.pyx":115 * cdef Py_ssize_t n_samples = X.shape[0] * cdef Py_ssize_t n_features = X.shape[1] * cdef Py_ssize_t K = estimators.shape[1] # <<<<<<<<<<<<<< @@ -2197,7 +2267,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages */ __pyx_v_K = (__pyx_v_estimators->dimensions[1]); - /* "sklearn/ensemble/_gradient_boosting.pyx":117 + /* "sklearn/ensemble/_gradient_boosting.pyx":118 * cdef Tree tree * * for i in range(n_estimators): # <<<<<<<<<<<<<< @@ -2208,7 +2278,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/ensemble/_gradient_boosting.pyx":118 + /* "sklearn/ensemble/_gradient_boosting.pyx":119 * * for i in range(n_estimators): * for k in range(K): # <<<<<<<<<<<<<< @@ -2219,7 +2289,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_k = __pyx_t_4; - /* "sklearn/ensemble/_gradient_boosting.pyx":119 + /* "sklearn/ensemble/_gradient_boosting.pyx":120 * for i in range(n_estimators): * for k in range(K): * tree = estimators[i, k].tree_ # <<<<<<<<<<<<<< @@ -2230,15 +2300,15 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_predict_stages __pyx_t_7 = __pyx_v_k; __pyx_t_5 = *__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 = PyObject_GetAttr(__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 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__tree_); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __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;} + 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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_tree)); __pyx_v_tree = ((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_t_8); __pyx_t_8 = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":132 + /* "sklearn/ensemble/_gradient_boosting.pyx":133 * tree.value, * scale, k, K, n_samples, n_features, * ((out).data)) # <<<<<<<<<<<<<< @@ -2310,26 +2380,26 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_3predict_stage case 1: 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 = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: 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 = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: 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 = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: 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 = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_stage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_stage") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -2341,22 +2411,22 @@ 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 = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_stage = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_stage == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __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 = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_scale = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_scale == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_out = ((PyArrayObject *)values[4]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_stage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.ensemble._gradient_boosting.predict_stage", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_estimators), __pyx_ptype_5numpy_ndarray, 1, "estimators", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __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 = 138; __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 = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_estimators), __pyx_ptype_5numpy_ndarray, 1, "estimators", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __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 = 139; __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 = 140; __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); goto __pyx_L0; __pyx_L1_error:; @@ -2366,7 +2436,7 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_3predict_stage return __pyx_r; } -/* "sklearn/ensemble/_gradient_boosting.pyx":136 +/* "sklearn/ensemble/_gradient_boosting.pyx":137 * * @cython.nonecheck(False) * def predict_stage(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< @@ -2413,21 +2483,21 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage __pyx_pybuffernd_out.rcbuffer = &__pyx_pybuffer_out; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_estimators.rcbuffer->pybuffer, (PyObject*)__pyx_v_estimators, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_estimators.rcbuffer->pybuffer, (PyObject*)__pyx_v_estimators, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_estimators.diminfo[0].strides = __pyx_pybuffernd_estimators.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_estimators.diminfo[0].shape = __pyx_pybuffernd_estimators.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_estimators.diminfo[1].strides = __pyx_pybuffernd_estimators.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_estimators.diminfo[1].shape = __pyx_pybuffernd_estimators.rcbuffer->pybuffer.shape[1]; { __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_8ensemble_18_gradient_boosting_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __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_8ensemble_18_gradient_boosting_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __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_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_8ensemble_18_gradient_boosting_float64, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_v_out, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_8ensemble_18_gradient_boosting_float64, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __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]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1]; - /* "sklearn/ensemble/_gradient_boosting.pyx":147 + /* "sklearn/ensemble/_gradient_boosting.pyx":148 * cdef Py_ssize_t i * cdef Py_ssize_t k * cdef Py_ssize_t n_estimators = estimators.shape[0] # <<<<<<<<<<<<<< @@ -2436,7 +2506,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage */ __pyx_v_n_estimators = (__pyx_v_estimators->dimensions[0]); - /* "sklearn/ensemble/_gradient_boosting.pyx":148 + /* "sklearn/ensemble/_gradient_boosting.pyx":149 * cdef Py_ssize_t k * cdef Py_ssize_t n_estimators = estimators.shape[0] * cdef Py_ssize_t n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -2445,7 +2515,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/ensemble/_gradient_boosting.pyx":149 + /* "sklearn/ensemble/_gradient_boosting.pyx":150 * cdef Py_ssize_t n_estimators = estimators.shape[0] * cdef Py_ssize_t n_samples = X.shape[0] * cdef Py_ssize_t n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -2454,7 +2524,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage */ __pyx_v_n_features = (__pyx_v_X->dimensions[1]); - /* "sklearn/ensemble/_gradient_boosting.pyx":150 + /* "sklearn/ensemble/_gradient_boosting.pyx":151 * cdef Py_ssize_t n_samples = X.shape[0] * cdef Py_ssize_t n_features = X.shape[1] * cdef Py_ssize_t K = estimators.shape[1] # <<<<<<<<<<<<<< @@ -2463,7 +2533,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage */ __pyx_v_K = (__pyx_v_estimators->dimensions[1]); - /* "sklearn/ensemble/_gradient_boosting.pyx":152 + /* "sklearn/ensemble/_gradient_boosting.pyx":153 * cdef Py_ssize_t K = estimators.shape[1] * cdef Tree tree * for k in range(K): # <<<<<<<<<<<<<< @@ -2474,7 +2544,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_k = __pyx_t_2; - /* "sklearn/ensemble/_gradient_boosting.pyx":153 + /* "sklearn/ensemble/_gradient_boosting.pyx":154 * cdef Tree tree * for k in range(K): * tree = estimators[stage, k].tree_ # <<<<<<<<<<<<<< @@ -2485,15 +2555,15 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage __pyx_t_5 = __pyx_v_k; __pyx_t_3 = *__Pyx_BufPtrStrided2d(PyObject **, __pyx_pybuffernd_estimators.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_estimators.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_estimators.diminfo[1].strides); __Pyx_INCREF((PyObject*)__pyx_t_3); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__tree_); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__tree_); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7sklearn_4tree_5_tree_Tree))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_7sklearn_4tree_5_tree_Tree))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_tree)); __pyx_v_tree = ((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":163 + /* "sklearn/ensemble/_gradient_boosting.pyx":164 * tree.value, * scale, k, K, n_samples, n_features, * ((out).data)) # <<<<<<<<<<<<<< @@ -2528,7 +2598,7 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_2predict_stage return __pyx_r; } -/* "sklearn/ensemble/_gradient_boosting.pyx":166 +/* "sklearn/ensemble/_gradient_boosting.pyx":167 * * * cdef inline int array_index(int32 val, int32[::1] arr): # <<<<<<<<<<<<<< @@ -2548,7 +2618,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i int __pyx_t_4; __Pyx_RefNannySetupContext("array_index", 0); - /* "sklearn/ensemble/_gradient_boosting.pyx":168 + /* "sklearn/ensemble/_gradient_boosting.pyx":169 * cdef inline int array_index(int32 val, int32[::1] arr): * """Find index of ``val`` in array ``arr``. """ * cdef int32 res = -1 # <<<<<<<<<<<<<< @@ -2557,7 +2627,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i */ __pyx_v_res = -1; - /* "sklearn/ensemble/_gradient_boosting.pyx":169 + /* "sklearn/ensemble/_gradient_boosting.pyx":170 * """Find index of ``val`` in array ``arr``. """ * cdef int32 res = -1 * cdef int32 i = 0 # <<<<<<<<<<<<<< @@ -2566,7 +2636,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i */ __pyx_v_i = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":170 + /* "sklearn/ensemble/_gradient_boosting.pyx":171 * cdef int32 res = -1 * cdef int32 i = 0 * cdef int32 n = arr.shape[0] # <<<<<<<<<<<<<< @@ -2575,7 +2645,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i */ __pyx_v_n = (__pyx_v_arr.shape[0]); - /* "sklearn/ensemble/_gradient_boosting.pyx":171 + /* "sklearn/ensemble/_gradient_boosting.pyx":172 * cdef int32 i = 0 * cdef int32 n = arr.shape[0] * for i in range(n): # <<<<<<<<<<<<<< @@ -2586,7 +2656,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/ensemble/_gradient_boosting.pyx":172 + /* "sklearn/ensemble/_gradient_boosting.pyx":173 * cdef int32 n = arr.shape[0] * for i in range(n): * if arr[i] == val: # <<<<<<<<<<<<<< @@ -2597,7 +2667,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i __pyx_t_4 = ((*((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) __pyx_v_arr.data) + __pyx_t_3)) ))) == __pyx_v_val); if (__pyx_t_4) { - /* "sklearn/ensemble/_gradient_boosting.pyx":173 + /* "sklearn/ensemble/_gradient_boosting.pyx":174 * for i in range(n): * if arr[i] == val: * res = i # <<<<<<<<<<<<<< @@ -2606,7 +2676,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i */ __pyx_v_res = __pyx_v_i; - /* "sklearn/ensemble/_gradient_boosting.pyx":174 + /* "sklearn/ensemble/_gradient_boosting.pyx":175 * if arr[i] == val: * res = i * break # <<<<<<<<<<<<<< @@ -2620,7 +2690,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i } __pyx_L4_break:; - /* "sklearn/ensemble/_gradient_boosting.pyx":175 + /* "sklearn/ensemble/_gradient_boosting.pyx":176 * res = i * break * return res # <<<<<<<<<<<<<< @@ -2636,7 +2706,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_i return __pyx_r; } -/* "sklearn/ensemble/_gradient_boosting.pyx":178 +/* "sklearn/ensemble/_gradient_boosting.pyx":179 * * * cpdef _partial_dependence_tree(Tree tree, DTYPE_t[:, ::1] X, # <<<<<<<<<<<<<< @@ -2702,7 +2772,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_partial_dependence_tree", 0); - /* "sklearn/ensemble/_gradient_boosting.pyx":213 + /* "sklearn/ensemble/_gradient_boosting.pyx":214 * point. * """ * cdef Py_ssize_t i = 0 # <<<<<<<<<<<<<< @@ -2711,7 +2781,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_v_i = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":214 + /* "sklearn/ensemble/_gradient_boosting.pyx":215 * """ * cdef Py_ssize_t i = 0 * cdef Py_ssize_t n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -2720,7 +2790,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_v_n_features = (__pyx_v_X.shape[1]); - /* "sklearn/ensemble/_gradient_boosting.pyx":215 + /* "sklearn/ensemble/_gradient_boosting.pyx":216 * cdef Py_ssize_t i = 0 * cdef Py_ssize_t n_features = X.shape[1] * cdef int *children_left = tree.children_left # <<<<<<<<<<<<<< @@ -2730,7 +2800,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_1 = __pyx_v_tree->children_left; __pyx_v_children_left = __pyx_t_1; - /* "sklearn/ensemble/_gradient_boosting.pyx":216 + /* "sklearn/ensemble/_gradient_boosting.pyx":217 * cdef Py_ssize_t n_features = X.shape[1] * cdef int *children_left = tree.children_left * cdef int *children_right = tree.children_right # <<<<<<<<<<<<<< @@ -2740,7 +2810,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_1 = __pyx_v_tree->children_right; __pyx_v_children_right = __pyx_t_1; - /* "sklearn/ensemble/_gradient_boosting.pyx":217 + /* "sklearn/ensemble/_gradient_boosting.pyx":218 * cdef int *children_left = tree.children_left * cdef int *children_right = tree.children_right * cdef int *feature = tree.feature # <<<<<<<<<<<<<< @@ -2750,7 +2820,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_1 = __pyx_v_tree->feature; __pyx_v_feature = __pyx_t_1; - /* "sklearn/ensemble/_gradient_boosting.pyx":218 + /* "sklearn/ensemble/_gradient_boosting.pyx":219 * cdef int *children_right = tree.children_right * cdef int *feature = tree.feature * cdef double *value = tree.value # <<<<<<<<<<<<<< @@ -2760,7 +2830,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_2 = __pyx_v_tree->value; __pyx_v_value = __pyx_t_2; - /* "sklearn/ensemble/_gradient_boosting.pyx":219 + /* "sklearn/ensemble/_gradient_boosting.pyx":220 * cdef int *feature = tree.feature * cdef double *value = tree.value * cdef double *threshold = tree.threshold # <<<<<<<<<<<<<< @@ -2770,7 +2840,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_2 = __pyx_v_tree->threshold; __pyx_v_threshold = __pyx_t_2; - /* "sklearn/ensemble/_gradient_boosting.pyx":220 + /* "sklearn/ensemble/_gradient_boosting.pyx":221 * cdef double *value = tree.value * cdef double *threshold = tree.threshold * cdef int *n_samples = tree.n_samples # <<<<<<<<<<<<<< @@ -2780,7 +2850,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_1 = __pyx_v_tree->n_samples; __pyx_v_n_samples = __pyx_t_1; - /* "sklearn/ensemble/_gradient_boosting.pyx":221 + /* "sklearn/ensemble/_gradient_boosting.pyx":222 * cdef double *threshold = tree.threshold * cdef int *n_samples = tree.n_samples * cdef int node_count = tree.node_count # <<<<<<<<<<<<<< @@ -2790,7 +2860,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_3 = __pyx_v_tree->node_count; __pyx_v_node_count = __pyx_t_3; - /* "sklearn/ensemble/_gradient_boosting.pyx":223 + /* "sklearn/ensemble/_gradient_boosting.pyx":224 * cdef int node_count = tree.node_count * * cdef int32 stack_capacity = node_count * 2 # <<<<<<<<<<<<<< @@ -2799,97 +2869,97 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_v_stack_capacity = (__pyx_v_node_count * 2); - /* "sklearn/ensemble/_gradient_boosting.pyx":224 + /* "sklearn/ensemble/_gradient_boosting.pyx":225 * * cdef int32 stack_capacity = node_count * 2 * cdef int32[::1] node_stack = np.zeros((stack_capacity,), dtype=np.int32) # <<<<<<<<<<<<<< * cdef double[::1] weight_stack = np.ones((stack_capacity,), dtype=np.float64) * cdef int32 stack_size = 1 */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_stack_capacity); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_stack_capacity); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__int32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__int32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32(__pyx_t_8); - if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_9.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_node_stack = __pyx_t_9; __pyx_t_9.memview = NULL; __pyx_t_9.data = NULL; - /* "sklearn/ensemble/_gradient_boosting.pyx":225 + /* "sklearn/ensemble/_gradient_boosting.pyx":226 * cdef int32 stack_capacity = node_count * 2 * cdef int32[::1] node_stack = np.zeros((stack_capacity,), dtype=np.int32) * cdef double[::1] weight_stack = np.ones((stack_capacity,), dtype=np.float64) # <<<<<<<<<<<<<< * cdef int32 stack_size = 1 * cdef double left_sample_frac */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__ones); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__ones); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_stack_capacity); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_stack_capacity); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_7); - if (unlikely(!__pyx_t_10.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_10.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_weight_stack = __pyx_t_10; __pyx_t_10.memview = NULL; __pyx_t_10.data = NULL; - /* "sklearn/ensemble/_gradient_boosting.pyx":226 + /* "sklearn/ensemble/_gradient_boosting.pyx":227 * cdef int32[::1] node_stack = np.zeros((stack_capacity,), dtype=np.int32) * cdef double[::1] weight_stack = np.ones((stack_capacity,), dtype=np.float64) * cdef int32 stack_size = 1 # <<<<<<<<<<<<<< @@ -2898,7 +2968,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_v_stack_size = 1; - /* "sklearn/ensemble/_gradient_boosting.pyx":229 + /* "sklearn/ensemble/_gradient_boosting.pyx":230 * cdef double left_sample_frac * cdef double current_weight * cdef double total_weight = 0.0 # <<<<<<<<<<<<<< @@ -2907,7 +2977,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_v_total_weight = 0.0; - /* "sklearn/ensemble/_gradient_boosting.pyx":231 + /* "sklearn/ensemble/_gradient_boosting.pyx":232 * cdef double total_weight = 0.0 * * for i in range(X.shape[0]): # <<<<<<<<<<<<<< @@ -2918,7 +2988,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_i = __pyx_t_12; - /* "sklearn/ensemble/_gradient_boosting.pyx":233 + /* "sklearn/ensemble/_gradient_boosting.pyx":234 * for i in range(X.shape[0]): * # init stacks for new example * stack_size = 1 # <<<<<<<<<<<<<< @@ -2927,7 +2997,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_v_stack_size = 1; - /* "sklearn/ensemble/_gradient_boosting.pyx":234 + /* "sklearn/ensemble/_gradient_boosting.pyx":235 * # init stacks for new example * stack_size = 1 * node_stack[0] = 0 # <<<<<<<<<<<<<< @@ -2937,7 +3007,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_13 = 0; *((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) __pyx_v_node_stack.data) + __pyx_t_13)) )) = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":235 + /* "sklearn/ensemble/_gradient_boosting.pyx":236 * stack_size = 1 * node_stack[0] = 0 * weight_stack[0] = 1.0 # <<<<<<<<<<<<<< @@ -2947,7 +3017,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_14 = 0; *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_weight_stack.data) + __pyx_t_14)) )) = 1.0; - /* "sklearn/ensemble/_gradient_boosting.pyx":236 + /* "sklearn/ensemble/_gradient_boosting.pyx":237 * node_stack[0] = 0 * weight_stack[0] = 1.0 * total_weight = 0.0 # <<<<<<<<<<<<<< @@ -2956,7 +3026,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_v_total_weight = 0.0; - /* "sklearn/ensemble/_gradient_boosting.pyx":238 + /* "sklearn/ensemble/_gradient_boosting.pyx":239 * total_weight = 0.0 * * while stack_size > 0: # <<<<<<<<<<<<<< @@ -2967,7 +3037,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_15 = (__pyx_v_stack_size > 0); if (!__pyx_t_15) break; - /* "sklearn/ensemble/_gradient_boosting.pyx":240 + /* "sklearn/ensemble/_gradient_boosting.pyx":241 * while stack_size > 0: * # get top node on stack * stack_size -= 1 # <<<<<<<<<<<<<< @@ -2976,7 +3046,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_v_stack_size = (__pyx_v_stack_size - 1); - /* "sklearn/ensemble/_gradient_boosting.pyx":241 + /* "sklearn/ensemble/_gradient_boosting.pyx":242 * # get top node on stack * stack_size -= 1 * current_node = node_stack[stack_size] # <<<<<<<<<<<<<< @@ -2984,24 +3054,24 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend * if children_left[current_node] == LEAF: */ __pyx_t_16 = __pyx_v_stack_size; - __pyx_t_7 = __Pyx_PyInt_to_py_npy_int32((*((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) __pyx_v_node_stack.data) + __pyx_t_16)) )))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_npy_int32((*((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) __pyx_v_node_stack.data) + __pyx_t_16)) )))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_v_current_node); __pyx_v_current_node = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":243 + /* "sklearn/ensemble/_gradient_boosting.pyx":244 * current_node = node_stack[stack_size] * * if children_left[current_node] == LEAF: # <<<<<<<<<<<<<< * out[i] += weight_stack[stack_size] * value[current_node] * \ * learn_rate */ - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((__pyx_v_children_left[__pyx_t_17]) == __pyx_v_7sklearn_8ensemble_18_gradient_boosting_LEAF); if (__pyx_t_15) { - /* "sklearn/ensemble/_gradient_boosting.pyx":244 + /* "sklearn/ensemble/_gradient_boosting.pyx":245 * * if children_left[current_node] == LEAF: * out[i] += weight_stack[stack_size] * value[current_node] * \ # <<<<<<<<<<<<<< @@ -3009,9 +3079,9 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend * total_weight += weight_stack[stack_size] */ __pyx_t_18 = __pyx_v_stack_size; - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/ensemble/_gradient_boosting.pyx":245 + /* "sklearn/ensemble/_gradient_boosting.pyx":246 * if children_left[current_node] == LEAF: * out[i] += weight_stack[stack_size] * value[current_node] * \ * learn_rate # <<<<<<<<<<<<<< @@ -3021,7 +3091,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_19 = __pyx_v_i; *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_out.data) + __pyx_t_19)) )) += (((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_weight_stack.data) + __pyx_t_18)) ))) * (__pyx_v_value[__pyx_t_17])) * __pyx_v_learn_rate); - /* "sklearn/ensemble/_gradient_boosting.pyx":246 + /* "sklearn/ensemble/_gradient_boosting.pyx":247 * out[i] += weight_stack[stack_size] * value[current_node] * \ * learn_rate * total_weight += weight_stack[stack_size] # <<<<<<<<<<<<<< @@ -3034,17 +3104,17 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend } /*else*/ { - /* "sklearn/ensemble/_gradient_boosting.pyx":249 + /* "sklearn/ensemble/_gradient_boosting.pyx":250 * else: * # non-terminal node * feature_index = array_index(feature[current_node], target_feature) # <<<<<<<<<<<<<< * if feature_index != -1: * # split feature in target set */ - __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_17 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_feature_index = __pyx_f_7sklearn_8ensemble_18_gradient_boosting_array_index((__pyx_v_feature[__pyx_t_17]), __pyx_v_target_feature); - /* "sklearn/ensemble/_gradient_boosting.pyx":250 + /* "sklearn/ensemble/_gradient_boosting.pyx":251 * # non-terminal node * feature_index = array_index(feature[current_node], target_feature) * if feature_index != -1: # <<<<<<<<<<<<<< @@ -3054,7 +3124,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_15 = (__pyx_v_feature_index != -1); if (__pyx_t_15) { - /* "sklearn/ensemble/_gradient_boosting.pyx":253 + /* "sklearn/ensemble/_gradient_boosting.pyx":254 * # split feature in target set * # push left or right child on stack * if X[i, feature_index] <= threshold[current_node]: # <<<<<<<<<<<<<< @@ -3063,38 +3133,38 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_t_17 = __pyx_v_i; __pyx_t_3 = __pyx_v_feature_index; - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((*((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_DTYPE_t *) ( /* dim=1 */ ((char *) (((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_DTYPE_t *) ( /* dim=0 */ (__pyx_v_X.data + __pyx_t_17 * __pyx_v_X.strides[0]) )) + __pyx_t_3)) ))) <= (__pyx_v_threshold[__pyx_t_21])); if (__pyx_t_15) { - /* "sklearn/ensemble/_gradient_boosting.pyx":255 + /* "sklearn/ensemble/_gradient_boosting.pyx":256 * if X[i, feature_index] <= threshold[current_node]: * # left * node_stack[stack_size] = children_left[current_node] # <<<<<<<<<<<<<< * else: * # right */ - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_22 = __pyx_v_stack_size; *((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) __pyx_v_node_stack.data) + __pyx_t_22)) )) = (__pyx_v_children_left[__pyx_t_21]); goto __pyx_L9; } /*else*/ { - /* "sklearn/ensemble/_gradient_boosting.pyx":258 + /* "sklearn/ensemble/_gradient_boosting.pyx":259 * else: * # right * node_stack[stack_size] = children_right[current_node] # <<<<<<<<<<<<<< * stack_size += 1 * else: */ - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_23 = __pyx_v_stack_size; *((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) __pyx_v_node_stack.data) + __pyx_t_23)) )) = (__pyx_v_children_right[__pyx_t_21]); } __pyx_L9:; - /* "sklearn/ensemble/_gradient_boosting.pyx":259 + /* "sklearn/ensemble/_gradient_boosting.pyx":260 * # right * node_stack[stack_size] = children_right[current_node] * stack_size += 1 # <<<<<<<<<<<<<< @@ -3106,18 +3176,18 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend } /*else*/ { - /* "sklearn/ensemble/_gradient_boosting.pyx":265 + /* "sklearn/ensemble/_gradient_boosting.pyx":266 * * # push left child * node_stack[stack_size] = children_left[current_node] # <<<<<<<<<<<<<< * current_weight = weight_stack[stack_size] * left_sample_frac = n_samples[children_left[current_node]] / \ */ - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_24 = __pyx_v_stack_size; *((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) __pyx_v_node_stack.data) + __pyx_t_24)) )) = (__pyx_v_children_left[__pyx_t_21]); - /* "sklearn/ensemble/_gradient_boosting.pyx":266 + /* "sklearn/ensemble/_gradient_boosting.pyx":267 * # push left child * node_stack[stack_size] = children_left[current_node] * current_weight = weight_stack[stack_size] # <<<<<<<<<<<<<< @@ -3127,26 +3197,26 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_25 = __pyx_v_stack_size; __pyx_v_current_weight = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_weight_stack.data) + __pyx_t_25)) ))); - /* "sklearn/ensemble/_gradient_boosting.pyx":267 + /* "sklearn/ensemble/_gradient_boosting.pyx":268 * node_stack[stack_size] = children_left[current_node] * current_weight = weight_stack[stack_size] * left_sample_frac = n_samples[children_left[current_node]] / \ # <<<<<<<<<<<<<< * n_samples[current_node] * if left_sample_frac <= 0.0 or left_sample_frac >= 1.0: */ - __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_21 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/ensemble/_gradient_boosting.pyx":268 + /* "sklearn/ensemble/_gradient_boosting.pyx":269 * current_weight = weight_stack[stack_size] * left_sample_frac = n_samples[children_left[current_node]] / \ * n_samples[current_node] # <<<<<<<<<<<<<< * if left_sample_frac <= 0.0 or left_sample_frac >= 1.0: * raise ValueError("left_sample_frac:%f, " */ - __pyx_t_26 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_26 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_26 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_26 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_left_sample_frac = ((__pyx_v_n_samples[(__pyx_v_children_left[__pyx_t_21])]) / ((double)(__pyx_v_n_samples[__pyx_t_26]))); - /* "sklearn/ensemble/_gradient_boosting.pyx":269 + /* "sklearn/ensemble/_gradient_boosting.pyx":270 * left_sample_frac = n_samples[children_left[current_node]] / \ * n_samples[current_node] * if left_sample_frac <= 0.0 or left_sample_frac >= 1.0: # <<<<<<<<<<<<<< @@ -3162,38 +3232,38 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend } if (__pyx_t_28) { - /* "sklearn/ensemble/_gradient_boosting.pyx":273 + /* "sklearn/ensemble/_gradient_boosting.pyx":274 * "n_samples current: %d, " * "n_samples left: %d" * % (left_sample_frac, # <<<<<<<<<<<<<< * n_samples[current_node], * n_samples[children_left[current_node]])) */ - __pyx_t_7 = PyFloat_FromDouble(__pyx_v_left_sample_frac); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_left_sample_frac); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - /* "sklearn/ensemble/_gradient_boosting.pyx":274 + /* "sklearn/ensemble/_gradient_boosting.pyx":275 * "n_samples left: %d" * % (left_sample_frac, * n_samples[current_node], # <<<<<<<<<<<<<< * n_samples[children_left[current_node]])) * weight_stack[stack_size] = current_weight * left_sample_frac */ - __pyx_t_26 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_26 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromLong((__pyx_v_n_samples[__pyx_t_26])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_26 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_26 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_n_samples[__pyx_t_26])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - /* "sklearn/ensemble/_gradient_boosting.pyx":275 + /* "sklearn/ensemble/_gradient_boosting.pyx":276 * % (left_sample_frac, * n_samples[current_node], * n_samples[children_left[current_node]])) # <<<<<<<<<<<<<< * weight_stack[stack_size] = current_weight * left_sample_frac * stack_size +=1 */ - __pyx_t_26 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_26 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyInt_FromLong((__pyx_v_n_samples[(__pyx_v_children_left[__pyx_t_26])])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_26 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_26 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong((__pyx_v_n_samples[(__pyx_v_children_left[__pyx_t_26])])); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __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); @@ -3204,25 +3274,25 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_7 = 0; __pyx_t_4 = 0; __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __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 = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; - /* "sklearn/ensemble/_gradient_boosting.pyx":276 + /* "sklearn/ensemble/_gradient_boosting.pyx":277 * n_samples[current_node], * n_samples[children_left[current_node]])) * weight_stack[stack_size] = current_weight * left_sample_frac # <<<<<<<<<<<<<< @@ -3232,7 +3302,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_29 = __pyx_v_stack_size; *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_weight_stack.data) + __pyx_t_29)) )) = (__pyx_v_current_weight * __pyx_v_left_sample_frac); - /* "sklearn/ensemble/_gradient_boosting.pyx":277 + /* "sklearn/ensemble/_gradient_boosting.pyx":278 * n_samples[children_left[current_node]])) * weight_stack[stack_size] = current_weight * left_sample_frac * stack_size +=1 # <<<<<<<<<<<<<< @@ -3241,18 +3311,18 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend */ __pyx_v_stack_size = (__pyx_v_stack_size + 1); - /* "sklearn/ensemble/_gradient_boosting.pyx":280 + /* "sklearn/ensemble/_gradient_boosting.pyx":281 * * # push right child * node_stack[stack_size] = children_right[current_node] # <<<<<<<<<<<<<< * weight_stack[stack_size] = current_weight * \ * (1.0 - left_sample_frac) */ - __pyx_t_26 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_26 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_26 = __Pyx_PyIndex_AsSsize_t(__pyx_v_current_node); if (unlikely((__pyx_t_26 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_30 = __pyx_v_stack_size; *((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32 *) __pyx_v_node_stack.data) + __pyx_t_30)) )) = (__pyx_v_children_right[__pyx_t_26]); - /* "sklearn/ensemble/_gradient_boosting.pyx":281 + /* "sklearn/ensemble/_gradient_boosting.pyx":282 * # push right child * node_stack[stack_size] = children_right[current_node] * weight_stack[stack_size] = current_weight * \ # <<<<<<<<<<<<<< @@ -3262,7 +3332,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_31 = __pyx_v_stack_size; *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_weight_stack.data) + __pyx_t_31)) )) = (__pyx_v_current_weight * (1.0 - __pyx_v_left_sample_frac)); - /* "sklearn/ensemble/_gradient_boosting.pyx":283 + /* "sklearn/ensemble/_gradient_boosting.pyx":284 * weight_stack[stack_size] = current_weight * \ * (1.0 - left_sample_frac) * stack_size +=1 # <<<<<<<<<<<<<< @@ -3276,7 +3346,7 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_L7:; } - /* "sklearn/ensemble/_gradient_boosting.pyx":285 + /* "sklearn/ensemble/_gradient_boosting.pyx":286 * stack_size +=1 * * if not (0.999 < total_weight < 1.001): # <<<<<<<<<<<<<< @@ -3290,27 +3360,27 @@ static PyObject *__pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_depend __pyx_t_15 = (!__pyx_t_28); if (__pyx_t_15) { - /* "sklearn/ensemble/_gradient_boosting.pyx":287 + /* "sklearn/ensemble/_gradient_boosting.pyx":288 * if not (0.999 < total_weight < 1.001): * raise ValueError("Total weight should be 1.0 but was %.9f" % * total_weight) # <<<<<<<<<<<<<< */ - __pyx_t_8 = PyFloat_FromDouble(__pyx_v_total_weight); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyFloat_FromDouble(__pyx_v_total_weight); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L11; } __pyx_L11:; @@ -3372,26 +3442,26 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_5_partial_depe case 1: 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 = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __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--; else { - __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __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--; else { - __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: 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 = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_partial_dependence_tree") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_partial_dependence_tree") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -3403,20 +3473,20 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_5_partial_depe values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_tree = ((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)values[0]); - __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7sklearn_8ensemble_18_gradient_boosting_DTYPE_t(values[1]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_target_feature = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32(values[2]); if (unlikely(!__pyx_v_target_feature.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_learn_rate = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_learn_rate == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_out = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[4]); if (unlikely(!__pyx_v_out.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7sklearn_8ensemble_18_gradient_boosting_DTYPE_t(values[1]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_target_feature = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7sklearn_8ensemble_18_gradient_boosting_int32(values[2]); if (unlikely(!__pyx_v_target_feature.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_learn_rate = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_learn_rate == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_out = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[4]); if (unlikely(!__pyx_v_out.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_partial_dependence_tree", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.ensemble._gradient_boosting._partial_dependence_tree", __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 = 178; __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 = 179; __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); goto __pyx_L0; __pyx_L1_error:; @@ -3426,7 +3496,7 @@ static PyObject *__pyx_pw_7sklearn_8ensemble_18_gradient_boosting_5_partial_depe return __pyx_r; } -/* "sklearn/ensemble/_gradient_boosting.pyx":178 +/* "sklearn/ensemble/_gradient_boosting.pyx":179 * * * cpdef _partial_dependence_tree(Tree tree, DTYPE_t[:, ::1] X, # <<<<<<<<<<<<<< @@ -3443,10 +3513,10 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_4_partial_depe int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_partial_dependence_tree", 0); __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_X.memview)) { __Pyx_RaiseUnboundLocalError("X"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(!__pyx_v_target_feature.memview)) { __Pyx_RaiseUnboundLocalError("target_feature"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (unlikely(!__pyx_v_out.memview)) { __Pyx_RaiseUnboundLocalError("out"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_dependence_tree(__pyx_v_tree, __pyx_v_X, __pyx_v_target_feature, __pyx_v_learn_rate, __pyx_v_out, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_X.memview)) { __Pyx_RaiseUnboundLocalError("X"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_v_target_feature.memview)) { __Pyx_RaiseUnboundLocalError("target_feature"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (unlikely(!__pyx_v_out.memview)) { __Pyx_RaiseUnboundLocalError("out"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = __pyx_f_7sklearn_8ensemble_18_gradient_boosting__partial_dependence_tree(__pyx_v_tree, __pyx_v_X, __pyx_v_target_feature, __pyx_v_learn_rate, __pyx_v_out, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3468,8 +3538,8 @@ static PyObject *__pyx_pf_7sklearn_8ensemble_18_gradient_boosting_4_partial_depe } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -4287,8 +4357,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -6187,8 +6257,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx } /* Python wrapper */ -static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -8996,8 +9066,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie } /* Python wrapper */ -static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -15520,6 +15590,7 @@ 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); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); @@ -15531,6 +15602,7 @@ static void __pyx_tp_dealloc_array(PyObject *o) { } Py_CLEAR(p->mode); Py_CLEAR(p->_format); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -15764,7 +15836,9 @@ 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; + PyObject_GC_UnTrack(o); Py_CLEAR(p->name); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -15963,6 +16037,7 @@ 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; + PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); @@ -15975,6 +16050,7 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { Py_CLEAR(p->obj); Py_CLEAR(p->_size); Py_CLEAR(p->_array_interface); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -16255,6 +16331,7 @@ 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; + PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); @@ -16265,6 +16342,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->from_object); + PyObject_GC_Track(o); __pyx_tp_dealloc_memoryview(o); } @@ -16604,8 +16682,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __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_GetName(__pyx_b, __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_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -16893,14 +16971,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_39)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); - /* "sklearn/ensemble/_gradient_boosting.pyx":101 + /* "sklearn/ensemble/_gradient_boosting.pyx":102 * * @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): */ - __pyx_k_tuple_48 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_48 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_48); __Pyx_INCREF(((PyObject *)__pyx_n_s__estimators)); PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, ((PyObject *)__pyx_n_s__estimators)); @@ -16936,16 +17014,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_48, 10, ((PyObject *)__pyx_n_s__tree)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tree)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48)); - __pyx_k_codeobj_49 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 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, 101, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_49 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 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, 102, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/ensemble/_gradient_boosting.pyx":136 + /* "sklearn/ensemble/_gradient_boosting.pyx":137 * * @cython.nonecheck(False) * def predict_stage(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< * int stage, * np.ndarray[DTYPE_t, ndim=2] X, double scale, */ - __pyx_k_tuple_52 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_52 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_52); __Pyx_INCREF(((PyObject *)__pyx_n_s__estimators)); PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_n_s__estimators)); @@ -16984,7 +17062,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_52, 11, ((PyObject *)__pyx_n_s__tree)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tree)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52)); - __pyx_k_codeobj_53 = (PyObject*)__Pyx_PyCode_New(5, 0, 12, 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, 136, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_53 = (PyObject*)__Pyx_PyCode_New(5, 0, 12, 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, 137, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "View.MemoryView":282 * return self.name @@ -17191,10 +17269,12 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_4tree_5_tree_Criterion = __Pyx_ImportType("sklearn.tree._tree", "Criterion", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_Criterion)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __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 = 17; __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 = 53; __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 = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_4tree_5_tree_Criterion = __Pyx_ImportType("sklearn.tree._tree", "Criterion", sizeof(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion), 1); if (unlikely(!__pyx_ptype_7sklearn_4tree_5_tree_Criterion)) {__pyx_filename = __pyx_f[6]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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[6]; __pyx_lineno = 18; __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[6]; __pyx_lineno = 54; __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[6]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -17204,29 +17284,38 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) * * import numpy as np # <<<<<<<<<<<<<< * 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 = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":21 + /* "sklearn/ensemble/_gradient_boosting.pyx":14 + * import numpy as np + * cimport numpy as np + * np.import_array() # <<<<<<<<<<<<<< + * + * from sklearn.tree._tree cimport Tree + */ + import_array(); + + /* "sklearn/ensemble/_gradient_boosting.pyx":22 * * # Define a datatype for the data array * DTYPE = np.float32 # <<<<<<<<<<<<<< * ctypedef np.float32_t DTYPE_t * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":25 + /* "sklearn/ensemble/_gradient_boosting.pyx":26 * * # constant to mark tree leafs * cdef int LEAF = -1 # <<<<<<<<<<<<<< @@ -17235,28 +17324,28 @@ PyMODINIT_FUNC PyInit__gradient_boosting(void) */ __pyx_v_7sklearn_8ensemble_18_gradient_boosting_LEAF = -1; - /* "sklearn/ensemble/_gradient_boosting.pyx":101 + /* "sklearn/ensemble/_gradient_boosting.pyx":102 * * @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): */ - __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 = 101; __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_51); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__predict_stages, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__predict_stages, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/ensemble/_gradient_boosting.pyx":136 + /* "sklearn/ensemble/_gradient_boosting.pyx":137 * * @cython.nonecheck(False) * def predict_stage(np.ndarray[object, ndim=2] estimators, # <<<<<<<<<<<<<< * 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 = 136; __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_51); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__predict_stage, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__predict_stage, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/ensemble/_gradient_boosting.pyx":1 diff --git a/sklearn/ensemble/_gradient_boosting.pyx b/sklearn/ensemble/_gradient_boosting.pyx index 3fe7f2d5a7139..cd85eff88c146 100644 --- a/sklearn/ensemble/_gradient_boosting.pyx +++ b/sklearn/ensemble/_gradient_boosting.pyx @@ -11,6 +11,7 @@ cimport cython import numpy as np cimport numpy as np +np.import_array() from sklearn.tree._tree cimport Tree diff --git a/sklearn/feature_extraction/_hashing.c b/sklearn/feature_extraction/_hashing.c index ef2649409394c..2d779f1a281f2 100644 --- a/sklearn/feature_extraction/_hashing.c +++ b/sklearn/feature_extraction/_hashing.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17 on Thu Nov 15 13:09:29 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:48 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -53,12 +53,15 @@ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) - #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) @@ -579,6 +582,10 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /*--- Type declarations ---*/ +#ifndef _ARRAYARRAY_H +struct arrayobject; +typedef struct arrayobject arrayobject; +#endif /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t @@ -743,7 +750,6 @@ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); #ifndef _ARRAYARRAY_H #define _ARRAYARRAY_H -struct arrayobject; /* Forward */ typedef struct arraydescr { int typecode; int itemsize; @@ -753,7 +759,7 @@ typedef struct arraydescr { char *formats; #endif } arraydescr; -typedef struct arrayobject { +struct arrayobject { PyObject_HEAD Py_ssize_t ob_size; union { @@ -778,7 +784,7 @@ typedef struct arrayobject { #if PY_VERSION_HEX >= 0x03000000 int ob_exports; /* Number of exported buffers */ #endif -} arrayobject; +}; #ifndef NO_NEWARRAY_INLINE static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size, struct arraydescr *descr) { @@ -1153,7 +1159,7 @@ static char __pyx_k_11[] = "Non-native byte order not supported"; static char __pyx_k_13[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_14[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_17[] = "Format string allocated too short."; -static char __pyx_k_21[] = "/home/lars/src/scikit-learn/sklearn/feature_extraction/_hashing.pyx"; +static char __pyx_k_21[] = "/scratch/apps/src/scikit-learn/sklearn/feature_extraction/_hashing.pyx"; static char __pyx_k_22[] = "sklearn.feature_extraction._hashing"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; @@ -1286,16 +1292,16 @@ static PyObject *__pyx_pw_7sklearn_18feature_extraction_8_hashing_1transform(PyO case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("transform", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("transform", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("transform", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("transform", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -1305,12 +1311,12 @@ static PyObject *__pyx_pw_7sklearn_18feature_extraction_8_hashing_1transform(PyO values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_raw_X = values[0]; - __pyx_v_n_features = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_n_features == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_features = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_n_features == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_dtype = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("transform", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("transform", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.feature_extraction._hashing.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -1321,7 +1327,7 @@ static PyObject *__pyx_pw_7sklearn_18feature_extraction_8_hashing_1transform(PyO return __pyx_r; } -/* "sklearn/feature_extraction/_hashing.pyx":16 +/* "sklearn/feature_extraction/_hashing.pyx":18 * @cython.boundscheck(False) * @cython.cdivision(True) * def transform(raw_X, Py_ssize_t n_features, dtype): # <<<<<<<<<<<<<< @@ -1364,7 +1370,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH int __pyx_clineno = 0; __Pyx_RefNannySetupContext("transform", 0); - /* "sklearn/feature_extraction/_hashing.pyx":26 + /* "sklearn/feature_extraction/_hashing.pyx":28 * * """ * assert n_features > 0 # <<<<<<<<<<<<<< @@ -1374,35 +1380,35 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_n_features > 0))) { PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "sklearn/feature_extraction/_hashing.pyx":33 + /* "sklearn/feature_extraction/_hashing.pyx":35 * cdef array.array indices * cdef array.array indptr * indices = array.array("i") # <<<<<<<<<<<<<< * indptr = array.array("i", [0]) * */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cpython_5array_array)), ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cpython_5array_array)), ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_indices = ((arrayobject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":34 + /* "sklearn/feature_extraction/_hashing.pyx":36 * cdef array.array indptr * indices = array.array("i") * indptr = array.array("i", [0]) # <<<<<<<<<<<<<< * * # Since Python array does not understand Numpy dtypes, we grow the indices */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_0); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__i)); @@ -1410,13 +1416,13 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cpython_5array_array)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7cpython_5array_array)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_indptr = ((arrayobject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":38 + /* "sklearn/feature_extraction/_hashing.pyx":40 * # Since Python array does not understand Numpy dtypes, we grow the indices * # and values arrays ourselves. Use a Py_ssize_t capacity for safety. * cdef Py_ssize_t capacity = 8192 # arbitrary # <<<<<<<<<<<<<< @@ -1425,7 +1431,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH */ __pyx_v_capacity = 8192; - /* "sklearn/feature_extraction/_hashing.pyx":39 + /* "sklearn/feature_extraction/_hashing.pyx":41 * # and values arrays ourselves. Use a Py_ssize_t capacity for safety. * cdef Py_ssize_t capacity = 8192 # arbitrary * cdef np.int32_t size = 0 # <<<<<<<<<<<<<< @@ -1434,38 +1440,38 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH */ __pyx_v_size = 0; - /* "sklearn/feature_extraction/_hashing.pyx":40 + /* "sklearn/feature_extraction/_hashing.pyx":42 * cdef Py_ssize_t capacity = 8192 # arbitrary * cdef np.int32_t size = 0 * cdef np.ndarray values = np.empty(capacity, dtype=dtype) # <<<<<<<<<<<<<< * * for x in raw_X: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_capacity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_capacity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __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 = 40; __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 = 42; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __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; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_values = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":42 + /* "sklearn/feature_extraction/_hashing.pyx":44 * cdef np.ndarray values = np.empty(capacity, dtype=dtype) * * for x in raw_X: # <<<<<<<<<<<<<< @@ -1476,7 +1482,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __pyx_t_4 = __pyx_v_raw_X; __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_raw_X); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_raw_X); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; } @@ -1484,23 +1490,23 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH 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_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __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_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -1510,7 +1516,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __pyx_v_x = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":43 + /* "sklearn/feature_extraction/_hashing.pyx":45 * * for x in raw_X: * for f, v in x: # <<<<<<<<<<<<<< @@ -1521,7 +1527,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __pyx_t_1 = __pyx_v_x; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; } @@ -1529,23 +1535,23 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_1)) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_1)) { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_8(__pyx_t_1); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -1561,7 +1567,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -1574,14 +1580,14 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_9); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; @@ -1589,7 +1595,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L8_unpacking_done; @@ -1597,7 +1603,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L8_unpacking_done:; } __Pyx_XDECREF(__pyx_v_f); @@ -1607,7 +1613,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __pyx_v_v = __pyx_t_9; __pyx_t_9 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":44 + /* "sklearn/feature_extraction/_hashing.pyx":46 * for x in raw_X: * for f, v in x: * if isinstance(f, unicode): # <<<<<<<<<<<<<< @@ -1620,16 +1626,16 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_12) { - /* "sklearn/feature_extraction/_hashing.pyx":45 + /* "sklearn/feature_extraction/_hashing.pyx":47 * for f, v in x: * if isinstance(f, unicode): * f = f.encode("utf-8") # <<<<<<<<<<<<<< * # Need explicit type check because Murmurhash does not propagate * # all exceptions. Add "except *" there? */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_f, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_f); @@ -1638,7 +1644,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH goto __pyx_L9; } - /* "sklearn/feature_extraction/_hashing.pyx":48 + /* "sklearn/feature_extraction/_hashing.pyx":50 * # Need explicit type check because Murmurhash does not propagate * # all exceptions. Add "except *" there? * elif not isinstance(f, bytes): # <<<<<<<<<<<<<< @@ -1652,70 +1658,70 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __pyx_t_13 = (!__pyx_t_12); if (__pyx_t_13) { - /* "sklearn/feature_extraction/_hashing.pyx":49 + /* "sklearn/feature_extraction/_hashing.pyx":51 * # all exceptions. Add "except *" there? * elif not isinstance(f, bytes): * raise TypeError("feature names must be strings") # <<<<<<<<<<<<<< * h = murmurhash3_bytes_s32(f, 0) * */ - __pyx_t_9 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L9; } __pyx_L9:; - /* "sklearn/feature_extraction/_hashing.pyx":50 + /* "sklearn/feature_extraction/_hashing.pyx":52 * elif not isinstance(f, bytes): * raise TypeError("feature names must be strings") * h = murmurhash3_bytes_s32(f, 0) # <<<<<<<<<<<<<< * * array.resize_smart(indices, len(indices) + 1) */ - if (!(likely(PyBytes_CheckExact(__pyx_v_f))||((__pyx_v_f) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_f)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyBytes_CheckExact(__pyx_v_f))||((__pyx_v_f) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_f)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = __pyx_v_f; __Pyx_INCREF(__pyx_t_9); __pyx_v_h = __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_s32(((PyObject*)__pyx_t_9), 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":52 + /* "sklearn/feature_extraction/_hashing.pyx":54 * h = murmurhash3_bytes_s32(f, 0) * * array.resize_smart(indices, len(indices) + 1) # <<<<<<<<<<<<<< * indices[len(indices) - 1] = abs(h) % n_features * value = v */ - __pyx_t_14 = Py_SIZE(((PyObject *)__pyx_v_indices)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = Py_SIZE(((PyObject *)__pyx_v_indices)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} resize_smart(__pyx_v_indices, (__pyx_t_14 + 1)); - /* "sklearn/feature_extraction/_hashing.pyx":53 + /* "sklearn/feature_extraction/_hashing.pyx":55 * * array.resize_smart(indices, len(indices) + 1) * indices[len(indices) - 1] = abs(h) % n_features # <<<<<<<<<<<<<< * value = v * value *= (h >= 0) * 2 - 1 */ - __pyx_t_9 = PyInt_FromSsize_t((abs(__pyx_v_h) % __pyx_v_n_features)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromSsize_t((abs(__pyx_v_h) % __pyx_v_n_features)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = Py_SIZE(((PyObject *)__pyx_v_indices)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = Py_SIZE(((PyObject *)__pyx_v_indices)); if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = (__pyx_t_14 - 1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_indices), __pyx_t_15, __pyx_t_9, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_indices), __pyx_t_15, __pyx_t_9, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":54 + /* "sklearn/feature_extraction/_hashing.pyx":56 * array.resize_smart(indices, len(indices) + 1) * indices[len(indices) - 1] = abs(h) % n_features * value = v # <<<<<<<<<<<<<< * value *= (h >= 0) * 2 - 1 * values[size] = value */ - __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_v_v); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_value = __pyx_t_16; - /* "sklearn/feature_extraction/_hashing.pyx":55 + /* "sklearn/feature_extraction/_hashing.pyx":57 * indices[len(indices) - 1] = abs(h) % n_features * value = v * value *= (h >= 0) * 2 - 1 # <<<<<<<<<<<<<< @@ -1724,19 +1730,19 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH */ __pyx_v_value = (__pyx_v_value * (((__pyx_v_h >= 0) * 2) - 1)); - /* "sklearn/feature_extraction/_hashing.pyx":56 + /* "sklearn/feature_extraction/_hashing.pyx":58 * value = v * value *= (h >= 0) * 2 - 1 * values[size] = value # <<<<<<<<<<<<<< * size += 1 * */ - __pyx_t_9 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_values), __pyx_v_size, __pyx_t_9, sizeof(__pyx_t_5numpy_int32_t), __Pyx_PyInt_to_py_npy_int32) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_values), __pyx_v_size, __pyx_t_9, sizeof(__pyx_t_5numpy_int32_t), __Pyx_PyInt_to_py_npy_int32) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":57 + /* "sklearn/feature_extraction/_hashing.pyx":59 * value *= (h >= 0) * 2 - 1 * values[size] = value * size += 1 # <<<<<<<<<<<<<< @@ -1745,7 +1751,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH */ __pyx_v_size = (__pyx_v_size + 1); - /* "sklearn/feature_extraction/_hashing.pyx":59 + /* "sklearn/feature_extraction/_hashing.pyx":61 * size += 1 * * if size == capacity: # <<<<<<<<<<<<<< @@ -1755,7 +1761,7 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH __pyx_t_13 = (__pyx_v_size == __pyx_v_capacity); if (__pyx_t_13) { - /* "sklearn/feature_extraction/_hashing.pyx":60 + /* "sklearn/feature_extraction/_hashing.pyx":62 * * if size == capacity: * capacity *= 2 # <<<<<<<<<<<<<< @@ -1764,21 +1770,21 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH */ __pyx_v_capacity = (__pyx_v_capacity * 2); - /* "sklearn/feature_extraction/_hashing.pyx":63 + /* "sklearn/feature_extraction/_hashing.pyx":65 * # can't use resize member because there might be multiple * # references to the arrays due to Cython's error checking * values = np.resize(values, capacity) # <<<<<<<<<<<<<< * * array.resize_smart(indptr, len(indptr) + 1) */ - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__resize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__resize); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_capacity); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_capacity); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_values)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_values)); @@ -1786,11 +1792,11 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_values)); __pyx_v_values = ((PyArrayObject *)__pyx_t_9); __pyx_t_9 = 0; @@ -1800,69 +1806,69 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":65 + /* "sklearn/feature_extraction/_hashing.pyx":67 * values = np.resize(values, capacity) * * array.resize_smart(indptr, len(indptr) + 1) # <<<<<<<<<<<<<< * indptr[len(indptr) - 1] = size * */ - __pyx_t_7 = Py_SIZE(((PyObject *)__pyx_v_indptr)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = Py_SIZE(((PyObject *)__pyx_v_indptr)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} resize_smart(__pyx_v_indptr, (__pyx_t_7 + 1)); - /* "sklearn/feature_extraction/_hashing.pyx":66 + /* "sklearn/feature_extraction/_hashing.pyx":68 * * array.resize_smart(indptr, len(indptr) + 1) * indptr[len(indptr) - 1] = size # <<<<<<<<<<<<<< * * if len(indices): */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_size); 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); - __pyx_t_7 = Py_SIZE(((PyObject *)__pyx_v_indptr)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = Py_SIZE(((PyObject *)__pyx_v_indptr)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = (__pyx_t_7 - 1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_indptr), __pyx_t_15, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_indptr), __pyx_t_15, __pyx_t_1, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":68 + /* "sklearn/feature_extraction/_hashing.pyx":70 * indptr[len(indptr) - 1] = size * * if len(indices): # <<<<<<<<<<<<<< * indices_a = np.frombuffer(indices, dtype=np.int32) * else: */ - __pyx_t_5 = Py_SIZE(((PyObject *)__pyx_v_indices)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_SIZE(((PyObject *)__pyx_v_indices)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { - /* "sklearn/feature_extraction/_hashing.pyx":69 + /* "sklearn/feature_extraction/_hashing.pyx":71 * * if len(indices): * indices_a = np.frombuffer(indices, dtype=np.int32) # <<<<<<<<<<<<<< * else: * indices_a = np.empty(0, dtype=np.int32) */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__frombuffer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__frombuffer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_indices)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_indices)); __Pyx_GIVEREF(((PyObject *)__pyx_v_indices)); - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __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; @@ -1873,27 +1879,27 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH } /*else*/ { - /* "sklearn/feature_extraction/_hashing.pyx":71 + /* "sklearn/feature_extraction/_hashing.pyx":73 * indices_a = np.frombuffer(indices, dtype=np.int32) * else: * indices_a = np.empty(0, dtype=np.int32) # <<<<<<<<<<<<<< * return (indices_a, np.frombuffer(indptr, dtype=np.int32), values[:size]) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -1902,39 +1908,39 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH } __pyx_L11:; - /* "sklearn/feature_extraction/_hashing.pyx":72 + /* "sklearn/feature_extraction/_hashing.pyx":74 * else: * indices_a = np.empty(0, dtype=np.int32) * return (indices_a, np.frombuffer(indptr, dtype=np.int32), values[:size]) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__frombuffer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__frombuffer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_indptr)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_indptr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_indptr)); - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_values), 0, __pyx_v_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_values), 0, __pyx_v_size); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_indices_a); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_indices_a); @@ -1974,8 +1980,8 @@ static PyObject *__pyx_pf_7sklearn_18feature_extraction_8_hashing_transform(CYTH } /* Python wrapper */ -static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -1996,6 +2002,9 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se CYTHON_UNUSED unsigned int __pyx_v_itemsize; int __pyx_r; __Pyx_RefNannyDeclarations + char *__pyx_t_1; + int __pyx_t_2; + Py_ssize_t __pyx_t_3; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); @@ -2018,7 +2027,8 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * info.readonly = 0 * info.ndim = 1 */ - __pyx_v_info->buf = __pyx_v_self->data.as_chars; + __pyx_t_1 = __pyx_v_self->data.as_chars; + __pyx_v_info->buf = __pyx_t_1; /* "array.pxd":100 * info.suboffsets = NULL @@ -2045,8 +2055,9 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * * info.strides = \ */ - __pyx_v_info->itemsize = __pyx_v_self->ob_descr->itemsize; - __pyx_v_itemsize = __pyx_v_self->ob_descr->itemsize; + __pyx_t_2 = __pyx_v_self->ob_descr->itemsize; + __pyx_v_info->itemsize = __pyx_t_2; + __pyx_v_itemsize = __pyx_t_2; /* "array.pxd":104 * info.itemsize = itemsize = self.ob_descr.itemsize # e.g. sizeof(float) @@ -2082,7 +2093,8 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * * info.format = (info.strides + 2 * info.ndim) */ - (__pyx_v_info->strides[0]) = __pyx_v_info->itemsize; + __pyx_t_3 = __pyx_v_info->itemsize; + (__pyx_v_info->strides[0]) = __pyx_t_3; /* "array.pxd":110 * info.strides[0] = info.itemsize @@ -2100,7 +2112,8 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se * info.format[1] = 0 * info.obj = self */ - (__pyx_v_info->format[0]) = __pyx_v_self->ob_descr->typecode; + __pyx_t_2 = __pyx_v_self->ob_descr->typecode; + (__pyx_v_info->format[0]) = __pyx_t_2; /* "array.pxd":112 * info.format = (info.strides + 2 * info.ndim) @@ -2134,8 +2147,8 @@ static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_se } /* Python wrapper */ -static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); @@ -2328,6 +2341,7 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__py int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("extend_buffer", 0); /* "array.pxd":151 @@ -2337,7 +2351,8 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__py * cdef Py_ssize_t orgsize = Py_SIZE(self) * if resize_smart(self, orgsize + n) == -1: */ - __pyx_v_itemsize = __pyx_v_self->ob_descr->itemsize; + __pyx_t_1 = __pyx_v_self->ob_descr->itemsize; + __pyx_v_itemsize = __pyx_t_1; /* "array.pxd":152 * n: number of elements (not number of bytes!) """ @@ -2355,8 +2370,8 @@ static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__py * return -1 * memcpy(self.data.as_chars + orgsize * itemsize, stuff, n * itemsize) */ - __pyx_t_1 = (resize_smart(__pyx_v_self, (__pyx_v_orgsize + __pyx_v_n)) == -1); - if (__pyx_t_1) { + __pyx_t_2 = (resize_smart(__pyx_v_self, (__pyx_v_orgsize + __pyx_v_n)) == -1); + if (__pyx_t_2) { /* "array.pxd":154 * cdef Py_ssize_t orgsize = Py_SIZE(self) @@ -2479,8 +2494,8 @@ static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_op) } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -2824,8 +2839,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset @@ -2900,7 +2917,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: @@ -3295,8 +3313,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -4510,7 +4528,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4523,55 +4541,55 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/feature_extraction/_hashing.pyx":33 + /* "sklearn/feature_extraction/_hashing.pyx":35 * cdef array.array indices * cdef array.array indptr * indices = array.array("i") # <<<<<<<<<<<<<< * indptr = array.array("i", [0]) * */ - __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_1 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_1, 0, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_1)); - /* "sklearn/feature_extraction/_hashing.pyx":45 + /* "sklearn/feature_extraction/_hashing.pyx":47 * for f, v in x: * if isinstance(f, unicode): * f = f.encode("utf-8") # <<<<<<<<<<<<<< * # Need explicit type check because Murmurhash does not propagate * # all exceptions. Add "except *" there? */ - __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); - /* "sklearn/feature_extraction/_hashing.pyx":49 + /* "sklearn/feature_extraction/_hashing.pyx":51 * # all exceptions. Add "except *" there? * elif not isinstance(f, bytes): * raise TypeError("feature names must be strings") # <<<<<<<<<<<<<< * h = murmurhash3_bytes_s32(f, 0) * */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "sklearn/feature_extraction/_hashing.pyx":71 + /* "sklearn/feature_extraction/_hashing.pyx":73 * indices_a = np.frombuffer(indices, dtype=np.int32) * else: * indices_a = np.empty(0, dtype=np.int32) # <<<<<<<<<<<<<< * return (indices_a, np.frombuffer(indptr, dtype=np.int32), values[:size]) */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, __pyx_int_0); @@ -4662,14 +4680,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_17)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); - /* "sklearn/feature_extraction/_hashing.pyx":16 + /* "sklearn/feature_extraction/_hashing.pyx":18 * @cython.boundscheck(False) * @cython.cdivision(True) * def transform(raw_X, Py_ssize_t n_features, dtype): # <<<<<<<<<<<<<< * """Guts of FeatureHasher.transform. * */ - __pyx_k_tuple_19 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_19 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_19); __Pyx_INCREF(((PyObject *)__pyx_n_s__raw_X)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__raw_X)); @@ -4714,7 +4732,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__indices_a)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__indices_a)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); - __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(3, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__transform, 16, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(3, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__transform, 18, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -4778,6 +4796,14 @@ PyMODINIT_FUNC PyInit__hashing(void) __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__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.feature_extraction._hashing")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.feature_extraction._hashing", __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); @@ -4843,16 +4869,25 @@ PyMODINIT_FUNC PyInit__hashing(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/feature_extraction/_hashing.pyx":16 + /* "sklearn/feature_extraction/_hashing.pyx":13 + * from sklearn.utils.murmurhash cimport murmurhash3_bytes_s32 + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/feature_extraction/_hashing.pyx":18 * @cython.boundscheck(False) * @cython.cdivision(True) * def transform(raw_X, Py_ssize_t n_features, dtype): # <<<<<<<<<<<<<< * """Guts of FeatureHasher.transform. * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_18feature_extraction_8_hashing_1transform, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_18feature_extraction_8_hashing_1transform, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__transform, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__transform, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/feature_extraction/_hashing.pyx":1 diff --git a/sklearn/feature_extraction/_hashing.pyx b/sklearn/feature_extraction/_hashing.pyx index f2d4ea69bc2ab..859518c05e0a9 100644 --- a/sklearn/feature_extraction/_hashing.pyx +++ b/sklearn/feature_extraction/_hashing.pyx @@ -10,6 +10,8 @@ import numpy as np from sklearn.utils.murmurhash cimport murmurhash3_bytes_s32 +np.import_array() + @cython.boundscheck(False) @cython.cdivision(True) diff --git a/sklearn/linear_model/cd_fast.c b/sklearn/linear_model/cd_fast.c index cf5f0d7dbc087..ddbbeac449326 100644 --- a/sklearn/linear_model/cd_fast.c +++ b/sklearn/linear_model/cd_fast.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.1 on Wed Oct 3 18:52:13 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:31:50 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -53,12 +53,15 @@ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) - #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) @@ -248,12 +251,12 @@ #include #define __PYX_HAVE__sklearn__linear_model__cd_fast #define __PYX_HAVE_API__sklearn__linear_model__cd_fast +#include "math.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "pythread.h" -#include "math.h" #include "cblas.h" #ifdef _OPENMP #include @@ -593,7 +596,7 @@ typedef npy_double __pyx_t_5numpy_double_t; */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* "sklearn/linear_model/cd_fast.pyx":57 +/* "sklearn/linear_model/cd_fast.pyx":60 * * * ctypedef np.float64_t DOUBLE # <<<<<<<<<<<<<< @@ -602,7 +605,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE; -/* "sklearn/linear_model/cd_fast.pyx":58 +/* "sklearn/linear_model/cd_fast.pyx":61 * * ctypedef np.float64_t DOUBLE * ctypedef np.int32_t INTEGER # <<<<<<<<<<<<<< @@ -1084,6 +1087,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from 'libc.math' */ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -1211,7 +1216,7 @@ static char __pyx_k_15[] = "Format string allocated too short, see comment in nu static char __pyx_k_18[] = "Format string allocated too short."; static char __pyx_k_20[] = "numpy.linalg"; static char __pyx_k_21[] = "*"; -static char __pyx_k_24[] = "/home/vanderplas/Opensource/scikit-learn/sklearn/linear_model/cd_fast.pyx"; +static char __pyx_k_24[] = "/scratch/apps/src/scikit-learn/sklearn/linear_model/cd_fast.pyx"; static char __pyx_k_25[] = "sklearn.linear_model.cd_fast"; static char __pyx_k_28[] = "enet_coordinate_descent"; static char __pyx_k_31[] = "sparse_enet_coordinate_descent"; @@ -1443,8 +1448,8 @@ static PyObject *__pyx_k_codeobj_30; static PyObject *__pyx_k_codeobj_33; static PyObject *__pyx_k_codeobj_36; -/* "sklearn/linear_model/cd_fast.pyx":19 - * double sqrt(double f) +/* "sklearn/linear_model/cd_fast.pyx":20 + * * * cdef inline double fmax(double x, double y): # <<<<<<<<<<<<<< * if x > y: @@ -1457,7 +1462,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_7cd_fast_fmax(double int __pyx_t_1; __Pyx_RefNannySetupContext("fmax", 0); - /* "sklearn/linear_model/cd_fast.pyx":20 + /* "sklearn/linear_model/cd_fast.pyx":21 * * cdef inline double fmax(double x, double y): * if x > y: # <<<<<<<<<<<<<< @@ -1467,7 +1472,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_7cd_fast_fmax(double __pyx_t_1 = (__pyx_v_x > __pyx_v_y); if (__pyx_t_1) { - /* "sklearn/linear_model/cd_fast.pyx":21 + /* "sklearn/linear_model/cd_fast.pyx":22 * cdef inline double fmax(double x, double y): * if x > y: * return x # <<<<<<<<<<<<<< @@ -1480,12 +1485,12 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_7cd_fast_fmax(double } __pyx_L3:; - /* "sklearn/linear_model/cd_fast.pyx":22 + /* "sklearn/linear_model/cd_fast.pyx":23 * if x > y: * return x * return y # <<<<<<<<<<<<<< * - * cdef inline double fsign(double f): + * */ __pyx_r = __pyx_v_y; goto __pyx_L0; @@ -1496,8 +1501,8 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_7cd_fast_fmax(double return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":24 - * return y +/* "sklearn/linear_model/cd_fast.pyx":26 + * * * cdef inline double fsign(double f): # <<<<<<<<<<<<<< * if f == 0: @@ -1510,7 +1515,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_7cd_fast_fsign(doubl int __pyx_t_1; __Pyx_RefNannySetupContext("fsign", 0); - /* "sklearn/linear_model/cd_fast.pyx":25 + /* "sklearn/linear_model/cd_fast.pyx":27 * * cdef inline double fsign(double f): * if f == 0: # <<<<<<<<<<<<<< @@ -1520,7 +1525,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_7cd_fast_fsign(doubl __pyx_t_1 = (__pyx_v_f == 0.0); if (__pyx_t_1) { - /* "sklearn/linear_model/cd_fast.pyx":26 + /* "sklearn/linear_model/cd_fast.pyx":28 * cdef inline double fsign(double f): * if f == 0: * return 0 # <<<<<<<<<<<<<< @@ -1532,7 +1537,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_7cd_fast_fsign(doubl goto __pyx_L3; } - /* "sklearn/linear_model/cd_fast.pyx":27 + /* "sklearn/linear_model/cd_fast.pyx":29 * if f == 0: * return 0 * elif f > 0: # <<<<<<<<<<<<<< @@ -1542,7 +1547,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_7cd_fast_fsign(doubl __pyx_t_1 = (__pyx_v_f > 0.0); if (__pyx_t_1) { - /* "sklearn/linear_model/cd_fast.pyx":28 + /* "sklearn/linear_model/cd_fast.pyx":30 * return 0 * elif f > 0: * return 1.0 # <<<<<<<<<<<<<< @@ -1555,12 +1560,12 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_7cd_fast_fsign(doubl } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":30 + /* "sklearn/linear_model/cd_fast.pyx":32 * return 1.0 * else: * return -1.0 # <<<<<<<<<<<<<< * - * cdef extern from "cblas.h": + * */ __pyx_r = -1.0; goto __pyx_L0; @@ -1590,7 +1595,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_1sparse_std(PyObject static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n_samples,&__pyx_n_s__n_features,&__pyx_n_s__X_data,&__pyx_n_s__X_indices,&__pyx_n_s__X_indptr,&__pyx_n_s__X_mean,0}; PyObject* values[6] = {0,0,0,0,0,0}; - /* "sklearn/linear_model/cd_fast.pyx":69 + /* "sklearn/linear_model/cd_fast.pyx":72 * np.ndarray[INTEGER, ndim=1] X_indices, * np.ndarray[INTEGER, ndim=1] X_indptr, * np.ndarray[DOUBLE, ndim=1] X_mean=None): # <<<<<<<<<<<<<< @@ -1619,22 +1624,22 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_1sparse_std(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indptr)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (kw_args > 0) { @@ -1643,7 +1648,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_1sparse_std(PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparse_std") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparse_std") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1657,8 +1662,8 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_1sparse_std(PyObject default: goto __pyx_L5_argtuple_error; } } - __pyx_v_n_samples = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_n_samples == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_n_features = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_n_features == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_samples = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_n_samples == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_features = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_n_features == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X_data = ((PyArrayObject *)values[2]); __pyx_v_X_indices = ((PyArrayObject *)values[3]); __pyx_v_X_indptr = ((PyArrayObject *)values[4]); @@ -1666,16 +1671,16 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_1sparse_std(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_std", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.cd_fast.sparse_std", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_data), __pyx_ptype_5numpy_ndarray, 1, "X_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_mean), __pyx_ptype_5numpy_ndarray, 1, "X_mean", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_data), __pyx_ptype_5numpy_ndarray, 1, "X_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_mean), __pyx_ptype_5numpy_ndarray, 1, "X_mean", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(__pyx_self, __pyx_v_n_samples, __pyx_v_n_features, __pyx_v_X_data, __pyx_v_X_indices, __pyx_v_X_indptr, __pyx_v_X_mean); goto __pyx_L0; __pyx_L1_error:; @@ -1685,7 +1690,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_1sparse_std(PyObject return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":64 +/* "sklearn/linear_model/cd_fast.pyx":67 * @cython.wraparound(False) * @cython.cdivision(True) * def sparse_std(unsigned int n_samples, # <<<<<<<<<<<<<< @@ -1763,45 +1768,45 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU __pyx_pybuffernd_X_mean.rcbuffer = &__pyx_pybuffer_X_mean; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_data, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_data, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_mean.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_mean, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_mean.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_mean, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_mean.diminfo[0].strides = __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_mean.diminfo[0].shape = __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.shape[0]; - /* "sklearn/linear_model/cd_fast.pyx":78 + /* "sklearn/linear_model/cd_fast.pyx":81 * cdef double X_std_ii * * cdef np.ndarray[DOUBLE, ndim = 1] X_std = np.zeros(n_features, np.float64) # <<<<<<<<<<<<<< * * if X_mean is None: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __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 = 81; __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); @@ -1809,17 +1814,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_std.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_X_std = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_std.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X_std.diminfo[0].strides = __pyx_pybuffernd_X_std.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_std.diminfo[0].shape = __pyx_pybuffernd_X_std.rcbuffer->pybuffer.shape[0]; } } @@ -1827,7 +1832,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU __pyx_v_X_std = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/linear_model/cd_fast.pyx":80 + /* "sklearn/linear_model/cd_fast.pyx":83 * cdef np.ndarray[DOUBLE, ndim = 1] X_std = np.zeros(n_features, np.float64) * * if X_mean is None: # <<<<<<<<<<<<<< @@ -1837,26 +1842,26 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU __pyx_t_6 = (((PyObject *)__pyx_v_X_mean) == Py_None); if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":81 + /* "sklearn/linear_model/cd_fast.pyx":84 * * if X_mean is None: * X_mean = np.zeros(n_features, np.float64) # <<<<<<<<<<<<<< * * for ii in xrange(n_features): */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __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(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); @@ -1864,11 +1869,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU __Pyx_GIVEREF(__pyx_t_1); __pyx_t_4 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__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 = 81; __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 = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1884,14 +1889,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU } } __pyx_pybuffernd_X_mean.diminfo[0].strides = __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_mean.diminfo[0].shape = __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_X_mean)); __pyx_v_X_mean = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":83 + /* "sklearn/linear_model/cd_fast.pyx":86 * X_mean = np.zeros(n_features, np.float64) * * for ii in xrange(n_features): # <<<<<<<<<<<<<< @@ -1902,7 +1907,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_ii = __pyx_t_13; - /* "sklearn/linear_model/cd_fast.pyx":85 + /* "sklearn/linear_model/cd_fast.pyx":88 * for ii in xrange(n_features): * # Computes the mean * X_sum_ii = 0.0 # <<<<<<<<<<<<<< @@ -1911,7 +1916,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU */ __pyx_v_X_sum_ii = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":86 + /* "sklearn/linear_model/cd_fast.pyx":89 * # Computes the mean * X_sum_ii = 0.0 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -1924,7 +1929,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU for (__pyx_t_17 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_17 < __pyx_t_15; __pyx_t_17+=1) { __pyx_v_jj = __pyx_t_17; - /* "sklearn/linear_model/cd_fast.pyx":87 + /* "sklearn/linear_model/cd_fast.pyx":90 * X_sum_ii = 0.0 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * X_sum_ii += X_data[jj] # <<<<<<<<<<<<<< @@ -1935,7 +1940,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU __pyx_v_X_sum_ii = (__pyx_v_X_sum_ii + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_X_data.diminfo[0].strides))); } - /* "sklearn/linear_model/cd_fast.pyx":88 + /* "sklearn/linear_model/cd_fast.pyx":91 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * X_sum_ii += X_data[jj] * X_mean[ii] = X_sum_ii / n_samples # <<<<<<<<<<<<<< @@ -1949,7 +1954,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU } __pyx_L3:; - /* "sklearn/linear_model/cd_fast.pyx":90 + /* "sklearn/linear_model/cd_fast.pyx":93 * X_mean[ii] = X_sum_ii / n_samples * * for ii in xrange(n_features): # <<<<<<<<<<<<<< @@ -1960,7 +1965,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_ii = __pyx_t_13; - /* "sklearn/linear_model/cd_fast.pyx":91 + /* "sklearn/linear_model/cd_fast.pyx":94 * * for ii in xrange(n_features): * X_mean_ii = X_mean[ii] # <<<<<<<<<<<<<< @@ -1970,7 +1975,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU __pyx_t_19 = __pyx_v_ii; __pyx_v_X_mean_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_X_mean.diminfo[0].strides)); - /* "sklearn/linear_model/cd_fast.pyx":92 + /* "sklearn/linear_model/cd_fast.pyx":95 * for ii in xrange(n_features): * X_mean_ii = X_mean[ii] * X_sum_ii = 0.0 # <<<<<<<<<<<<<< @@ -1979,7 +1984,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU */ __pyx_v_X_sum_ii = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":93 + /* "sklearn/linear_model/cd_fast.pyx":96 * X_mean_ii = X_mean[ii] * X_sum_ii = 0.0 * nnz_ii = 0 # <<<<<<<<<<<<<< @@ -1988,7 +1993,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU */ __pyx_v_nnz_ii = 0; - /* "sklearn/linear_model/cd_fast.pyx":94 + /* "sklearn/linear_model/cd_fast.pyx":97 * X_sum_ii = 0.0 * nnz_ii = 0 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -2001,7 +2006,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU for (__pyx_t_22 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_22 < __pyx_t_15; __pyx_t_22+=1) { __pyx_v_jj = __pyx_t_22; - /* "sklearn/linear_model/cd_fast.pyx":95 + /* "sklearn/linear_model/cd_fast.pyx":98 * nnz_ii = 0 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * diff = X_data[jj] - X_mean_ii # <<<<<<<<<<<<<< @@ -2011,7 +2016,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU __pyx_t_23 = __pyx_v_jj; __pyx_v_diff = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_X_data.diminfo[0].strides)) - __pyx_v_X_mean_ii); - /* "sklearn/linear_model/cd_fast.pyx":96 + /* "sklearn/linear_model/cd_fast.pyx":99 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * diff = X_data[jj] - X_mean_ii * X_sum_ii += diff * diff # <<<<<<<<<<<<<< @@ -2020,7 +2025,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU */ __pyx_v_X_sum_ii = (__pyx_v_X_sum_ii + (__pyx_v_diff * __pyx_v_diff)); - /* "sklearn/linear_model/cd_fast.pyx":97 + /* "sklearn/linear_model/cd_fast.pyx":100 * diff = X_data[jj] - X_mean_ii * X_sum_ii += diff * diff * nnz_ii += 1 # <<<<<<<<<<<<<< @@ -2030,7 +2035,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU __pyx_v_nnz_ii = (__pyx_v_nnz_ii + 1); } - /* "sklearn/linear_model/cd_fast.pyx":99 + /* "sklearn/linear_model/cd_fast.pyx":102 * nnz_ii += 1 * * X_std[ii] = (X_sum_ii + (n_samples - nnz_ii) * X_mean_ii * X_mean_ii) # <<<<<<<<<<<<<< @@ -2041,7 +2046,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_std.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_X_std.diminfo[0].strides) = (__pyx_v_X_sum_ii + (((__pyx_v_n_samples - __pyx_v_nnz_ii) * __pyx_v_X_mean_ii) * __pyx_v_X_mean_ii)); } - /* "sklearn/linear_model/cd_fast.pyx":100 + /* "sklearn/linear_model/cd_fast.pyx":103 * * X_std[ii] = (X_sum_ii + (n_samples - nnz_ii) * X_mean_ii * X_mean_ii) * return np.sqrt(X_std) # <<<<<<<<<<<<<< @@ -2049,17 +2054,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_sparse_std(CYTHON_UNU * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sqrt); 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); __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 = 100; __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_X_std)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_X_std)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X_std)); - __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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; @@ -2142,32 +2147,32 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_3enet_coordinate_desc case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_iter)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tol)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (kw_args > 0) { @@ -2176,7 +2181,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_3enet_coordinate_desc } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "enet_coordinate_descent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "enet_coordinate_descent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2193,26 +2198,26 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_3enet_coordinate_desc } } __pyx_v_w = ((PyArrayObject *)values[0]); - __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X = ((PyArrayObject *)values[3]); __pyx_v_y = ((PyArrayObject *)values[4]); - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_positive = ((PyBoolObject *)values[7]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.cd_fast.enet_coordinate_descent", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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 = 108; __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_positive), __pyx_ptype_7cpython_4bool_bool, 1, "positive", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __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 = 111; __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_positive), __pyx_ptype_7cpython_4bool_bool, 1, "positive", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_descent(__pyx_self, __pyx_v_w, __pyx_v_alpha, __pyx_v_beta, __pyx_v_X, __pyx_v_y, __pyx_v_max_iter, __pyx_v_tol, __pyx_v_positive); goto __pyx_L0; __pyx_L1_error:; @@ -2222,7 +2227,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_3enet_coordinate_desc return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":106 +/* "sklearn/linear_model/cd_fast.pyx":109 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< @@ -2317,21 +2322,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; { __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __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]; - /* "sklearn/linear_model/cd_fast.pyx":123 + /* "sklearn/linear_model/cd_fast.pyx":126 * * # get the data information into easy vars * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -2340,7 +2345,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":124 + /* "sklearn/linear_model/cd_fast.pyx":127 * # get the data information into easy vars * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -2349,32 +2354,32 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_n_features = (__pyx_v_X->dimensions[1]); - /* "sklearn/linear_model/cd_fast.pyx":127 + /* "sklearn/linear_model/cd_fast.pyx":130 * * # compute norms of the columns of X * cdef np.ndarray[DOUBLE, ndim=1] norm_cols_X = (X**2).sum(axis=0) # <<<<<<<<<<<<<< * * # initial value of the residuals */ - __pyx_t_1 = PyNumber_Power(((PyObject *)__pyx_v_X), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(((PyObject *)__pyx_v_X), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __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; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_norm_cols_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_norm_cols_X.diminfo[0].strides = __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norm_cols_X.diminfo[0].shape = __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.shape[0]; } } @@ -2382,7 +2387,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_v_norm_cols_X = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":137 + /* "sklearn/linear_model/cd_fast.pyx":140 * cdef double w_max * cdef double d_w_ii * cdef double gap = tol + 1.0 # <<<<<<<<<<<<<< @@ -2391,7 +2396,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_gap = (__pyx_v_tol + 1.0); - /* "sklearn/linear_model/cd_fast.pyx":138 + /* "sklearn/linear_model/cd_fast.pyx":141 * cdef double d_w_ii * cdef double gap = tol + 1.0 * cdef double d_w_tol = tol # <<<<<<<<<<<<<< @@ -2400,7 +2405,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_d_w_tol = __pyx_v_tol; - /* "sklearn/linear_model/cd_fast.pyx":142 + /* "sklearn/linear_model/cd_fast.pyx":145 * cdef unsigned int n_iter * * if alpha == 0: # <<<<<<<<<<<<<< @@ -2410,19 +2415,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_5 = (__pyx_v_alpha == 0.0); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":143 + /* "sklearn/linear_model/cd_fast.pyx":146 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __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; @@ -2430,19 +2435,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } __pyx_L3:; - /* "sklearn/linear_model/cd_fast.pyx":146 + /* "sklearn/linear_model/cd_fast.pyx":149 * " results and is discouraged.") * * R = y - np.dot(X, w) # <<<<<<<<<<<<<< * * tol = tol * np.dot(y, y) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __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 = 149; __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)); @@ -2450,14 +2455,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __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_3 = PyNumber_Subtract(((PyObject *)__pyx_v_y), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_y), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2473,27 +2478,27 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } } __pyx_pybuffernd_R.diminfo[0].strides = __pyx_pybuffernd_R.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_R.diminfo[0].shape = __pyx_pybuffernd_R.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __pyx_v_R = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":148 + /* "sklearn/linear_model/cd_fast.pyx":151 * R = y - np.dot(X, w) * * tol = tol * np.dot(y, y) # <<<<<<<<<<<<<< * * for n_iter in range(max_iter): */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __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(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y)); @@ -2501,19 +2506,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_tol = __pyx_t_12; - /* "sklearn/linear_model/cd_fast.pyx":150 + /* "sklearn/linear_model/cd_fast.pyx":153 * tol = tol * np.dot(y, y) * * for n_iter in range(max_iter): # <<<<<<<<<<<<<< @@ -2524,7 +2529,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_7; __pyx_t_13+=1) { __pyx_v_n_iter = __pyx_t_13; - /* "sklearn/linear_model/cd_fast.pyx":151 + /* "sklearn/linear_model/cd_fast.pyx":154 * * for n_iter in range(max_iter): * w_max = 0.0 # <<<<<<<<<<<<<< @@ -2533,7 +2538,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":152 + /* "sklearn/linear_model/cd_fast.pyx":155 * for n_iter in range(max_iter): * w_max = 0.0 * d_w_max = 0.0 # <<<<<<<<<<<<<< @@ -2542,7 +2547,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_d_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":153 + /* "sklearn/linear_model/cd_fast.pyx":156 * w_max = 0.0 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates # <<<<<<<<<<<<<< @@ -2553,7 +2558,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_ii = __pyx_t_15; - /* "sklearn/linear_model/cd_fast.pyx":154 + /* "sklearn/linear_model/cd_fast.pyx":157 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates * if norm_cols_X[ii] == 0.0: # <<<<<<<<<<<<<< @@ -2564,7 +2569,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_norm_cols_X.diminfo[0].strides)) == 0.0); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":155 + /* "sklearn/linear_model/cd_fast.pyx":158 * for ii in xrange(n_features): # Loop over coordinates * if norm_cols_X[ii] == 0.0: * continue # <<<<<<<<<<<<<< @@ -2576,7 +2581,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } __pyx_L8:; - /* "sklearn/linear_model/cd_fast.pyx":157 + /* "sklearn/linear_model/cd_fast.pyx":160 * continue * * w_ii = w[ii] # Store previous value # <<<<<<<<<<<<<< @@ -2586,7 +2591,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_17 = __pyx_v_ii; __pyx_v_w_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_w.diminfo[0].strides)); - /* "sklearn/linear_model/cd_fast.pyx":159 + /* "sklearn/linear_model/cd_fast.pyx":162 * w_ii = w[ii] # Store previous value * * if w_ii != 0.0: # <<<<<<<<<<<<<< @@ -2596,7 +2601,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_5 = (__pyx_v_w_ii != 0.0); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":163 + /* "sklearn/linear_model/cd_fast.pyx":166 * daxpy(n_samples, w_ii, * (X.data + ii * n_samples * sizeof(DOUBLE)), 1, * R.data, 1) # <<<<<<<<<<<<<< @@ -2608,7 +2613,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } __pyx_L9:; - /* "sklearn/linear_model/cd_fast.pyx":168 + /* "sklearn/linear_model/cd_fast.pyx":171 * tmp = ddot(n_samples, * (X.data + ii * n_samples * sizeof(DOUBLE)), 1, * R.data, 1) # <<<<<<<<<<<<<< @@ -2617,14 +2622,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_tmp = cblas_ddot(__pyx_v_n_samples, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)(__pyx_v_X->data + ((__pyx_v_ii * __pyx_v_n_samples) * (sizeof(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE))))), 1, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_R->data), 1); - /* "sklearn/linear_model/cd_fast.pyx":170 + /* "sklearn/linear_model/cd_fast.pyx":173 * R.data, 1) * * if positive and tmp < 0: # <<<<<<<<<<<<<< * w[ii] = 0.0 * else: */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { __pyx_t_18 = (__pyx_v_tmp < 0.0); __pyx_t_19 = __pyx_t_18; @@ -2633,7 +2638,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } if (__pyx_t_19) { - /* "sklearn/linear_model/cd_fast.pyx":171 + /* "sklearn/linear_model/cd_fast.pyx":174 * * if positive and tmp < 0: * w[ii] = 0.0 # <<<<<<<<<<<<<< @@ -2646,7 +2651,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":174 + /* "sklearn/linear_model/cd_fast.pyx":177 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ * / (norm_cols_X[ii] + beta) # <<<<<<<<<<<<<< @@ -2655,7 +2660,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_t_21 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":173 + /* "sklearn/linear_model/cd_fast.pyx":176 * w[ii] = 0.0 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ # <<<<<<<<<<<<<< @@ -2667,7 +2672,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } __pyx_L10:; - /* "sklearn/linear_model/cd_fast.pyx":176 + /* "sklearn/linear_model/cd_fast.pyx":179 * / (norm_cols_X[ii] + beta) * * if w[ii] != 0.0: # <<<<<<<<<<<<<< @@ -2678,7 +2683,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_19 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_w.diminfo[0].strides)) != 0.0); if (__pyx_t_19) { - /* "sklearn/linear_model/cd_fast.pyx":178 + /* "sklearn/linear_model/cd_fast.pyx":181 * if w[ii] != 0.0: * # R -= w[ii] * X[:,ii] # Update residual * daxpy(n_samples, -w[ii], # <<<<<<<<<<<<<< @@ -2687,7 +2692,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_t_24 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":180 + /* "sklearn/linear_model/cd_fast.pyx":183 * daxpy(n_samples, -w[ii], * (X.data + ii * n_samples * sizeof(DOUBLE)), 1, * R.data, 1) # <<<<<<<<<<<<<< @@ -2699,7 +2704,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } __pyx_L11:; - /* "sklearn/linear_model/cd_fast.pyx":183 + /* "sklearn/linear_model/cd_fast.pyx":186 * * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) # <<<<<<<<<<<<<< @@ -2709,7 +2714,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_25 = __pyx_v_ii; __pyx_v_d_w_ii = fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_w.diminfo[0].strides)) - __pyx_v_w_ii)); - /* "sklearn/linear_model/cd_fast.pyx":184 + /* "sklearn/linear_model/cd_fast.pyx":187 * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: # <<<<<<<<<<<<<< @@ -2719,7 +2724,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_19 = (__pyx_v_d_w_ii > __pyx_v_d_w_max); if (__pyx_t_19) { - /* "sklearn/linear_model/cd_fast.pyx":185 + /* "sklearn/linear_model/cd_fast.pyx":188 * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: * d_w_max = d_w_ii # <<<<<<<<<<<<<< @@ -2731,7 +2736,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } __pyx_L12:; - /* "sklearn/linear_model/cd_fast.pyx":187 + /* "sklearn/linear_model/cd_fast.pyx":190 * d_w_max = d_w_ii * * if fabs(w[ii]) > w_max: # <<<<<<<<<<<<<< @@ -2742,7 +2747,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_19 = (fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_w.diminfo[0].strides))) > __pyx_v_w_max); if (__pyx_t_19) { - /* "sklearn/linear_model/cd_fast.pyx":188 + /* "sklearn/linear_model/cd_fast.pyx":191 * * if fabs(w[ii]) > w_max: * w_max = fabs(w[ii]) # <<<<<<<<<<<<<< @@ -2757,7 +2762,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_L6_continue:; } - /* "sklearn/linear_model/cd_fast.pyx":190 + /* "sklearn/linear_model/cd_fast.pyx":193 * w_max = fabs(w[ii]) * * if w_max == 0.0 or d_w_max / w_max < d_w_tol or n_iter == max_iter - 1: # <<<<<<<<<<<<<< @@ -2779,21 +2784,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":195 + /* "sklearn/linear_model/cd_fast.pyx":198 * # criterion * * XtA = np.dot(X.T, R) - beta * w # <<<<<<<<<<<<<< * if positive: * dual_norm_XtA = np.max(XtA) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); 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_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __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 = 198; __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); @@ -2801,16 +2806,16 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_R)); __Pyx_GIVEREF(((PyObject *)__pyx_v_R)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); 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_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; @@ -2818,34 +2823,34 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_v_XtA = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":196 + /* "sklearn/linear_model/cd_fast.pyx":199 * * XtA = np.dot(X.T, R) - beta * w * if positive: # <<<<<<<<<<<<<< * dual_norm_XtA = np.max(XtA) * else: */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":197 + /* "sklearn/linear_model/cd_fast.pyx":200 * XtA = np.dot(X.T, R) - beta * w * if positive: * dual_norm_XtA = np.max(XtA) # <<<<<<<<<<<<<< * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __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 = 197; __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 = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_XtA); __Pyx_GIVEREF(__pyx_v_XtA); - __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -2856,24 +2861,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":199 + /* "sklearn/linear_model/cd_fast.pyx":202 * dual_norm_XtA = np.max(XtA) * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) # <<<<<<<<<<<<<< * * R_norm2 = np.dot(R, R) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_XtA); @@ -2881,7 +2886,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -2891,19 +2896,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } __pyx_L15:; - /* "sklearn/linear_model/cd_fast.pyx":201 + /* "sklearn/linear_model/cd_fast.pyx":204 * dual_norm_XtA = linalg.norm(XtA, np.inf) * * R_norm2 = np.dot(R, R) # <<<<<<<<<<<<<< * w_norm2 = np.dot(w, w) * if (dual_norm_XtA > alpha): */ - __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(((PyObject *)__pyx_v_R)); PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_R)); @@ -2911,7 +2916,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_R)); PyTuple_SET_ITEM(__pyx_t_11, 1, ((PyObject *)__pyx_v_R)); __Pyx_GIVEREF(((PyObject *)__pyx_v_R)); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __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_11)); __pyx_t_11 = 0; @@ -2919,19 +2924,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_v_R_norm2 = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":202 + /* "sklearn/linear_model/cd_fast.pyx":205 * * R_norm2 = np.dot(R, R) * w_norm2 = np.dot(w, w) # <<<<<<<<<<<<<< * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __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 = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_w)); @@ -2939,7 +2944,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -2947,117 +2952,117 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_v_w_norm2 = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":203 + /* "sklearn/linear_model/cd_fast.pyx":206 * R_norm2 = np.dot(R, R) * w_norm2 = np.dot(w, w) * if (dual_norm_XtA > alpha): # <<<<<<<<<<<<<< * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * (const**2) */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":204 + /* "sklearn/linear_model/cd_fast.pyx":207 * w_norm2 = np.dot(w, w) * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA # <<<<<<<<<<<<<< * A_norm2 = R_norm2 * (const**2) * gap = 0.5 * (R_norm2 + A_norm2) */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":205 + /* "sklearn/linear_model/cd_fast.pyx":208 * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * (const**2) # <<<<<<<<<<<<<< * gap = 0.5 * (R_norm2 + A_norm2) * else: */ - __pyx_t_2 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_R_norm2, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_v_R_norm2, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_v_A_norm2); __pyx_v_A_norm2 = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":206 + /* "sklearn/linear_model/cd_fast.pyx":209 * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * (const**2) * gap = 0.5 * (R_norm2 + A_norm2) # <<<<<<<<<<<<<< * else: * const = 1.0 */ - __pyx_t_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Add(__pyx_v_R_norm2, __pyx_v_A_norm2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_v_R_norm2, __pyx_v_A_norm2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_v_gap = __pyx_t_12; goto __pyx_L16; } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":208 + /* "sklearn/linear_model/cd_fast.pyx":211 * gap = 0.5 * (R_norm2 + A_norm2) * else: * const = 1.0 # <<<<<<<<<<<<<< * gap = R_norm2 * */ - __pyx_t_11 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_11; __pyx_t_11 = 0; - /* "sklearn/linear_model/cd_fast.pyx":209 + /* "sklearn/linear_model/cd_fast.pyx":212 * else: * const = 1.0 * gap = R_norm2 # <<<<<<<<<<<<<< * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ */ - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_R_norm2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_R_norm2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_gap = __pyx_t_12; } __pyx_L16:; - /* "sklearn/linear_model/cd_fast.pyx":211 + /* "sklearn/linear_model/cd_fast.pyx":214 * gap = R_norm2 * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ # <<<<<<<<<<<<<< * 0.5 * beta * (1 + const ** 2) * (w_norm2) * */ - __pyx_t_11 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_w)); @@ -3065,22 +3070,22 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_29 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_29); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_29); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_29, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_29, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__T); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__T); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_29); __Pyx_GIVEREF(__pyx_t_29); @@ -3088,52 +3093,52 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); __pyx_t_29 = 0; - __pyx_t_29 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_v_const, __pyx_t_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_v_const, __pyx_t_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":212 + /* "sklearn/linear_model/cd_fast.pyx":215 * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ * 0.5 * beta * (1 + const ** 2) * (w_norm2) # <<<<<<<<<<<<<< * * if gap < tol: */ - __pyx_t_1 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __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[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_w_norm2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_w_norm2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_29, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_t_29, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_gap = __pyx_t_12; - /* "sklearn/linear_model/cd_fast.pyx":214 + /* "sklearn/linear_model/cd_fast.pyx":217 * 0.5 * beta * (1 + const ** 2) * (w_norm2) * * if gap < tol: # <<<<<<<<<<<<<< @@ -3143,7 +3148,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_5 = (__pyx_v_gap < __pyx_v_tol); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":216 + /* "sklearn/linear_model/cd_fast.pyx":219 * if gap < tol: * # return if we reached desired tolerance * break # <<<<<<<<<<<<<< @@ -3160,7 +3165,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } __pyx_L5_break:; - /* "sklearn/linear_model/cd_fast.pyx":218 + /* "sklearn/linear_model/cd_fast.pyx":221 * break * * return w, gap, tol # <<<<<<<<<<<<<< @@ -3168,11 +3173,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_w)); @@ -3274,47 +3279,47 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_5sparse_enet_coordina case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indptr)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_mean)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_iter)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tol)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 10: if (kw_args > 0) { @@ -3323,7 +3328,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_5sparse_enet_coordina } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparse_enet_coordinate_descent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sparse_enet_coordinate_descent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3343,20 +3348,20 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_5sparse_enet_coordina } } __pyx_v_w = ((PyArrayObject *)values[0]); - __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X_data = ((PyArrayObject *)values[3]); __pyx_v_X_indices = ((PyArrayObject *)values[4]); __pyx_v_X_indptr = ((PyArrayObject *)values[5]); __pyx_v_y = ((PyArrayObject *)values[6]); __pyx_v_X_mean = ((PyArrayObject *)values[7]); - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[10]) { - __pyx_v_positive = __Pyx_PyObject_IsTrue(values[10]); if (unlikely((__pyx_v_positive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_positive = __Pyx_PyObject_IsTrue(values[10]); if (unlikely((__pyx_v_positive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/linear_model/cd_fast.pyx":231 + /* "sklearn/linear_model/cd_fast.pyx":234 * np.ndarray[DOUBLE, ndim=1] y, * np.ndarray[DOUBLE, ndim=1] X_mean, * int max_iter, double tol, bint positive=False): # <<<<<<<<<<<<<< @@ -3368,18 +3373,18 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_5sparse_enet_coordina } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.cd_fast.sparse_enet_coordinate_descent", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_data), __pyx_ptype_5numpy_ndarray, 1, "X_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __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 = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_mean), __pyx_ptype_5numpy_ndarray, 1, "X_mean", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_data), __pyx_ptype_5numpy_ndarray, 1, "X_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_mean), __pyx_ptype_5numpy_ndarray, 1, "X_mean", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordinate_descent(__pyx_self, __pyx_v_w, __pyx_v_alpha, __pyx_v_beta, __pyx_v_X_data, __pyx_v_X_indices, __pyx_v_X_indptr, __pyx_v_y, __pyx_v_X_mean, __pyx_v_max_iter, __pyx_v_tol, __pyx_v_positive); goto __pyx_L0; __pyx_L1_error:; @@ -3389,7 +3394,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_5sparse_enet_coordina return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":224 +/* "sklearn/linear_model/cd_fast.pyx":227 * @cython.wraparound(False) * @cython.cdivision(True) * def sparse_enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< @@ -3552,36 +3557,36 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_pybuffernd_X_mean.rcbuffer = &__pyx_pybuffer_X_mean; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_data, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_data, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; { __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __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_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_mean.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_mean, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_mean.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_mean, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_mean.diminfo[0].strides = __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_mean.diminfo[0].shape = __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.shape[0]; - /* "sklearn/linear_model/cd_fast.pyx":243 + /* "sklearn/linear_model/cd_fast.pyx":246 * * # get the data information into easy vars * cdef unsigned int n_samples = y.shape[0] # <<<<<<<<<<<<<< @@ -3590,7 +3595,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_v_n_samples = (__pyx_v_y->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":244 + /* "sklearn/linear_model/cd_fast.pyx":247 * # get the data information into easy vars * cdef unsigned int n_samples = y.shape[0] * cdef unsigned int n_features = w.shape[0] # <<<<<<<<<<<<<< @@ -3599,34 +3604,34 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_v_n_features = (__pyx_v_w->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":248 + /* "sklearn/linear_model/cd_fast.pyx":251 * # compute norms of the columns of X * cdef unsigned int ii * cdef np.ndarray[DOUBLE, ndim = 1] norm_cols_X = np.zeros(n_features, # <<<<<<<<<<<<<< * np.float64) * for ii in xrange(n_features): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/linear_model/cd_fast.pyx":249 + /* "sklearn/linear_model/cd_fast.pyx":252 * cdef unsigned int ii * cdef np.ndarray[DOUBLE, ndim = 1] norm_cols_X = np.zeros(n_features, * np.float64) # <<<<<<<<<<<<<< * for ii in xrange(n_features): * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __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 = 251; __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); @@ -3634,17 +3639,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_norm_cols_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_norm_cols_X.diminfo[0].strides = __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norm_cols_X.diminfo[0].shape = __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.shape[0]; } } @@ -3652,7 +3657,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_v_norm_cols_X = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/linear_model/cd_fast.pyx":250 + /* "sklearn/linear_model/cd_fast.pyx":253 * cdef np.ndarray[DOUBLE, ndim = 1] norm_cols_X = np.zeros(n_features, * np.float64) * for ii in xrange(n_features): # <<<<<<<<<<<<<< @@ -3663,7 +3668,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_ii = __pyx_t_7; - /* "sklearn/linear_model/cd_fast.pyx":251 + /* "sklearn/linear_model/cd_fast.pyx":254 * np.float64) * for ii in xrange(n_features): * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ # <<<<<<<<<<<<<< @@ -3672,10 +3677,10 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_t_8 = __pyx_v_ii; __pyx_t_9 = (__pyx_v_ii + 1); - __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_X_data), (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X_indptr.diminfo[0].strides)), (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_X_indptr.diminfo[0].strides))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_X_data), (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X_indptr.diminfo[0].strides)), (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_X_indptr.diminfo[0].strides))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - /* "sklearn/linear_model/cd_fast.pyx":252 + /* "sklearn/linear_model/cd_fast.pyx":255 * for ii in xrange(n_features): * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ * X_mean[ii]) ** 2).sum() + \ # <<<<<<<<<<<<<< @@ -3683,23 +3688,23 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina * */ __pyx_t_10 = __pyx_v_ii; - __pyx_t_3 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_X_mean.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_X_mean.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":253 + /* "sklearn/linear_model/cd_fast.pyx":256 * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ * X_mean[ii]) ** 2).sum() + \ * (n_samples - X_indptr[ii + 1] + X_indptr[ii]) * X_mean[ii] ** 2 # <<<<<<<<<<<<<< @@ -3709,16 +3714,16 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_11 = (__pyx_v_ii + 1); __pyx_t_12 = __pyx_v_ii; __pyx_t_13 = __pyx_v_ii; - __pyx_t_2 = PyFloat_FromDouble((((__pyx_v_n_samples - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_X_indptr.diminfo[0].strides))) + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X_indptr.diminfo[0].strides))) * pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_X_mean.diminfo[0].strides)), 2.0))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((((__pyx_v_n_samples - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_X_indptr.diminfo[0].strides))) + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X_indptr.diminfo[0].strides))) * pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_X_mean.diminfo[0].strides)), 2.0))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/linear_model/cd_fast.pyx":251 + /* "sklearn/linear_model/cd_fast.pyx":254 * np.float64) * for ii in xrange(n_features): * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ # <<<<<<<<<<<<<< @@ -3729,7 +3734,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_norm_cols_X.diminfo[0].strides) = __pyx_t_14; } - /* "sklearn/linear_model/cd_fast.pyx":265 + /* "sklearn/linear_model/cd_fast.pyx":268 * cdef double X_mean_ii * cdef double R_sum * cdef double gap = tol + 1.0 # <<<<<<<<<<<<<< @@ -3738,7 +3743,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_v_gap = (__pyx_v_tol + 1.0); - /* "sklearn/linear_model/cd_fast.pyx":266 + /* "sklearn/linear_model/cd_fast.pyx":269 * cdef double R_sum * cdef double gap = tol + 1.0 * cdef double d_w_tol = tol # <<<<<<<<<<<<<< @@ -3747,37 +3752,37 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_v_d_w_tol = __pyx_v_tol; - /* "sklearn/linear_model/cd_fast.pyx":269 + /* "sklearn/linear_model/cd_fast.pyx":272 * cdef unsigned int jj * cdef unsigned int n_iter * cdef bint center = (X_mean != 0).any() # <<<<<<<<<<<<<< * * # initialize the residuals */ - __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_X_mean), __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_X_mean), __pyx_int_0, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_center = __pyx_t_16; - /* "sklearn/linear_model/cd_fast.pyx":272 + /* "sklearn/linear_model/cd_fast.pyx":275 * * # initialize the residuals * R = y.copy() # <<<<<<<<<<<<<< * * for ii in xrange(n_features): */ - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -3793,13 +3798,13 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } } __pyx_pybuffernd_R.diminfo[0].strides = __pyx_pybuffernd_R.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_R.diminfo[0].shape = __pyx_pybuffernd_R.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __pyx_v_R = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":274 + /* "sklearn/linear_model/cd_fast.pyx":277 * R = y.copy() * * for ii in xrange(n_features): # <<<<<<<<<<<<<< @@ -3810,7 +3815,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_ii = __pyx_t_7; - /* "sklearn/linear_model/cd_fast.pyx":276 + /* "sklearn/linear_model/cd_fast.pyx":279 * for ii in xrange(n_features): * # sparse X column / dense w dot product * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -3823,7 +3828,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_25 < __pyx_t_23; __pyx_t_25+=1) { __pyx_v_jj = __pyx_t_25; - /* "sklearn/linear_model/cd_fast.pyx":277 + /* "sklearn/linear_model/cd_fast.pyx":280 * # sparse X column / dense w dot product * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] -= X_data[jj] * w[ii] # <<<<<<<<<<<<<< @@ -3837,7 +3842,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_R.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_R.diminfo[0].strides) -= ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_X_data.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_w.diminfo[0].strides))); } - /* "sklearn/linear_model/cd_fast.pyx":278 + /* "sklearn/linear_model/cd_fast.pyx":281 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] -= X_data[jj] * w[ii] * if center: # <<<<<<<<<<<<<< @@ -3846,7 +3851,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ if (__pyx_v_center) { - /* "sklearn/linear_model/cd_fast.pyx":279 + /* "sklearn/linear_model/cd_fast.pyx":282 * R[X_indices[jj]] -= X_data[jj] * w[ii] * if center: * R += X_mean[ii] * w[ii] # <<<<<<<<<<<<<< @@ -3855,12 +3860,12 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_t_25 = __pyx_v_ii; __pyx_t_30 = __pyx_v_ii; - __pyx_t_2 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_X_mean.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_w.diminfo[0].strides)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_X_mean.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_w.diminfo[0].strides)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_R), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_R), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -3876,7 +3881,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } } __pyx_pybuffernd_R.diminfo[0].strides = __pyx_pybuffernd_R.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_R.diminfo[0].shape = __pyx_pybuffernd_R.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_R)); @@ -3887,21 +3892,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_L9:; } - /* "sklearn/linear_model/cd_fast.pyx":281 + /* "sklearn/linear_model/cd_fast.pyx":284 * R += X_mean[ii] * w[ii] * * tol = tol * np.dot(y, y) # <<<<<<<<<<<<<< * * for n_iter in range(max_iter): */ - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y)); @@ -3909,19 +3914,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_tol = __pyx_t_31; - /* "sklearn/linear_model/cd_fast.pyx":283 + /* "sklearn/linear_model/cd_fast.pyx":286 * tol = tol * np.dot(y, y) * * for n_iter in range(max_iter): # <<<<<<<<<<<<<< @@ -3932,7 +3937,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_18; __pyx_t_6+=1) { __pyx_v_n_iter = __pyx_t_6; - /* "sklearn/linear_model/cd_fast.pyx":285 + /* "sklearn/linear_model/cd_fast.pyx":288 * for n_iter in range(max_iter): * * w_max = 0.0 # <<<<<<<<<<<<<< @@ -3941,7 +3946,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_v_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":286 + /* "sklearn/linear_model/cd_fast.pyx":289 * * w_max = 0.0 * d_w_max = 0.0 # <<<<<<<<<<<<<< @@ -3950,7 +3955,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_v_d_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":288 + /* "sklearn/linear_model/cd_fast.pyx":291 * d_w_max = 0.0 * * for ii in xrange(n_features): # Loop over coordinates # <<<<<<<<<<<<<< @@ -3961,7 +3966,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_7; __pyx_t_32+=1) { __pyx_v_ii = __pyx_t_32; - /* "sklearn/linear_model/cd_fast.pyx":290 + /* "sklearn/linear_model/cd_fast.pyx":293 * for ii in xrange(n_features): # Loop over coordinates * * if norm_cols_X[ii] == 0.0: # <<<<<<<<<<<<<< @@ -3972,7 +3977,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_norm_cols_X.diminfo[0].strides)) == 0.0); if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":291 + /* "sklearn/linear_model/cd_fast.pyx":294 * * if norm_cols_X[ii] == 0.0: * continue # <<<<<<<<<<<<<< @@ -3984,7 +3989,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } __pyx_L14:; - /* "sklearn/linear_model/cd_fast.pyx":293 + /* "sklearn/linear_model/cd_fast.pyx":296 * continue * * w_ii = w[ii] # Store previous value # <<<<<<<<<<<<<< @@ -3994,7 +3999,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_34 = __pyx_v_ii; __pyx_v_w_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_w.diminfo[0].strides)); - /* "sklearn/linear_model/cd_fast.pyx":294 + /* "sklearn/linear_model/cd_fast.pyx":297 * * w_ii = w[ii] # Store previous value * X_mean_ii = X_mean[ii] # <<<<<<<<<<<<<< @@ -4004,7 +4009,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_35 = __pyx_v_ii; __pyx_v_X_mean_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_X_mean.diminfo[0].strides)); - /* "sklearn/linear_model/cd_fast.pyx":296 + /* "sklearn/linear_model/cd_fast.pyx":299 * X_mean_ii = X_mean[ii] * * if w_ii != 0.0: # <<<<<<<<<<<<<< @@ -4014,7 +4019,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_16 = (__pyx_v_w_ii != 0.0); if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":298 + /* "sklearn/linear_model/cd_fast.pyx":301 * if w_ii != 0.0: * # R += w_ii * X[:,ii] * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -4027,7 +4032,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_38 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_38 < __pyx_t_23; __pyx_t_38+=1) { __pyx_v_jj = __pyx_t_38; - /* "sklearn/linear_model/cd_fast.pyx":299 + /* "sklearn/linear_model/cd_fast.pyx":302 * # R += w_ii * X[:,ii] * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] += X_data[jj] * w_ii # <<<<<<<<<<<<<< @@ -4040,7 +4045,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_R.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_R.diminfo[0].strides) += ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_X_data.diminfo[0].strides)) * __pyx_v_w_ii); } - /* "sklearn/linear_model/cd_fast.pyx":300 + /* "sklearn/linear_model/cd_fast.pyx":303 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] += X_data[jj] * w_ii * if center: # <<<<<<<<<<<<<< @@ -4049,7 +4054,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ if (__pyx_v_center) { - /* "sklearn/linear_model/cd_fast.pyx":301 + /* "sklearn/linear_model/cd_fast.pyx":304 * R[X_indices[jj]] += X_data[jj] * w_ii * if center: * for jj in xrange(n_samples): # <<<<<<<<<<<<<< @@ -4060,7 +4065,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_42 = 0; __pyx_t_42 < __pyx_t_38; __pyx_t_42+=1) { __pyx_v_jj = __pyx_t_42; - /* "sklearn/linear_model/cd_fast.pyx":302 + /* "sklearn/linear_model/cd_fast.pyx":305 * if center: * for jj in xrange(n_samples): * R[jj] -= X_mean_ii * w[ii] # <<<<<<<<<<<<<< @@ -4078,7 +4083,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } __pyx_L15:; - /* "sklearn/linear_model/cd_fast.pyx":305 + /* "sklearn/linear_model/cd_fast.pyx":308 * * # tmp = (X[:,ii] * R).sum() * tmp = 0.0 # <<<<<<<<<<<<<< @@ -4087,7 +4092,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_v_tmp = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":306 + /* "sklearn/linear_model/cd_fast.pyx":309 * # tmp = (X[:,ii] * R).sum() * tmp = 0.0 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -4100,7 +4105,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_42 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_42 < __pyx_t_23; __pyx_t_42+=1) { __pyx_v_jj = __pyx_t_42; - /* "sklearn/linear_model/cd_fast.pyx":307 + /* "sklearn/linear_model/cd_fast.pyx":310 * tmp = 0.0 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * tmp += R[X_indices[jj]] * X_data[jj] # <<<<<<<<<<<<<< @@ -4113,7 +4118,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_v_tmp = (__pyx_v_tmp + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_R.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_R.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_X_data.diminfo[0].strides)))); } - /* "sklearn/linear_model/cd_fast.pyx":309 + /* "sklearn/linear_model/cd_fast.pyx":312 * tmp += R[X_indices[jj]] * X_data[jj] * * if center: # <<<<<<<<<<<<<< @@ -4122,7 +4127,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ if (__pyx_v_center) { - /* "sklearn/linear_model/cd_fast.pyx":310 + /* "sklearn/linear_model/cd_fast.pyx":313 * * if center: * R_sum = 0.0 # <<<<<<<<<<<<<< @@ -4131,7 +4136,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_v_R_sum = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":311 + /* "sklearn/linear_model/cd_fast.pyx":314 * if center: * R_sum = 0.0 * for jj in xrange(n_samples): # <<<<<<<<<<<<<< @@ -4142,7 +4147,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_49 = 0; __pyx_t_49 < __pyx_t_42; __pyx_t_49+=1) { __pyx_v_jj = __pyx_t_49; - /* "sklearn/linear_model/cd_fast.pyx":312 + /* "sklearn/linear_model/cd_fast.pyx":315 * R_sum = 0.0 * for jj in xrange(n_samples): * R_sum += R[jj] # <<<<<<<<<<<<<< @@ -4153,7 +4158,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_v_R_sum = (__pyx_v_R_sum + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_R.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_R.diminfo[0].strides))); } - /* "sklearn/linear_model/cd_fast.pyx":313 + /* "sklearn/linear_model/cd_fast.pyx":316 * for jj in xrange(n_samples): * R_sum += R[jj] * tmp -= R_sum * X_mean_ii # <<<<<<<<<<<<<< @@ -4165,7 +4170,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } __pyx_L23:; - /* "sklearn/linear_model/cd_fast.pyx":315 + /* "sklearn/linear_model/cd_fast.pyx":318 * tmp -= R_sum * X_mean_ii * * if positive and tmp < 0.0: # <<<<<<<<<<<<<< @@ -4180,7 +4185,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } if (__pyx_t_51) { - /* "sklearn/linear_model/cd_fast.pyx":316 + /* "sklearn/linear_model/cd_fast.pyx":319 * * if positive and tmp < 0.0: * w[ii] = 0.0 # <<<<<<<<<<<<<< @@ -4193,7 +4198,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":319 + /* "sklearn/linear_model/cd_fast.pyx":322 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ * / (norm_cols_X[ii] + beta) # <<<<<<<<<<<<<< @@ -4202,7 +4207,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ __pyx_t_49 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":318 + /* "sklearn/linear_model/cd_fast.pyx":321 * w[ii] = 0.0 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ # <<<<<<<<<<<<<< @@ -4214,7 +4219,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } __pyx_L26:; - /* "sklearn/linear_model/cd_fast.pyx":321 + /* "sklearn/linear_model/cd_fast.pyx":324 * / (norm_cols_X[ii] + beta) * * if w[ii] != 0.0: # <<<<<<<<<<<<<< @@ -4225,7 +4230,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_51 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_w.diminfo[0].strides)) != 0.0); if (__pyx_t_51) { - /* "sklearn/linear_model/cd_fast.pyx":323 + /* "sklearn/linear_model/cd_fast.pyx":326 * if w[ii] != 0.0: * # R -= w[ii] * X[:,ii] # Update residual * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -4238,7 +4243,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_56 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_56 < __pyx_t_23; __pyx_t_56+=1) { __pyx_v_jj = __pyx_t_56; - /* "sklearn/linear_model/cd_fast.pyx":324 + /* "sklearn/linear_model/cd_fast.pyx":327 * # R -= w[ii] * X[:,ii] # Update residual * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] -= X_data[jj] * w[ii] # <<<<<<<<<<<<<< @@ -4252,7 +4257,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_R.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_R.diminfo[0].strides) -= ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_X_data.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_w.diminfo[0].strides))); } - /* "sklearn/linear_model/cd_fast.pyx":326 + /* "sklearn/linear_model/cd_fast.pyx":329 * R[X_indices[jj]] -= X_data[jj] * w[ii] * * if center: # <<<<<<<<<<<<<< @@ -4261,7 +4266,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ if (__pyx_v_center) { - /* "sklearn/linear_model/cd_fast.pyx":327 + /* "sklearn/linear_model/cd_fast.pyx":330 * * if center: * for jj in xrange(n_samples): # <<<<<<<<<<<<<< @@ -4272,7 +4277,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_61 = 0; __pyx_t_61 < __pyx_t_56; __pyx_t_61+=1) { __pyx_v_jj = __pyx_t_61; - /* "sklearn/linear_model/cd_fast.pyx":328 + /* "sklearn/linear_model/cd_fast.pyx":331 * if center: * for jj in xrange(n_samples): * R[jj] += X_mean_ii * w[ii] # <<<<<<<<<<<<<< @@ -4290,7 +4295,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } __pyx_L27:; - /* "sklearn/linear_model/cd_fast.pyx":331 + /* "sklearn/linear_model/cd_fast.pyx":334 * * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) # <<<<<<<<<<<<<< @@ -4300,7 +4305,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_56 = __pyx_v_ii; __pyx_v_d_w_ii = fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_w.diminfo[0].strides)) - __pyx_v_w_ii)); - /* "sklearn/linear_model/cd_fast.pyx":332 + /* "sklearn/linear_model/cd_fast.pyx":335 * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: # <<<<<<<<<<<<<< @@ -4310,7 +4315,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_51 = (__pyx_v_d_w_ii > __pyx_v_d_w_max); if (__pyx_t_51) { - /* "sklearn/linear_model/cd_fast.pyx":333 + /* "sklearn/linear_model/cd_fast.pyx":336 * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: * d_w_max = d_w_ii # <<<<<<<<<<<<<< @@ -4322,7 +4327,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } __pyx_L33:; - /* "sklearn/linear_model/cd_fast.pyx":335 + /* "sklearn/linear_model/cd_fast.pyx":338 * d_w_max = d_w_ii * * if w[ii] > w_max: # <<<<<<<<<<<<<< @@ -4333,7 +4338,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_51 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_w.diminfo[0].strides)) > __pyx_v_w_max); if (__pyx_t_51) { - /* "sklearn/linear_model/cd_fast.pyx":336 + /* "sklearn/linear_model/cd_fast.pyx":339 * * if w[ii] > w_max: * w_max = w[ii] # <<<<<<<<<<<<<< @@ -4348,7 +4353,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_L12_continue:; } - /* "sklearn/linear_model/cd_fast.pyx":338 + /* "sklearn/linear_model/cd_fast.pyx":341 * w_max = w[ii] * * if w_max == 0.0 or d_w_max / w_max < d_w_tol or n_iter == max_iter - 1: # <<<<<<<<<<<<<< @@ -4370,26 +4375,26 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":344 + /* "sklearn/linear_model/cd_fast.pyx":347 * * # sparse X.T / dense R dot product * X_T_R = np.zeros(n_features) # <<<<<<<<<<<<<< * for ii in xrange(n_features): * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __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_4)); __pyx_t_4 = 0; @@ -4397,7 +4402,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_v_X_T_R = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":345 + /* "sklearn/linear_model/cd_fast.pyx":348 * # sparse X.T / dense R dot product * X_T_R = np.zeros(n_features) * for ii in xrange(n_features): # <<<<<<<<<<<<<< @@ -4408,7 +4413,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_7; __pyx_t_32+=1) { __pyx_v_ii = __pyx_t_32; - /* "sklearn/linear_model/cd_fast.pyx":346 + /* "sklearn/linear_model/cd_fast.pyx":349 * X_T_R = np.zeros(n_features) * for ii in xrange(n_features): * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -4421,7 +4426,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina for (__pyx_t_69 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_69 < __pyx_t_23; __pyx_t_69+=1) { __pyx_v_jj = __pyx_t_69; - /* "sklearn/linear_model/cd_fast.pyx":347 + /* "sklearn/linear_model/cd_fast.pyx":350 * for ii in xrange(n_features): * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * X_T_R[ii] += X_data[jj] * R[X_indices[jj]] # <<<<<<<<<<<<<< @@ -4429,22 +4434,22 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina * */ __pyx_t_70 = __pyx_v_ii; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_X_T_R, __pyx_t_70, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_X_T_R, __pyx_t_70, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_71 = __pyx_v_jj; __pyx_t_72 = __pyx_v_jj; __pyx_t_73 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_X_indices.diminfo[0].strides)); - __pyx_t_4 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_X_data.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_R.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_R.diminfo[0].strides)))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_X_data.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_R.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_R.diminfo[0].strides)))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetItemInt(__pyx_v_X_T_R, __pyx_t_70, __pyx_t_1, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_X_T_R, __pyx_t_70, __pyx_t_1, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/cd_fast.pyx":348 + /* "sklearn/linear_model/cd_fast.pyx":351 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * X_T_R[ii] += X_data[jj] * R[X_indices[jj]] * X_T_R[ii] -= X_mean[ii] * R.sum() # <<<<<<<<<<<<<< @@ -4452,48 +4457,48 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina * XtA = X_T_R - beta * w */ __pyx_t_69 = __pyx_v_ii; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_X_T_R, __pyx_t_69, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_X_T_R, __pyx_t_69, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_70 = __pyx_v_ii; - __pyx_t_4 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_X_mean.diminfo[0].strides))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_X_mean.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_X_mean.diminfo[0].strides))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __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; - if (__Pyx_SetItemInt(__pyx_v_X_T_R, __pyx_t_69, __pyx_t_3, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_X_T_R, __pyx_t_69, __pyx_t_3, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - /* "sklearn/linear_model/cd_fast.pyx":350 + /* "sklearn/linear_model/cd_fast.pyx":353 * X_T_R[ii] -= X_mean[ii] * R.sum() * * XtA = X_T_R - beta * w # <<<<<<<<<<<<<< * if positive: * dual_norm_XtA = np.max(XtA) */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_v_X_T_R, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_v_X_T_R, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_v_XtA); __pyx_v_XtA = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":351 + /* "sklearn/linear_model/cd_fast.pyx":354 * * XtA = X_T_R - beta * w * if positive: # <<<<<<<<<<<<<< @@ -4502,24 +4507,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina */ if (__pyx_v_positive) { - /* "sklearn/linear_model/cd_fast.pyx":352 + /* "sklearn/linear_model/cd_fast.pyx":355 * XtA = X_T_R - beta * w * if positive: * dual_norm_XtA = np.max(XtA) # <<<<<<<<<<<<<< * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __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 = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_XtA); __Pyx_GIVEREF(__pyx_v_XtA); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -4530,24 +4535,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":354 + /* "sklearn/linear_model/cd_fast.pyx":357 * dual_norm_XtA = np.max(XtA) * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) # <<<<<<<<<<<<<< * * R_norm2 = np.dot(R, R) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_XtA); @@ -4555,7 +4560,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina PyTuple_SET_ITEM(__pyx_t_1, 1, __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 = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 357; __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; @@ -4565,19 +4570,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } __pyx_L40:; - /* "sklearn/linear_model/cd_fast.pyx":356 + /* "sklearn/linear_model/cd_fast.pyx":359 * dual_norm_XtA = linalg.norm(XtA, np.inf) * * R_norm2 = np.dot(R, R) # <<<<<<<<<<<<<< * w_norm2 = np.dot(w, w) * if (dual_norm_XtA > alpha): */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __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(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_R)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_R)); @@ -4585,7 +4590,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __Pyx_INCREF(((PyObject *)__pyx_v_R)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_R)); __Pyx_GIVEREF(((PyObject *)__pyx_v_R)); - __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 = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __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_2)); __pyx_t_2 = 0; @@ -4593,19 +4598,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_v_R_norm2 = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":357 + /* "sklearn/linear_model/cd_fast.pyx":360 * * R_norm2 = np.dot(R, R) * w_norm2 = np.dot(w, w) # <<<<<<<<<<<<<< * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __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 = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_w)); @@ -4613,7 +4618,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -4621,117 +4626,117 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_v_w_norm2 = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":358 + /* "sklearn/linear_model/cd_fast.pyx":361 * R_norm2 = np.dot(R, R) * w_norm2 = np.dot(w, w) * if (dual_norm_XtA > alpha): # <<<<<<<<<<<<<< * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * const**2 */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":359 + /* "sklearn/linear_model/cd_fast.pyx":362 * w_norm2 = np.dot(w, w) * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA # <<<<<<<<<<<<<< * A_norm2 = R_norm2 * const**2 * gap = 0.5 * (R_norm2 + A_norm2) */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":360 + /* "sklearn/linear_model/cd_fast.pyx":363 * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * const**2 # <<<<<<<<<<<<<< * gap = 0.5 * (R_norm2 + A_norm2) * else: */ - __pyx_t_1 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_R_norm2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_v_R_norm2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_A_norm2); __pyx_v_A_norm2 = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":361 + /* "sklearn/linear_model/cd_fast.pyx":364 * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * const**2 * gap = 0.5 * (R_norm2 + A_norm2) # <<<<<<<<<<<<<< * else: * const = 1.0 */ - __pyx_t_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Add(__pyx_v_R_norm2, __pyx_v_A_norm2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_v_R_norm2, __pyx_v_A_norm2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_gap = __pyx_t_31; goto __pyx_L41; } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":363 + /* "sklearn/linear_model/cd_fast.pyx":366 * gap = 0.5 * (R_norm2 + A_norm2) * else: * const = 1.0 # <<<<<<<<<<<<<< * gap = R_norm2 * */ - __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":364 + /* "sklearn/linear_model/cd_fast.pyx":367 * else: * const = 1.0 * gap = R_norm2 # <<<<<<<<<<<<<< * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ */ - __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_v_R_norm2); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_v_R_norm2); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_gap = __pyx_t_31; } __pyx_L41:; - /* "sklearn/linear_model/cd_fast.pyx":366 + /* "sklearn/linear_model/cd_fast.pyx":369 * gap = R_norm2 * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ # <<<<<<<<<<<<<< * 0.5 * beta * (1 + const ** 2) * (w_norm2) * */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __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 = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_w)); @@ -4739,22 +4744,22 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_74 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_74); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_74); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __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_74); __pyx_t_74 = 0; - __pyx_t_74 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_74, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_74, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_74); __pyx_t_74 = 0; - __pyx_t_74 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__T); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__T); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_74); __Pyx_GIVEREF(__pyx_t_74); @@ -4762,52 +4767,52 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); __pyx_t_74 = 0; - __pyx_t_74 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Multiply(__pyx_v_const, __pyx_t_74); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Multiply(__pyx_v_const, __pyx_t_74); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_74); __pyx_t_74 = 0; - __pyx_t_74 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = PyNumber_Subtract(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/linear_model/cd_fast.pyx":367 + /* "sklearn/linear_model/cd_fast.pyx":370 * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ * 0.5 * beta * (1 + const ** 2) * (w_norm2) # <<<<<<<<<<<<<< * * if gap < tol: */ - __pyx_t_4 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __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_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_v_w_norm2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_v_w_norm2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_74, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_t_74, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_74); __pyx_t_74 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_gap = __pyx_t_31; - /* "sklearn/linear_model/cd_fast.pyx":369 + /* "sklearn/linear_model/cd_fast.pyx":372 * 0.5 * beta * (1 + const ** 2) * (w_norm2) * * if gap < tol: # <<<<<<<<<<<<<< @@ -4817,7 +4822,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina __pyx_t_16 = (__pyx_v_gap < __pyx_v_tol); if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":371 + /* "sklearn/linear_model/cd_fast.pyx":374 * if gap < tol: * # return if we reached desired tolerance * break # <<<<<<<<<<<<<< @@ -4834,7 +4839,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina } __pyx_L11_break:; - /* "sklearn/linear_model/cd_fast.pyx":373 + /* "sklearn/linear_model/cd_fast.pyx":376 * break * * return w, gap, tol # <<<<<<<<<<<<<< @@ -4842,11 +4847,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4sparse_enet_coordina * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_w)); @@ -4952,37 +4957,37 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_7enet_coordinate_desc case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Q)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__q)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_iter)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tol)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: if (kw_args > 0) { @@ -4991,7 +4996,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_7enet_coordinate_desc } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "enet_coordinate_descent_gram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "enet_coordinate_descent_gram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5009,28 +5014,28 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_7enet_coordinate_desc } } __pyx_v_w = ((PyArrayObject *)values[0]); - __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_Q = ((PyArrayObject *)values[3]); __pyx_v_q = ((PyArrayObject *)values[4]); __pyx_v_y = ((PyArrayObject *)values[5]); - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_positive = ((PyBoolObject *)values[8]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.cd_fast.enet_coordinate_descent_gram", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Q), __pyx_ptype_5numpy_ndarray, 1, "Q", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q), __pyx_ptype_5numpy_ndarray, 1, "q", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __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 = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_positive), __pyx_ptype_7cpython_4bool_bool, 1, "positive", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Q), __pyx_ptype_5numpy_ndarray, 1, "Q", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q), __pyx_ptype_5numpy_ndarray, 1, "q", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __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 = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_positive), __pyx_ptype_7cpython_4bool_bool, 1, "positive", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_descent_gram(__pyx_self, __pyx_v_w, __pyx_v_alpha, __pyx_v_beta, __pyx_v_Q, __pyx_v_q, __pyx_v_y, __pyx_v_max_iter, __pyx_v_tol, __pyx_v_positive); goto __pyx_L0; __pyx_L1_error:; @@ -5040,7 +5045,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_7enet_coordinate_desc return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":379 +/* "sklearn/linear_model/cd_fast.pyx":382 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_gram(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< @@ -5136,26 +5141,26 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Q.rcbuffer->pybuffer, (PyObject*)__pyx_v_Q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Q.rcbuffer->pybuffer, (PyObject*)__pyx_v_Q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_Q.diminfo[0].strides = __pyx_pybuffernd_Q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Q.diminfo[0].shape = __pyx_pybuffernd_Q.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Q.diminfo[1].strides = __pyx_pybuffernd_Q.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Q.diminfo[1].shape = __pyx_pybuffernd_Q.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_q.diminfo[0].strides = __pyx_pybuffernd_q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q.diminfo[0].shape = __pyx_pybuffernd_q.rcbuffer->pybuffer.shape[0]; { __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __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]; - /* "sklearn/linear_model/cd_fast.pyx":400 + /* "sklearn/linear_model/cd_fast.pyx":403 * * # get the data information into easy vars * cdef unsigned int n_samples = y.shape[0] # <<<<<<<<<<<<<< @@ -5164,7 +5169,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc */ __pyx_v_n_samples = (__pyx_v_y->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":401 + /* "sklearn/linear_model/cd_fast.pyx":404 * # get the data information into easy vars * cdef unsigned int n_samples = y.shape[0] * cdef unsigned int n_features = Q.shape[0] # <<<<<<<<<<<<<< @@ -5173,19 +5178,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc */ __pyx_v_n_features = (__pyx_v_Q->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":404 + /* "sklearn/linear_model/cd_fast.pyx":407 * * # initial value "Q w" which will be kept of up to date in the iterations * cdef np.ndarray[DOUBLE, ndim=1] H = np.dot(Q, w) # <<<<<<<<<<<<<< * * cdef double tmp */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_Q)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Q)); @@ -5193,17 +5198,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __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 = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __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; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_H.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_H = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_H.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_H.diminfo[0].strides = __pyx_pybuffernd_H.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_H.diminfo[0].shape = __pyx_pybuffernd_H.rcbuffer->pybuffer.shape[0]; } } @@ -5211,7 +5216,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_v_H = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":411 + /* "sklearn/linear_model/cd_fast.pyx":414 * cdef double w_max * cdef double d_w_ii * cdef double gap = tol + 1.0 # <<<<<<<<<<<<<< @@ -5220,7 +5225,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc */ __pyx_v_gap = (__pyx_v_tol + 1.0); - /* "sklearn/linear_model/cd_fast.pyx":412 + /* "sklearn/linear_model/cd_fast.pyx":415 * cdef double d_w_ii * cdef double gap = tol + 1.0 * cdef double d_w_tol = tol # <<<<<<<<<<<<<< @@ -5229,19 +5234,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc */ __pyx_v_d_w_tol = __pyx_v_tol; - /* "sklearn/linear_model/cd_fast.pyx":416 + /* "sklearn/linear_model/cd_fast.pyx":419 * cdef unsigned int n_iter * * cdef double y_norm2 = np.dot(y, y) # <<<<<<<<<<<<<< * tol = tol * y_norm2 * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __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 = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_y)); @@ -5249,15 +5254,15 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __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 = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __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_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_y_norm2 = __pyx_t_5; - /* "sklearn/linear_model/cd_fast.pyx":417 + /* "sklearn/linear_model/cd_fast.pyx":420 * * cdef double y_norm2 = np.dot(y, y) * tol = tol * y_norm2 # <<<<<<<<<<<<<< @@ -5266,7 +5271,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc */ __pyx_v_tol = (__pyx_v_tol * __pyx_v_y_norm2); - /* "sklearn/linear_model/cd_fast.pyx":419 + /* "sklearn/linear_model/cd_fast.pyx":422 * tol = tol * y_norm2 * * if alpha == 0: # <<<<<<<<<<<<<< @@ -5276,19 +5281,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_6 = (__pyx_v_alpha == 0.0); if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":420 + /* "sklearn/linear_model/cd_fast.pyx":423 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__warn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__warn); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -5296,7 +5301,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } __pyx_L3:; - /* "sklearn/linear_model/cd_fast.pyx":423 + /* "sklearn/linear_model/cd_fast.pyx":426 * " results and is discouraged.") * * for n_iter in range(max_iter): # <<<<<<<<<<<<<< @@ -5307,7 +5312,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_n_iter = __pyx_t_8; - /* "sklearn/linear_model/cd_fast.pyx":424 + /* "sklearn/linear_model/cd_fast.pyx":427 * * for n_iter in range(max_iter): * w_max = 0.0 # <<<<<<<<<<<<<< @@ -5316,7 +5321,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc */ __pyx_v_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":425 + /* "sklearn/linear_model/cd_fast.pyx":428 * for n_iter in range(max_iter): * w_max = 0.0 * d_w_max = 0.0 # <<<<<<<<<<<<<< @@ -5325,7 +5330,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc */ __pyx_v_d_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":426 + /* "sklearn/linear_model/cd_fast.pyx":429 * w_max = 0.0 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates # <<<<<<<<<<<<<< @@ -5336,7 +5341,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_ii = __pyx_t_10; - /* "sklearn/linear_model/cd_fast.pyx":427 + /* "sklearn/linear_model/cd_fast.pyx":430 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates * if Q[ii, ii] == 0.0: # <<<<<<<<<<<<<< @@ -5348,7 +5353,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_6 = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_Q.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_Q.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_Q.diminfo[1].strides)) == 0.0); if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":428 + /* "sklearn/linear_model/cd_fast.pyx":431 * for ii in xrange(n_features): # Loop over coordinates * if Q[ii, ii] == 0.0: * continue # <<<<<<<<<<<<<< @@ -5360,7 +5365,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } __pyx_L8:; - /* "sklearn/linear_model/cd_fast.pyx":430 + /* "sklearn/linear_model/cd_fast.pyx":433 * continue * * w_ii = w[ii] # Store previous value # <<<<<<<<<<<<<< @@ -5370,7 +5375,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_13 = __pyx_v_ii; __pyx_v_w_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_w.diminfo[0].strides)); - /* "sklearn/linear_model/cd_fast.pyx":432 + /* "sklearn/linear_model/cd_fast.pyx":435 * w_ii = w[ii] # Store previous value * * if w_ii != 0.0: # <<<<<<<<<<<<<< @@ -5380,7 +5385,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_6 = (__pyx_v_w_ii != 0.0); if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":436 + /* "sklearn/linear_model/cd_fast.pyx":439 * daxpy(n_features, -w_ii, * (Q.data + ii * n_features * sizeof(DOUBLE)), 1, * H.data, 1) # <<<<<<<<<<<<<< @@ -5392,7 +5397,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } __pyx_L9:; - /* "sklearn/linear_model/cd_fast.pyx":438 + /* "sklearn/linear_model/cd_fast.pyx":441 * H.data, 1) * * tmp = q[ii] - H[ii] # <<<<<<<<<<<<<< @@ -5403,14 +5408,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_15 = __pyx_v_ii; __pyx_v_tmp = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_q.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_q.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_H.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_H.diminfo[0].strides))); - /* "sklearn/linear_model/cd_fast.pyx":440 + /* "sklearn/linear_model/cd_fast.pyx":443 * tmp = q[ii] - H[ii] * * if positive and tmp < 0: # <<<<<<<<<<<<<< * w[ii] = 0.0 * else: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { __pyx_t_16 = (__pyx_v_tmp < 0.0); __pyx_t_17 = __pyx_t_16; @@ -5419,7 +5424,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } if (__pyx_t_17) { - /* "sklearn/linear_model/cd_fast.pyx":441 + /* "sklearn/linear_model/cd_fast.pyx":444 * * if positive and tmp < 0: * w[ii] = 0.0 # <<<<<<<<<<<<<< @@ -5432,7 +5437,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":444 + /* "sklearn/linear_model/cd_fast.pyx":447 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ * / (Q[ii, ii] + beta) # <<<<<<<<<<<<<< @@ -5442,7 +5447,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_19 = __pyx_v_ii; __pyx_t_20 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":443 + /* "sklearn/linear_model/cd_fast.pyx":446 * w[ii] = 0.0 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ # <<<<<<<<<<<<<< @@ -5454,7 +5459,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } __pyx_L10:; - /* "sklearn/linear_model/cd_fast.pyx":446 + /* "sklearn/linear_model/cd_fast.pyx":449 * / (Q[ii, ii] + beta) * * if w[ii] != 0.0: # <<<<<<<<<<<<<< @@ -5465,7 +5470,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_17 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_w.diminfo[0].strides)) != 0.0); if (__pyx_t_17) { - /* "sklearn/linear_model/cd_fast.pyx":448 + /* "sklearn/linear_model/cd_fast.pyx":451 * if w[ii] != 0.0: * # H += w[ii] * Q[ii] # Update H = X.T X w * daxpy(n_features, w[ii], # <<<<<<<<<<<<<< @@ -5474,7 +5479,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc */ __pyx_t_23 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":450 + /* "sklearn/linear_model/cd_fast.pyx":453 * daxpy(n_features, w[ii], * (Q.data + ii * n_features * sizeof(DOUBLE)), 1, * H.data, 1) # <<<<<<<<<<<<<< @@ -5486,7 +5491,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } __pyx_L11:; - /* "sklearn/linear_model/cd_fast.pyx":453 + /* "sklearn/linear_model/cd_fast.pyx":456 * * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) # <<<<<<<<<<<<<< @@ -5496,7 +5501,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_24 = __pyx_v_ii; __pyx_v_d_w_ii = fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_w.diminfo[0].strides)) - __pyx_v_w_ii)); - /* "sklearn/linear_model/cd_fast.pyx":454 + /* "sklearn/linear_model/cd_fast.pyx":457 * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: # <<<<<<<<<<<<<< @@ -5506,7 +5511,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_17 = (__pyx_v_d_w_ii > __pyx_v_d_w_max); if (__pyx_t_17) { - /* "sklearn/linear_model/cd_fast.pyx":455 + /* "sklearn/linear_model/cd_fast.pyx":458 * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: * d_w_max = d_w_ii # <<<<<<<<<<<<<< @@ -5518,7 +5523,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } __pyx_L12:; - /* "sklearn/linear_model/cd_fast.pyx":457 + /* "sklearn/linear_model/cd_fast.pyx":460 * d_w_max = d_w_ii * * if fabs(w[ii]) > w_max: # <<<<<<<<<<<<<< @@ -5529,7 +5534,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_17 = (fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_w.diminfo[0].strides))) > __pyx_v_w_max); if (__pyx_t_17) { - /* "sklearn/linear_model/cd_fast.pyx":458 + /* "sklearn/linear_model/cd_fast.pyx":461 * * if fabs(w[ii]) > w_max: * w_max = fabs(w[ii]) # <<<<<<<<<<<<<< @@ -5544,7 +5549,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_L6_continue:; } - /* "sklearn/linear_model/cd_fast.pyx":460 + /* "sklearn/linear_model/cd_fast.pyx":463 * w_max = fabs(w[ii]) * * if w_max == 0.0 or d_w_max / w_max < d_w_tol or n_iter == max_iter - 1: # <<<<<<<<<<<<<< @@ -5566,19 +5571,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":465 + /* "sklearn/linear_model/cd_fast.pyx":468 * # criterion * * q_dot_w = np.dot(w, q) # <<<<<<<<<<<<<< * * XtA = q - H - beta * w */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_w)); @@ -5586,7 +5591,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_q)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_q)); __Pyx_GIVEREF(((PyObject *)__pyx_v_q)); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -5594,21 +5599,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_v_q_dot_w = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":467 + /* "sklearn/linear_model/cd_fast.pyx":470 * q_dot_w = np.dot(w, q) * * XtA = q - H - beta * w # <<<<<<<<<<<<<< * if positive: * dual_norm_XtA = np.max(XtA) */ - __pyx_t_1 = PyNumber_Subtract(((PyObject *)__pyx_v_q), ((PyObject *)__pyx_v_H)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(((PyObject *)__pyx_v_q), ((PyObject *)__pyx_v_H)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5616,34 +5621,34 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_v_XtA = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":468 + /* "sklearn/linear_model/cd_fast.pyx":471 * * XtA = q - H - beta * w * if positive: # <<<<<<<<<<<<<< * dual_norm_XtA = np.max(XtA) * else: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":469 + /* "sklearn/linear_model/cd_fast.pyx":472 * XtA = q - H - beta * w * if positive: * dual_norm_XtA = np.max(XtA) # <<<<<<<<<<<<<< * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __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 = 469; __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 = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_XtA); __Pyx_GIVEREF(__pyx_v_XtA); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -5654,24 +5659,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":471 + /* "sklearn/linear_model/cd_fast.pyx":474 * dual_norm_XtA = np.max(XtA) * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) # <<<<<<<<<<<<<< * * R_norm2 = y_norm2 + np.sum(w * H) - 2.0 * q_dot_w */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_XtA); @@ -5679,7 +5684,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __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; @@ -5689,41 +5694,41 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } __pyx_L15:; - /* "sklearn/linear_model/cd_fast.pyx":473 + /* "sklearn/linear_model/cd_fast.pyx":476 * dual_norm_XtA = linalg.norm(XtA, np.inf) * * R_norm2 = y_norm2 + np.sum(w * H) - 2.0 * q_dot_w # <<<<<<<<<<<<<< * w_norm2 = np.dot(w, w) * if (dual_norm_XtA > alpha): */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y_norm2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y_norm2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_w), ((PyObject *)__pyx_v_H)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_w), ((PyObject *)__pyx_v_H)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyTuple_New(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; - __pyx_t_28 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_q_dot_w); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_q_dot_w); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_28, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_28, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5731,19 +5736,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_v_R_norm2 = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":474 + /* "sklearn/linear_model/cd_fast.pyx":477 * * R_norm2 = y_norm2 + np.sum(w * H) - 2.0 * q_dot_w * w_norm2 = np.dot(w, w) # <<<<<<<<<<<<<< * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_w)); @@ -5751,7 +5756,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __pyx_t_28 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -5759,133 +5764,133 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_v_w_norm2 = __pyx_t_28; __pyx_t_28 = 0; - /* "sklearn/linear_model/cd_fast.pyx":475 + /* "sklearn/linear_model/cd_fast.pyx":478 * R_norm2 = y_norm2 + np.sum(w * H) - 2.0 * q_dot_w * w_norm2 = np.dot(w, w) * if (dual_norm_XtA > alpha): # <<<<<<<<<<<<<< * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * (const ** 2) */ - __pyx_t_28 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_28, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_28, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __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 = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":476 + /* "sklearn/linear_model/cd_fast.pyx":479 * w_norm2 = np.dot(w, w) * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA # <<<<<<<<<<<<<< * A_norm2 = R_norm2 * (const ** 2) * gap = 0.5 * (R_norm2 + A_norm2) */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_28; __pyx_t_28 = 0; - /* "sklearn/linear_model/cd_fast.pyx":477 + /* "sklearn/linear_model/cd_fast.pyx":480 * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * (const ** 2) # <<<<<<<<<<<<<< * gap = 0.5 * (R_norm2 + A_norm2) * else: */ - __pyx_t_28 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyNumber_Multiply(__pyx_v_R_norm2, __pyx_t_28); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_v_R_norm2, __pyx_t_28); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_XDECREF(__pyx_v_A_norm2); __pyx_v_A_norm2 = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":478 + /* "sklearn/linear_model/cd_fast.pyx":481 * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * (const ** 2) * gap = 0.5 * (R_norm2 + A_norm2) # <<<<<<<<<<<<<< * else: * const = 1.0 */ - __pyx_t_1 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyNumber_Add(__pyx_v_R_norm2, __pyx_v_A_norm2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Add(__pyx_v_R_norm2, __pyx_v_A_norm2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __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_28); __pyx_t_28 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_gap = __pyx_t_5; goto __pyx_L16; } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":480 + /* "sklearn/linear_model/cd_fast.pyx":483 * gap = 0.5 * (R_norm2 + A_norm2) * else: * const = 1.0 # <<<<<<<<<<<<<< * gap = R_norm2 * */ - __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":481 + /* "sklearn/linear_model/cd_fast.pyx":484 * else: * const = 1.0 * gap = R_norm2 # <<<<<<<<<<<<<< * * gap += alpha * linalg.norm(w, 1) \ */ - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_R_norm2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_R_norm2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_gap = __pyx_t_5; } __pyx_L16:; - /* "sklearn/linear_model/cd_fast.pyx":483 + /* "sklearn/linear_model/cd_fast.pyx":486 * gap = R_norm2 * * gap += alpha * linalg.norm(w, 1) \ # <<<<<<<<<<<<<< * - const * y_norm2 \ * + const * q_dot_w + \ */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - /* "sklearn/linear_model/cd_fast.pyx":484 + /* "sklearn/linear_model/cd_fast.pyx":487 * * gap += alpha * linalg.norm(w, 1) \ * - const * y_norm2 \ # <<<<<<<<<<<<<< * + const * q_dot_w + \ * 0.5 * beta * (1 + const ** 2) * (w_norm2) */ - __pyx_t_28 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - /* "sklearn/linear_model/cd_fast.pyx":483 + /* "sklearn/linear_model/cd_fast.pyx":486 * gap = R_norm2 * * gap += alpha * linalg.norm(w, 1) \ # <<<<<<<<<<<<<< * - const * y_norm2 \ * + const * q_dot_w + \ */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_w)); @@ -5893,72 +5898,72 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_29 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_28, __pyx_t_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_28, __pyx_t_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - /* "sklearn/linear_model/cd_fast.pyx":485 + /* "sklearn/linear_model/cd_fast.pyx":488 * gap += alpha * linalg.norm(w, 1) \ * - const * y_norm2 \ * + const * q_dot_w + \ # <<<<<<<<<<<<<< * 0.5 * beta * (1 + const ** 2) * (w_norm2) * */ - __pyx_t_29 = PyFloat_FromDouble(__pyx_v_y_norm2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyFloat_FromDouble(__pyx_v_y_norm2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); - __pyx_t_28 = PyNumber_Multiply(__pyx_v_const, __pyx_t_29); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Multiply(__pyx_v_const, __pyx_t_29); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = PyNumber_Subtract(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyNumber_Subtract(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = PyNumber_Multiply(__pyx_v_const, __pyx_v_q_dot_w); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Multiply(__pyx_v_const, __pyx_v_q_dot_w); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyNumber_Add(__pyx_t_29, __pyx_t_28); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_29, __pyx_t_28); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/linear_model/cd_fast.pyx":486 + /* "sklearn/linear_model/cd_fast.pyx":489 * - const * y_norm2 \ * + const * q_dot_w + \ * 0.5 * beta * (1 + const ** 2) * (w_norm2) # <<<<<<<<<<<<<< * * if gap < tol: */ - __pyx_t_28 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_29 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); - __pyx_t_2 = PyNumber_Add(__pyx_int_1, __pyx_t_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_int_1, __pyx_t_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = PyNumber_Multiply(__pyx_t_28, __pyx_t_2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyNumber_Multiply(__pyx_t_28, __pyx_t_2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_29, __pyx_v_w_norm2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_29, __pyx_v_w_norm2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_gap = __pyx_t_5; - /* "sklearn/linear_model/cd_fast.pyx":488 + /* "sklearn/linear_model/cd_fast.pyx":491 * 0.5 * beta * (1 + const ** 2) * (w_norm2) * * if gap < tol: # <<<<<<<<<<<<<< @@ -5968,7 +5973,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc __pyx_t_6 = (__pyx_v_gap < __pyx_v_tol); if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":490 + /* "sklearn/linear_model/cd_fast.pyx":493 * if gap < tol: * # return if we reached desired tolerance * break # <<<<<<<<<<<<<< @@ -5985,7 +5990,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc } __pyx_L5_break:; - /* "sklearn/linear_model/cd_fast.pyx":492 + /* "sklearn/linear_model/cd_fast.pyx":495 * break * * return w, gap, tol # <<<<<<<<<<<<<< @@ -5993,11 +5998,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_29 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_w)); @@ -6051,7 +6056,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_6enet_coordinate_desc return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":495 +/* "sklearn/linear_model/cd_fast.pyx":498 * * * cdef double abs_max(int n, double* a): # <<<<<<<<<<<<<< @@ -6070,7 +6075,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_abs_max(int __pyx_v_n, do int __pyx_t_3; __Pyx_RefNannySetupContext("abs_max", 0); - /* "sklearn/linear_model/cd_fast.pyx":498 + /* "sklearn/linear_model/cd_fast.pyx":501 * """np.max(np.abs(a))""" * cdef int i * cdef double m = fabs(a[0]) # <<<<<<<<<<<<<< @@ -6079,7 +6084,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_abs_max(int __pyx_v_n, do */ __pyx_v_m = fabs((__pyx_v_a[0])); - /* "sklearn/linear_model/cd_fast.pyx":500 + /* "sklearn/linear_model/cd_fast.pyx":503 * cdef double m = fabs(a[0]) * cdef double d * for i in xrange(1, n): # <<<<<<<<<<<<<< @@ -6090,7 +6095,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_abs_max(int __pyx_v_n, do for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/linear_model/cd_fast.pyx":501 + /* "sklearn/linear_model/cd_fast.pyx":504 * cdef double d * for i in xrange(1, n): * d = fabs(a[i]) # <<<<<<<<<<<<<< @@ -6099,7 +6104,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_abs_max(int __pyx_v_n, do */ __pyx_v_d = fabs((__pyx_v_a[__pyx_v_i])); - /* "sklearn/linear_model/cd_fast.pyx":502 + /* "sklearn/linear_model/cd_fast.pyx":505 * for i in xrange(1, n): * d = fabs(a[i]) * if d > m: # <<<<<<<<<<<<<< @@ -6109,7 +6114,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_abs_max(int __pyx_v_n, do __pyx_t_3 = (__pyx_v_d > __pyx_v_m); if (__pyx_t_3) { - /* "sklearn/linear_model/cd_fast.pyx":503 + /* "sklearn/linear_model/cd_fast.pyx":506 * d = fabs(a[i]) * if d > m: * m = d # <<<<<<<<<<<<<< @@ -6122,7 +6127,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_abs_max(int __pyx_v_n, do __pyx_L5:; } - /* "sklearn/linear_model/cd_fast.pyx":504 + /* "sklearn/linear_model/cd_fast.pyx":507 * if d > m: * m = d * return m # <<<<<<<<<<<<<< @@ -6138,7 +6143,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_abs_max(int __pyx_v_n, do return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":507 +/* "sklearn/linear_model/cd_fast.pyx":510 * * * cdef double diff_abs_max(int n, double* a, double* b): # <<<<<<<<<<<<<< @@ -6157,7 +6162,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_diff_abs_max(int __pyx_v_ int __pyx_t_3; __Pyx_RefNannySetupContext("diff_abs_max", 0); - /* "sklearn/linear_model/cd_fast.pyx":510 + /* "sklearn/linear_model/cd_fast.pyx":513 * """np.max(np.abs(a - b))""" * cdef int i * cdef double m = fabs(a[0] - b[0]) # <<<<<<<<<<<<<< @@ -6166,7 +6171,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_diff_abs_max(int __pyx_v_ */ __pyx_v_m = fabs(((__pyx_v_a[0]) - (__pyx_v_b[0]))); - /* "sklearn/linear_model/cd_fast.pyx":512 + /* "sklearn/linear_model/cd_fast.pyx":515 * cdef double m = fabs(a[0] - b[0]) * cdef double d * for i in xrange(1, n): # <<<<<<<<<<<<<< @@ -6177,7 +6182,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_diff_abs_max(int __pyx_v_ for (__pyx_t_2 = 1; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/linear_model/cd_fast.pyx":513 + /* "sklearn/linear_model/cd_fast.pyx":516 * cdef double d * for i in xrange(1, n): * d = fabs(a[i] - b[i]) # <<<<<<<<<<<<<< @@ -6186,7 +6191,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_diff_abs_max(int __pyx_v_ */ __pyx_v_d = fabs(((__pyx_v_a[__pyx_v_i]) - (__pyx_v_b[__pyx_v_i]))); - /* "sklearn/linear_model/cd_fast.pyx":514 + /* "sklearn/linear_model/cd_fast.pyx":517 * for i in xrange(1, n): * d = fabs(a[i] - b[i]) * if d > m: # <<<<<<<<<<<<<< @@ -6196,7 +6201,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_diff_abs_max(int __pyx_v_ __pyx_t_3 = (__pyx_v_d > __pyx_v_m); if (__pyx_t_3) { - /* "sklearn/linear_model/cd_fast.pyx":515 + /* "sklearn/linear_model/cd_fast.pyx":518 * d = fabs(a[i] - b[i]) * if d > m: * m = d # <<<<<<<<<<<<<< @@ -6209,7 +6214,7 @@ static double __pyx_f_7sklearn_12linear_model_7cd_fast_diff_abs_max(int __pyx_v_ __pyx_L5:; } - /* "sklearn/linear_model/cd_fast.pyx":516 + /* "sklearn/linear_model/cd_fast.pyx":519 * if d > m: * m = d * return m # <<<<<<<<<<<<<< @@ -6265,36 +6270,36 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_9enet_coordinate_desc case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__l1_reg)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__l2_reg)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_iter)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tol)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "enet_coordinate_descent_multi_task") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "enet_coordinate_descent_multi_task") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -6308,24 +6313,24 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_9enet_coordinate_desc values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_W = ((PyArrayObject *)values[0]); - __pyx_v_l1_reg = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_l1_reg == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_l2_reg = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_l2_reg == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_l1_reg = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_l1_reg == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_l2_reg = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_l2_reg == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X = ((PyArrayObject *)values[3]); __pyx_v_Y = ((PyArrayObject *)values[4]); - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_multi_task", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.cd_fast.enet_coordinate_descent_multi_task", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_W), __pyx_ptype_5numpy_ndarray, 1, "W", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __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 = 524; __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 = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_W), __pyx_ptype_5numpy_ndarray, 1, "W", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __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 = 527; __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 = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_descent_multi_task(__pyx_self, __pyx_v_W, __pyx_v_l1_reg, __pyx_v_l2_reg, __pyx_v_X, __pyx_v_Y, __pyx_v_max_iter, __pyx_v_tol); goto __pyx_L0; __pyx_L1_error:; @@ -6335,7 +6340,7 @@ static PyObject *__pyx_pw_7sklearn_12linear_model_7cd_fast_9enet_coordinate_desc return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":522 +/* "sklearn/linear_model/cd_fast.pyx":525 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_multi_task(np.ndarray[DOUBLE, ndim=2, mode='fortran'] W, # <<<<<<<<<<<<<< @@ -6441,21 +6446,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_pybuffernd_Y.rcbuffer = &__pyx_pybuffer_Y; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_W.rcbuffer->pybuffer, (PyObject*)__pyx_v_W, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_F_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_W.rcbuffer->pybuffer, (PyObject*)__pyx_v_W, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_F_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_W.diminfo[0].strides = __pyx_pybuffernd_W.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_W.diminfo[0].shape = __pyx_pybuffernd_W.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_W.diminfo[1].strides = __pyx_pybuffernd_W.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_W.diminfo[1].shape = __pyx_pybuffernd_W.rcbuffer->pybuffer.shape[1]; { __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_F_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_F_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __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_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __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/linear_model/cd_fast.pyx":538 + /* "sklearn/linear_model/cd_fast.pyx":541 * """ * # get the data information into easy vars * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -6464,7 +6469,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":539 + /* "sklearn/linear_model/cd_fast.pyx":542 * # get the data information into easy vars * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -6473,7 +6478,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_n_features = (__pyx_v_X->dimensions[1]); - /* "sklearn/linear_model/cd_fast.pyx":540 + /* "sklearn/linear_model/cd_fast.pyx":543 * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] * cdef unsigned int n_tasks = Y.shape[1] # <<<<<<<<<<<<<< @@ -6482,32 +6487,32 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_n_tasks = (__pyx_v_Y->dimensions[1]); - /* "sklearn/linear_model/cd_fast.pyx":543 + /* "sklearn/linear_model/cd_fast.pyx":546 * * # compute norms of the columns of X * cdef np.ndarray[DOUBLE, ndim=1] norm_cols_X = (X ** 2).sum(axis=0) # <<<<<<<<<<<<<< * * # initial value of the residuals */ - __pyx_t_1 = PyNumber_Power(((PyObject *)__pyx_v_X), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(((PyObject *)__pyx_v_X), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __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 = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __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; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_norm_cols_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_norm_cols_X.diminfo[0].strides = __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norm_cols_X.diminfo[0].shape = __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.shape[0]; } } @@ -6515,46 +6520,46 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_v_norm_cols_X = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":548 + /* "sklearn/linear_model/cd_fast.pyx":551 * cdef np.ndarray[DOUBLE, ndim=2, mode='c'] R * * cdef np.ndarray[DOUBLE, ndim=1, mode='c'] tmp = np.zeros(n_tasks, dtype=np.float) # <<<<<<<<<<<<<< * cdef np.ndarray[DOUBLE, ndim=1] w_ii = np.zeros(n_tasks, dtype=np.float) * cdef double d_w_max */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_n_tasks); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_n_tasks); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __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 = 551; __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 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_tmp.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_tmp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_tmp.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_tmp.diminfo[0].strides = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_tmp.diminfo[0].shape = __pyx_pybuffernd_tmp.rcbuffer->pybuffer.shape[0]; } } @@ -6562,46 +6567,46 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_v_tmp = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/linear_model/cd_fast.pyx":549 + /* "sklearn/linear_model/cd_fast.pyx":552 * * cdef np.ndarray[DOUBLE, ndim=1, mode='c'] tmp = np.zeros(n_tasks, dtype=np.float) * cdef np.ndarray[DOUBLE, ndim=1] w_ii = np.zeros(n_tasks, dtype=np.float) # <<<<<<<<<<<<<< * cdef double d_w_max * cdef double w_max */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_n_tasks); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_n_tasks); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __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 = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __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_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __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_6)); __pyx_t_6 = 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 = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w_ii.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_w_ii = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_w_ii.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_w_ii.diminfo[0].strides = __pyx_pybuffernd_w_ii.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w_ii.diminfo[0].shape = __pyx_pybuffernd_w_ii.rcbuffer->pybuffer.shape[0]; } } @@ -6609,7 +6614,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_v_w_ii = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/linear_model/cd_fast.pyx":555 + /* "sklearn/linear_model/cd_fast.pyx":558 * cdef double nn * cdef double W_ii_abs_max * cdef double gap = tol + 1.0 # <<<<<<<<<<<<<< @@ -6618,7 +6623,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_gap = (__pyx_v_tol + 1.0); - /* "sklearn/linear_model/cd_fast.pyx":556 + /* "sklearn/linear_model/cd_fast.pyx":559 * cdef double W_ii_abs_max * cdef double gap = tol + 1.0 * cdef double d_w_tol = tol # <<<<<<<<<<<<<< @@ -6627,7 +6632,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_d_w_tol = __pyx_v_tol; - /* "sklearn/linear_model/cd_fast.pyx":560 + /* "sklearn/linear_model/cd_fast.pyx":563 * cdef unsigned int n_iter * * if l1_reg == 0: # <<<<<<<<<<<<<< @@ -6637,19 +6642,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_t_9 = (__pyx_v_l1_reg == 0.0); if (__pyx_t_9) { - /* "sklearn/linear_model/cd_fast.pyx":561 + /* "sklearn/linear_model/cd_fast.pyx":564 * * if l1_reg == 0: * warnings.warn("Coordinate descent with l1_reg=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__warn); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__warn); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -6657,21 +6662,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } __pyx_L3:; - /* "sklearn/linear_model/cd_fast.pyx":564 + /* "sklearn/linear_model/cd_fast.pyx":567 * " results and is discouraged.") * * R = Y - np.dot(X, W.T) # <<<<<<<<<<<<<< * R = np.asarray(R, order='C') * */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__dot); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__dot); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_W), __pyx_n_s__T); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_W), __pyx_n_s__T); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __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)); @@ -6679,14 +6684,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Subtract(((PyObject *)__pyx_v_Y), __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(((PyObject *)__pyx_v_Y), __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -6702,38 +6707,38 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } } __pyx_pybuffernd_R.diminfo[0].strides = __pyx_pybuffernd_R.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_R.diminfo[0].shape = __pyx_pybuffernd_R.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_R.diminfo[1].strides = __pyx_pybuffernd_R.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_R.diminfo[1].shape = __pyx_pybuffernd_R.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __pyx_v_R = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":565 + /* "sklearn/linear_model/cd_fast.pyx":568 * * R = Y - np.dot(X, W.T) * R = np.asarray(R, order='C') # <<<<<<<<<<<<<< * * # tol = tol * linalg.norm(Y, ord='fro') ** 2 */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __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 = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_R)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_R)); __Pyx_GIVEREF(((PyObject *)__pyx_v_R)); - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -6749,14 +6754,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } } __pyx_pybuffernd_R.diminfo[0].strides = __pyx_pybuffernd_R.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_R.diminfo[0].shape = __pyx_pybuffernd_R.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_R.diminfo[1].strides = __pyx_pybuffernd_R.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_R.diminfo[1].shape = __pyx_pybuffernd_R.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_R)); __pyx_v_R = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":568 + /* "sklearn/linear_model/cd_fast.pyx":571 * * # tol = tol * linalg.norm(Y, ord='fro') ** 2 * tol = tol * dnrm2(n_samples * n_tasks, Y.data, 1) ** 2 # <<<<<<<<<<<<<< @@ -6765,7 +6770,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_tol = (__pyx_v_tol * pow(cblas_dnrm2((__pyx_v_n_samples * __pyx_v_n_tasks), ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_Y->data), 1), 2.0)); - /* "sklearn/linear_model/cd_fast.pyx":570 + /* "sklearn/linear_model/cd_fast.pyx":573 * tol = tol * dnrm2(n_samples * n_tasks, Y.data, 1) ** 2 * * for n_iter in range(max_iter): # <<<<<<<<<<<<<< @@ -6776,7 +6781,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_11; __pyx_t_15+=1) { __pyx_v_n_iter = __pyx_t_15; - /* "sklearn/linear_model/cd_fast.pyx":571 + /* "sklearn/linear_model/cd_fast.pyx":574 * * for n_iter in range(max_iter): * w_max = 0.0 # <<<<<<<<<<<<<< @@ -6785,7 +6790,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":572 + /* "sklearn/linear_model/cd_fast.pyx":575 * for n_iter in range(max_iter): * w_max = 0.0 * d_w_max = 0.0 # <<<<<<<<<<<<<< @@ -6794,7 +6799,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_d_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":573 + /* "sklearn/linear_model/cd_fast.pyx":576 * w_max = 0.0 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates # <<<<<<<<<<<<<< @@ -6805,7 +6810,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_ii = __pyx_t_17; - /* "sklearn/linear_model/cd_fast.pyx":574 + /* "sklearn/linear_model/cd_fast.pyx":577 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates * if norm_cols_X[ii] == 0.0: # <<<<<<<<<<<<<< @@ -6816,7 +6821,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_norm_cols_X.diminfo[0].strides)) == 0.0); if (__pyx_t_9) { - /* "sklearn/linear_model/cd_fast.pyx":575 + /* "sklearn/linear_model/cd_fast.pyx":578 * for ii in xrange(n_features): # Loop over coordinates * if norm_cols_X[ii] == 0.0: * continue # <<<<<<<<<<<<<< @@ -6828,7 +6833,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } __pyx_L8:; - /* "sklearn/linear_model/cd_fast.pyx":579 + /* "sklearn/linear_model/cd_fast.pyx":582 * # w_ii = W[:, ii] # Store previous value * dcopy(n_tasks, (W.data + ii * n_tasks * sizeof(DOUBLE)), * 1, w_ii.data, 1) # <<<<<<<<<<<<<< @@ -6837,7 +6842,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ cblas_dcopy(__pyx_v_n_tasks, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)(__pyx_v_W->data + ((__pyx_v_ii * __pyx_v_n_tasks) * (sizeof(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE))))), 1, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_w_ii->data), 1); - /* "sklearn/linear_model/cd_fast.pyx":582 + /* "sklearn/linear_model/cd_fast.pyx":585 * * # if np.sum(w_ii ** 2) != 0.0: # can do better * if dnrm2(n_tasks, w_ii.data, 1) != 0.0: # <<<<<<<<<<<<<< @@ -6847,7 +6852,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_t_9 = (cblas_dnrm2(__pyx_v_n_tasks, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_w_ii->data), 1) != 0.0); if (__pyx_t_9) { - /* "sklearn/linear_model/cd_fast.pyx":587 + /* "sklearn/linear_model/cd_fast.pyx":590 * (X.data + ii * n_samples * sizeof(DOUBLE)), 1, * w_ii.data, 1, * R.data, n_tasks) # <<<<<<<<<<<<<< @@ -6859,7 +6864,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } __pyx_L9:; - /* "sklearn/linear_model/cd_fast.pyx":593 + /* "sklearn/linear_model/cd_fast.pyx":596 * n_samples, n_tasks, 1.0, R.data, * n_tasks, (X.data + ii * n_samples * sizeof(DOUBLE)), * 1, 0.0, tmp.data, 1) # <<<<<<<<<<<<<< @@ -6868,7 +6873,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ cblas_dgemv(CblasRowMajor, CblasTrans, __pyx_v_n_samples, __pyx_v_n_tasks, 1.0, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_R->data), __pyx_v_n_tasks, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)(__pyx_v_X->data + ((__pyx_v_ii * __pyx_v_n_samples) * (sizeof(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE))))), 1, 0.0, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_tmp->data), 1); - /* "sklearn/linear_model/cd_fast.pyx":596 + /* "sklearn/linear_model/cd_fast.pyx":599 * * # nn = sqrt(np.sum(tmp ** 2)) * nn = dnrm2(n_tasks, tmp.data, 1) # <<<<<<<<<<<<<< @@ -6877,7 +6882,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_nn = cblas_dnrm2(__pyx_v_n_tasks, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_tmp->data), 1); - /* "sklearn/linear_model/cd_fast.pyx":600 + /* "sklearn/linear_model/cd_fast.pyx":603 * # W[:, ii] = tmp * fmax(1. - l1_reg / nn, 0) / (norm_cols_X[ii] + l2_reg) * dcopy(n_tasks, tmp.data, * 1, (W.data + ii * n_tasks * sizeof(DOUBLE)), 1) # <<<<<<<<<<<<<< @@ -6886,7 +6891,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ cblas_dcopy(__pyx_v_n_tasks, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_tmp->data), 1, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)(__pyx_v_W->data + ((__pyx_v_ii * __pyx_v_n_tasks) * (sizeof(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE))))), 1); - /* "sklearn/linear_model/cd_fast.pyx":601 + /* "sklearn/linear_model/cd_fast.pyx":604 * dcopy(n_tasks, tmp.data, * 1, (W.data + ii * n_tasks * sizeof(DOUBLE)), 1) * dscal(n_tasks, fmax(1. - l1_reg / nn, 0) / (norm_cols_X[ii] + l2_reg), # <<<<<<<<<<<<<< @@ -6895,7 +6900,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_t_19 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":602 + /* "sklearn/linear_model/cd_fast.pyx":605 * 1, (W.data + ii * n_tasks * sizeof(DOUBLE)), 1) * dscal(n_tasks, fmax(1. - l1_reg / nn, 0) / (norm_cols_X[ii] + l2_reg), * (W.data + ii * n_tasks * sizeof(DOUBLE)), 1) # <<<<<<<<<<<<<< @@ -6904,7 +6909,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ cblas_dscal(__pyx_v_n_tasks, (__pyx_f_7sklearn_12linear_model_7cd_fast_fmax((1. - (__pyx_v_l1_reg / __pyx_v_nn)), 0.0) / ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_pybuffernd_norm_cols_X.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_norm_cols_X.diminfo[0].strides)) + __pyx_v_l2_reg)), ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)(__pyx_v_W->data + ((__pyx_v_ii * __pyx_v_n_tasks) * (sizeof(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE))))), 1); - /* "sklearn/linear_model/cd_fast.pyx":605 + /* "sklearn/linear_model/cd_fast.pyx":608 * * # if np.sum(W[:, ii] ** 2) != 0.0: # can do better * if dnrm2(n_tasks, (W.data + ii * n_tasks * sizeof(DOUBLE)), 1) != 0.0: # <<<<<<<<<<<<<< @@ -6914,7 +6919,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_t_9 = (cblas_dnrm2(__pyx_v_n_tasks, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)(__pyx_v_W->data + ((__pyx_v_ii * __pyx_v_n_tasks) * (sizeof(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE))))), 1) != 0.0); if (__pyx_t_9) { - /* "sklearn/linear_model/cd_fast.pyx":610 + /* "sklearn/linear_model/cd_fast.pyx":613 * (X.data + ii * n_samples * sizeof(DOUBLE)), 1, * (W.data + ii * n_tasks * sizeof(DOUBLE)), 1, * R.data, n_tasks) # <<<<<<<<<<<<<< @@ -6926,7 +6931,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } __pyx_L10:; - /* "sklearn/linear_model/cd_fast.pyx":615 + /* "sklearn/linear_model/cd_fast.pyx":618 * d_w_ii = diff_abs_max(n_tasks, * (W.data + ii * n_tasks * sizeof(DOUBLE)), * w_ii.data) # <<<<<<<<<<<<<< @@ -6935,7 +6940,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_d_w_ii = __pyx_f_7sklearn_12linear_model_7cd_fast_diff_abs_max(__pyx_v_n_tasks, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)(__pyx_v_W->data + ((__pyx_v_ii * __pyx_v_n_tasks) * (sizeof(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE))))), ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_w_ii->data)); - /* "sklearn/linear_model/cd_fast.pyx":616 + /* "sklearn/linear_model/cd_fast.pyx":619 * (W.data + ii * n_tasks * sizeof(DOUBLE)), * w_ii.data) * if d_w_ii > d_w_max: # <<<<<<<<<<<<<< @@ -6945,7 +6950,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_t_9 = (__pyx_v_d_w_ii > __pyx_v_d_w_max); if (__pyx_t_9) { - /* "sklearn/linear_model/cd_fast.pyx":617 + /* "sklearn/linear_model/cd_fast.pyx":620 * w_ii.data) * if d_w_ii > d_w_max: * d_w_max = d_w_ii # <<<<<<<<<<<<<< @@ -6957,7 +6962,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } __pyx_L11:; - /* "sklearn/linear_model/cd_fast.pyx":620 + /* "sklearn/linear_model/cd_fast.pyx":623 * * W_ii_abs_max = abs_max(n_tasks, * (W.data + ii * n_tasks * sizeof(DOUBLE))) # <<<<<<<<<<<<<< @@ -6966,7 +6971,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_W_ii_abs_max = __pyx_f_7sklearn_12linear_model_7cd_fast_abs_max(__pyx_v_n_tasks, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)(__pyx_v_W->data + ((__pyx_v_ii * __pyx_v_n_tasks) * (sizeof(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE)))))); - /* "sklearn/linear_model/cd_fast.pyx":621 + /* "sklearn/linear_model/cd_fast.pyx":624 * W_ii_abs_max = abs_max(n_tasks, * (W.data + ii * n_tasks * sizeof(DOUBLE))) * if W_ii_abs_max > w_max: # <<<<<<<<<<<<<< @@ -6976,7 +6981,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_t_9 = (__pyx_v_W_ii_abs_max > __pyx_v_w_max); if (__pyx_t_9) { - /* "sklearn/linear_model/cd_fast.pyx":622 + /* "sklearn/linear_model/cd_fast.pyx":625 * (W.data + ii * n_tasks * sizeof(DOUBLE))) * if W_ii_abs_max > w_max: * w_max = W_ii_abs_max # <<<<<<<<<<<<<< @@ -6990,7 +6995,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_L6_continue:; } - /* "sklearn/linear_model/cd_fast.pyx":624 + /* "sklearn/linear_model/cd_fast.pyx":627 * w_max = W_ii_abs_max * * if w_max == 0.0 or d_w_max / w_max < d_w_tol or n_iter == max_iter - 1: # <<<<<<<<<<<<<< @@ -7012,21 +7017,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } if (__pyx_t_20) { - /* "sklearn/linear_model/cd_fast.pyx":629 + /* "sklearn/linear_model/cd_fast.pyx":632 * # criterion * * XtA = np.dot(X.T, R) - l2_reg * W.T # <<<<<<<<<<<<<< * dual_norm_XtA = np.max(np.sqrt(np.sum(XtA ** 2, axis=1))) * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -7034,19 +7039,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_R)); __Pyx_GIVEREF(((PyObject *)__pyx_v_R)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_l2_reg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_l2_reg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_W), __pyx_n_s__T); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_W), __pyx_n_s__T); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -7054,58 +7059,58 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_v_XtA = __pyx_t_6; __pyx_t_6 = 0; - /* "sklearn/linear_model/cd_fast.pyx":630 + /* "sklearn/linear_model/cd_fast.pyx":633 * * XtA = np.dot(X.T, R) - l2_reg * W.T * dual_norm_XtA = np.max(np.sqrt(np.sum(XtA ** 2, axis=1))) # <<<<<<<<<<<<<< * * # TODO: use squared L2 norm directly */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__max); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__max); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Power(__pyx_v_XtA, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Power(__pyx_v_XtA, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __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 = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 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 = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __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_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__axis), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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 = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_23); __Pyx_GIVEREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__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 = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_23); __Pyx_GIVEREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; @@ -7113,7 +7118,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_v_dual_norm_XtA = __pyx_t_23; __pyx_t_23 = 0; - /* "sklearn/linear_model/cd_fast.pyx":635 + /* "sklearn/linear_model/cd_fast.pyx":638 * # R_norm = linalg.norm(R, ord='fro') * # w_norm = linalg.norm(W, ord='fro') * R_norm = dnrm2(n_samples * n_tasks, R.data, 1) # <<<<<<<<<<<<<< @@ -7122,7 +7127,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_R_norm = cblas_dnrm2((__pyx_v_n_samples * __pyx_v_n_tasks), ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_R->data), 1); - /* "sklearn/linear_model/cd_fast.pyx":636 + /* "sklearn/linear_model/cd_fast.pyx":639 * # w_norm = linalg.norm(W, ord='fro') * R_norm = dnrm2(n_samples * n_tasks, R.data, 1) * w_norm = dnrm2(n_features * n_tasks, W.data, 1) # <<<<<<<<<<<<<< @@ -7131,95 +7136,95 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc */ __pyx_v_w_norm = cblas_dnrm2((__pyx_v_n_features * __pyx_v_n_tasks), ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_W->data), 1); - /* "sklearn/linear_model/cd_fast.pyx":637 + /* "sklearn/linear_model/cd_fast.pyx":640 * R_norm = dnrm2(n_samples * n_tasks, R.data, 1) * w_norm = dnrm2(n_features * n_tasks, W.data, 1) * if (dual_norm_XtA > l1_reg): # <<<<<<<<<<<<<< * const = l1_reg / dual_norm_XtA * A_norm = R_norm * const */ - __pyx_t_23 = PyFloat_FromDouble(__pyx_v_l1_reg); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyFloat_FromDouble(__pyx_v_l1_reg); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_6 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_23, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_23, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_20 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_20 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_20) { - /* "sklearn/linear_model/cd_fast.pyx":638 + /* "sklearn/linear_model/cd_fast.pyx":641 * w_norm = dnrm2(n_features * n_tasks, W.data, 1) * if (dual_norm_XtA > l1_reg): * const = l1_reg / dual_norm_XtA # <<<<<<<<<<<<<< * A_norm = R_norm * const * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) */ - __pyx_t_6 = PyFloat_FromDouble(__pyx_v_l1_reg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(__pyx_v_l1_reg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_23 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_23; __pyx_t_23 = 0; - /* "sklearn/linear_model/cd_fast.pyx":639 + /* "sklearn/linear_model/cd_fast.pyx":642 * if (dual_norm_XtA > l1_reg): * const = l1_reg / dual_norm_XtA * A_norm = R_norm * const # <<<<<<<<<<<<<< * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) * else: */ - __pyx_t_23 = PyFloat_FromDouble(__pyx_v_R_norm); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyFloat_FromDouble(__pyx_v_R_norm); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_6 = PyNumber_Multiply(__pyx_t_23, __pyx_v_const); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Multiply(__pyx_t_23, __pyx_v_const); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_XDECREF(__pyx_v_A_norm); __pyx_v_A_norm = __pyx_t_6; __pyx_t_6 = 0; - /* "sklearn/linear_model/cd_fast.pyx":640 + /* "sklearn/linear_model/cd_fast.pyx":643 * const = l1_reg / dual_norm_XtA * A_norm = R_norm * const * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) # <<<<<<<<<<<<<< * else: * const = 1.0 */ - __pyx_t_6 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_23 = PyFloat_FromDouble(pow(__pyx_v_R_norm, 2.0)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyFloat_FromDouble(pow(__pyx_v_R_norm, 2.0)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_5 = PyNumber_Power(__pyx_v_A_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Power(__pyx_v_A_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyNumber_Add(__pyx_t_23, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_t_23, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_gap = __pyx_t_24; goto __pyx_L14; } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":642 + /* "sklearn/linear_model/cd_fast.pyx":645 * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) * else: * const = 1.0 # <<<<<<<<<<<<<< * gap = R_norm ** 2 * */ - __pyx_t_5 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/linear_model/cd_fast.pyx":643 + /* "sklearn/linear_model/cd_fast.pyx":646 * else: * const = 1.0 * gap = R_norm ** 2 # <<<<<<<<<<<<<< @@ -7230,122 +7235,122 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } __pyx_L14:; - /* "sklearn/linear_model/cd_fast.pyx":645 + /* "sklearn/linear_model/cd_fast.pyx":648 * gap = R_norm ** 2 * * gap += l1_reg * np.sqrt(np.sum(W ** 2, axis=0)).sum() - const * np.sum(R * Y) + \ # <<<<<<<<<<<<<< * 0.5 * l2_reg * (1 + const ** 2) * (w_norm ** 2) * */ - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_l1_reg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_l1_reg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_23 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Power(((PyObject *)__pyx_v_W), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Power(((PyObject *)__pyx_v_W), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __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 = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __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 = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_25 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_25 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_25); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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 = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_25); __Pyx_GIVEREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = PyObject_Call(__pyx_t_23, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_25 = PyObject_Call(__pyx_t_23, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_25); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_GetAttr(__pyx_t_25, __pyx_n_s__sum); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_25, __pyx_n_s__sum); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_25 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_25); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_25); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_25); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_25 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_25); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_25, __pyx_n_s__sum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_25, __pyx_n_s__sum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = PyNumber_Multiply(((PyObject *)__pyx_v_R), ((PyObject *)__pyx_v_Y)); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_25 = PyNumber_Multiply(((PyObject *)__pyx_v_R), ((PyObject *)__pyx_v_Y)); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_25); - __pyx_t_23 = PyTuple_New(1); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyTuple_New(1); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_25); __Pyx_GIVEREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_25 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_23), NULL); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_25); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0; - __pyx_t_23 = PyNumber_Multiply(__pyx_v_const, __pyx_t_25); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyNumber_Multiply(__pyx_v_const, __pyx_t_25); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; - __pyx_t_25 = PyNumber_Subtract(__pyx_t_6, __pyx_t_23); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_25 = PyNumber_Subtract(__pyx_t_6, __pyx_t_23); if (unlikely(!__pyx_t_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_25); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - /* "sklearn/linear_model/cd_fast.pyx":646 + /* "sklearn/linear_model/cd_fast.pyx":649 * * gap += l1_reg * np.sqrt(np.sum(W ** 2, axis=0)).sum() - const * np.sum(R * Y) + \ * 0.5 * l2_reg * (1 + const ** 2) * (w_norm ** 2) # <<<<<<<<<<<<<< * * if gap < tol: */ - __pyx_t_23 = PyFloat_FromDouble((0.5 * __pyx_v_l2_reg)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyFloat_FromDouble((0.5 * __pyx_v_l2_reg)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_6 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Multiply(__pyx_t_23, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Multiply(__pyx_t_23, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyFloat_FromDouble(pow(__pyx_v_w_norm, 2.0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(pow(__pyx_v_w_norm, 2.0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_23 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_25, __pyx_t_23); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_t_25, __pyx_t_23); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0; __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_23); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_23); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __pyx_v_gap = __pyx_t_24; - /* "sklearn/linear_model/cd_fast.pyx":648 + /* "sklearn/linear_model/cd_fast.pyx":651 * 0.5 * l2_reg * (1 + const ** 2) * (w_norm ** 2) * * if gap < tol: # <<<<<<<<<<<<<< @@ -7355,7 +7360,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc __pyx_t_20 = (__pyx_v_gap < __pyx_v_tol); if (__pyx_t_20) { - /* "sklearn/linear_model/cd_fast.pyx":650 + /* "sklearn/linear_model/cd_fast.pyx":653 * if gap < tol: * # return if we reached desired tolerance * break # <<<<<<<<<<<<<< @@ -7372,17 +7377,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } __pyx_L5_break:; - /* "sklearn/linear_model/cd_fast.pyx":652 + /* "sklearn/linear_model/cd_fast.pyx":655 * break * * return W, gap, tol # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_23 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_W)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_W)); @@ -7443,8 +7448,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_8enet_coordinate_desc } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -7788,8 +7793,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset @@ -7864,7 +7871,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: @@ -8259,8 +8267,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -9536,11 +9544,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { }; static int __Pyx_InitCachedBuiltins(void) { #if PY_MAJOR_VERSION >= 3 - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -9552,42 +9560,42 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/linear_model/cd_fast.pyx":143 + /* "sklearn/linear_model/cd_fast.pyx":146 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); - /* "sklearn/linear_model/cd_fast.pyx":420 + /* "sklearn/linear_model/cd_fast.pyx":423 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "sklearn/linear_model/cd_fast.pyx":561 + /* "sklearn/linear_model/cd_fast.pyx":564 * * if l1_reg == 0: * warnings.warn("Coordinate descent with l1_reg=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_6)); @@ -9678,14 +9686,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_18)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); - /* "sklearn/linear_model/cd_fast.pyx":64 + /* "sklearn/linear_model/cd_fast.pyx":67 * @cython.wraparound(False) * @cython.cdivision(True) * def sparse_std(unsigned int n_samples, # <<<<<<<<<<<<<< * unsigned int n_features, * np.ndarray[DOUBLE, ndim=1] X_data, */ - __pyx_k_tuple_22 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_22 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_22); __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__n_samples)); @@ -9730,16 +9738,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_22, 13, ((PyObject *)__pyx_n_s__X_std)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_std)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); - __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(6, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__sparse_std, 64, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(6, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__sparse_std, 67, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/linear_model/cd_fast.pyx":106 + /* "sklearn/linear_model/cd_fast.pyx":109 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< * double alpha, double beta, * np.ndarray[DOUBLE, ndim=2] X, */ - __pyx_k_tuple_26 = PyTuple_New(27); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_26 = PyTuple_New(27); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_26); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__w)); @@ -9823,16 +9831,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_26, 26, ((PyObject *)__pyx_n_s__A_norm2)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A_norm2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); - __pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(8, 0, 27, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s_28, 106, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(8, 0, 27, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s_28, 109, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/linear_model/cd_fast.pyx":224 + /* "sklearn/linear_model/cd_fast.pyx":227 * @cython.wraparound(False) * @cython.cdivision(True) * def sparse_enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< * double alpha, double beta, * np.ndarray[DOUBLE, ndim=1] X_data, */ - __pyx_k_tuple_29 = PyTuple_New(35); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_29 = PyTuple_New(35); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_29); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_n_s__w)); @@ -9940,16 +9948,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_29, 34, ((PyObject *)__pyx_n_s__A_norm2)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A_norm2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); - __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(11, 0, 35, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s_31, 224, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(11, 0, 35, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s_31, 227, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/linear_model/cd_fast.pyx":379 + /* "sklearn/linear_model/cd_fast.pyx":382 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_gram(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< * double alpha, double beta, * np.ndarray[DOUBLE, ndim=2] Q, */ - __pyx_k_tuple_32 = PyTuple_New(29); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_32 = PyTuple_New(29); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_32); __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_n_s__w)); @@ -10039,16 +10047,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_32, 28, ((PyObject *)__pyx_n_s__A_norm2)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A_norm2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); - __pyx_k_codeobj_33 = (PyObject*)__Pyx_PyCode_New(9, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s_34, 379, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_33 = (PyObject*)__Pyx_PyCode_New(9, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s_34, 382, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/linear_model/cd_fast.pyx":522 + /* "sklearn/linear_model/cd_fast.pyx":525 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_multi_task(np.ndarray[DOUBLE, ndim=2, mode='fortran'] W, # <<<<<<<<<<<<<< * double l1_reg, double l2_reg, * np.ndarray[DOUBLE, ndim=2, mode='fortran'] X, */ - __pyx_k_tuple_35 = PyTuple_New(29); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_35 = PyTuple_New(29); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_35); __Pyx_INCREF(((PyObject *)__pyx_n_s__W)); PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_n_s__W)); @@ -10138,7 +10146,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_35, 28, ((PyObject *)__pyx_n_s__A_norm)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A_norm)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); - __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(7, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s_37, 522, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(7, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s_37, 525, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -10204,6 +10212,14 @@ PyMODINIT_FUNC PyInit_cd_fast(void) __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__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.linear_model.cd_fast")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.linear_model.cd_fast", __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); @@ -10241,134 +10257,143 @@ PyMODINIT_FUNC PyInit_cd_fast(void) /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "sklearn/linear_model/cd_fast.pyx":9 - * + /* "sklearn/linear_model/cd_fast.pyx":10 + * from libc.math cimport fabs, sqrt * cimport numpy as np * import numpy as np # <<<<<<<<<<<<<< * import numpy.linalg as linalg - * cimport cython + * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":10 + /* "sklearn/linear_model/cd_fast.pyx":11 * cimport numpy as np * import numpy as np * import numpy.linalg as linalg # <<<<<<<<<<<<<< + * * cimport cython - * from cpython cimport bool */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(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); __Pyx_INCREF(((PyObject *)__pyx_n_s_21)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_21)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s_21)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_20), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_20), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__linalg, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__linalg, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":13 + /* "sklearn/linear_model/cd_fast.pyx":15 * cimport cython * from cpython cimport bool * import warnings # <<<<<<<<<<<<<< * - * cdef extern from "math.h": + * np.import_array() */ - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":64 + /* "sklearn/linear_model/cd_fast.pyx":17 + * import warnings + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/linear_model/cd_fast.pyx":67 * @cython.wraparound(False) * @cython.cdivision(True) * def sparse_std(unsigned int n_samples, # <<<<<<<<<<<<<< * unsigned int n_features, * np.ndarray[DOUBLE, ndim=1] X_data, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_1sparse_std, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_1sparse_std, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sparse_std, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sparse_std, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":110 + /* "sklearn/linear_model/cd_fast.pyx":113 * np.ndarray[DOUBLE, ndim=2] X, * np.ndarray[DOUBLE, ndim=1] y, * int max_iter, double tol, bool positive=False): # <<<<<<<<<<<<<< * """Cython version of the coordinate descent algorithm * for Elastic-Net regression */ - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_1 = ((PyBoolObject *)__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":106 + /* "sklearn/linear_model/cd_fast.pyx":109 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< * double alpha, double beta, * np.ndarray[DOUBLE, ndim=2] X, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_3enet_coordinate_descent, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_3enet_coordinate_descent, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_28, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_28, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":224 + /* "sklearn/linear_model/cd_fast.pyx":227 * @cython.wraparound(False) * @cython.cdivision(True) * def sparse_enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< * double alpha, double beta, * np.ndarray[DOUBLE, ndim=1] X_data, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_5sparse_enet_coordinate_descent, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_5sparse_enet_coordinate_descent, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_31, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_31, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":384 + /* "sklearn/linear_model/cd_fast.pyx":387 * np.ndarray[DOUBLE, ndim=1] q, * np.ndarray[DOUBLE, ndim=1] y, * int max_iter, double tol, bool positive=False): # <<<<<<<<<<<<<< * """Cython version of the coordinate descent algorithm * for Elastic-Net regression */ - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_4 = ((PyBoolObject *)__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":379 + /* "sklearn/linear_model/cd_fast.pyx":382 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_gram(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< * double alpha, double beta, * np.ndarray[DOUBLE, ndim=2] Q, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_7enet_coordinate_descent_gram, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_7enet_coordinate_descent_gram, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_34, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_34, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":522 + /* "sklearn/linear_model/cd_fast.pyx":525 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_multi_task(np.ndarray[DOUBLE, ndim=2, mode='fortran'] W, # <<<<<<<<<<<<<< * double l1_reg, double l2_reg, * np.ndarray[DOUBLE, ndim=2, mode='fortran'] X, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_9enet_coordinate_descent_multi_task, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_9enet_coordinate_descent_multi_task, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_37, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_37, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/linear_model/cd_fast.pyx":1 diff --git a/sklearn/linear_model/cd_fast.pyx b/sklearn/linear_model/cd_fast.pyx index 2b9ea21ac7314..ad1e6be3fe05f 100644 --- a/sklearn/linear_model/cd_fast.pyx +++ b/sklearn/linear_model/cd_fast.pyx @@ -5,22 +5,24 @@ # # License: BSD Style. +from libc.math cimport fabs, sqrt cimport numpy as np import numpy as np import numpy.linalg as linalg + cimport cython from cpython cimport bool import warnings -cdef extern from "math.h": - double fabs(double f) - double sqrt(double f) +np.import_array() + cdef inline double fmax(double x, double y): if x > y: return x return y + cdef inline double fsign(double f): if f == 0: return 0 @@ -29,6 +31,7 @@ cdef inline double fsign(double f): else: return -1.0 + cdef extern from "cblas.h": enum CBLAS_ORDER: CblasRowMajor=101 diff --git a/sklearn/linear_model/sgd_fast.c b/sklearn/linear_model/sgd_fast.c index 55c2465403b80..f85b95921d1e6 100644 --- a/sklearn/linear_model/sgd_fast.c +++ b/sklearn/linear_model/sgd_fast.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Thu Jan 3 07:55:28 2013 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:29:40 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #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 PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #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) #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) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 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_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])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -232,11 +251,11 @@ #include #define __PYX_HAVE__sklearn__linear_model__sgd_fast #define __PYX_HAVE_API__sklearn__linear_model__sgd_fast +#include "math.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#include "math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -267,7 +286,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -291,8 +310,12 @@ 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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -317,7 +340,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -327,7 +349,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -335,20 +356,56 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "sgd_fast.pyx", "numpy.pxd", + "type.pxd", "weight_vector.pxd", "seq_dataset.pxd", }; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; -/* "numpy.pxd":719 + +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -357,7 +414,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -366,7 +423,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -375,7 +432,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -384,7 +441,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -393,7 +450,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -402,7 +459,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -411,7 +468,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -420,7 +477,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -429,7 +486,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -438,7 +495,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.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 # <<<<<<<<<<<<<< @@ -447,7 +504,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -456,7 +513,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -465,7 +522,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -474,7 +531,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -483,7 +540,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -492,7 +549,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -501,7 +558,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -510,7 +567,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -519,7 +576,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -528,7 +585,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -573,8 +630,8 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE; */ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER; -/* "sklearn/linear_model/sgd_fast.pyx":29 - * cdef extern double fabs(double x) +/* "sklearn/linear_model/sgd_fast.pyx":25 + * * * ctypedef np.float64_t DOUBLE # <<<<<<<<<<<<<< * ctypedef np.int32_t INTEGER @@ -582,7 +639,7 @@ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER; */ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE; -/* "sklearn/linear_model/sgd_fast.pyx":30 +/* "sklearn/linear_model/sgd_fast.pyx":26 * * ctypedef np.float64_t DOUBLE * ctypedef np.int32_t INTEGER # <<<<<<<<<<<<<< @@ -590,7 +647,6 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBL * */ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -611,6 +667,7 @@ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction; struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression; @@ -628,7 +685,7 @@ struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector; struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss; struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -637,7 +694,7 @@ struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -646,7 +703,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -655,7 +712,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -664,7 +721,7 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "sklearn/linear_model/sgd_fast.pyx":50 +/* "sklearn/linear_model/sgd_fast.pyx":46 * # ---------------------------------------- * * cdef class LossFunction: # <<<<<<<<<<<<<< @@ -677,7 +734,7 @@ struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction { }; -/* "sklearn/linear_model/sgd_fast.pyx":88 +/* "sklearn/linear_model/sgd_fast.pyx":84 * * * cdef class Regression(LossFunction): # <<<<<<<<<<<<<< @@ -689,7 +746,7 @@ struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression { }; -/* "sklearn/linear_model/sgd_fast.pyx":239 +/* "sklearn/linear_model/sgd_fast.pyx":235 * * * cdef class Huber(Regression): # <<<<<<<<<<<<<< @@ -716,7 +773,7 @@ struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset { }; -/* "sklearn/linear_model/sgd_fast.pyx":275 +/* "sklearn/linear_model/sgd_fast.pyx":271 * * * cdef class EpsilonInsensitive(Regression): # <<<<<<<<<<<<<< @@ -729,7 +786,7 @@ struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive { }; -/* "sklearn/linear_model/sgd_fast.pyx":98 +/* "sklearn/linear_model/sgd_fast.pyx":94 * * * cdef class Classification(LossFunction): # <<<<<<<<<<<<<< @@ -764,7 +821,7 @@ struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset { }; -/* "sklearn/linear_model/sgd_fast.pyx":202 +/* "sklearn/linear_model/sgd_fast.pyx":198 * * * cdef class Log(Classification): # <<<<<<<<<<<<<< @@ -776,7 +833,7 @@ struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log { }; -/* "sklearn/linear_model/sgd_fast.pyx":138 +/* "sklearn/linear_model/sgd_fast.pyx":134 * * * cdef class Hinge(Classification): # <<<<<<<<<<<<<< @@ -811,7 +868,7 @@ struct __pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset { }; -/* "sklearn/linear_model/sgd_fast.pyx":170 +/* "sklearn/linear_model/sgd_fast.pyx":166 * * * cdef class SquaredHinge(LossFunction): # <<<<<<<<<<<<<< @@ -824,7 +881,7 @@ struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge { }; -/* "sklearn/linear_model/sgd_fast.pyx":108 +/* "sklearn/linear_model/sgd_fast.pyx":104 * * * cdef class ModifiedHuber(Classification): # <<<<<<<<<<<<<< @@ -854,7 +911,7 @@ struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector { }; -/* "sklearn/linear_model/sgd_fast.pyx":227 +/* "sklearn/linear_model/sgd_fast.pyx":223 * * * cdef class SquaredLoss(Regression): # <<<<<<<<<<<<<< @@ -866,7 +923,7 @@ struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss { }; -/* "sklearn/linear_model/sgd_fast.pyx":302 +/* "sklearn/linear_model/sgd_fast.pyx":298 * * * cdef class SquaredEpsilonInsensitive(Regression): # <<<<<<<<<<<<<< @@ -880,7 +937,7 @@ struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive { -/* "sklearn/linear_model/sgd_fast.pyx":50 +/* "sklearn/linear_model/sgd_fast.pyx":46 * # ---------------------------------------- * * cdef class LossFunction: # <<<<<<<<<<<<<< @@ -895,7 +952,7 @@ struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction { static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction; -/* "sklearn/linear_model/sgd_fast.pyx":88 +/* "sklearn/linear_model/sgd_fast.pyx":84 * * * cdef class Regression(LossFunction): # <<<<<<<<<<<<<< @@ -909,7 +966,7 @@ struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression { static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; -/* "sklearn/linear_model/sgd_fast.pyx":227 +/* "sklearn/linear_model/sgd_fast.pyx":223 * * * cdef class SquaredLoss(Regression): # <<<<<<<<<<<<<< @@ -923,7 +980,7 @@ struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss { static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredLoss; -/* "sklearn/linear_model/sgd_fast.pyx":98 +/* "sklearn/linear_model/sgd_fast.pyx":94 * * * cdef class Classification(LossFunction): # <<<<<<<<<<<<<< @@ -937,7 +994,7 @@ struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification { static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification; -/* "sklearn/linear_model/sgd_fast.pyx":108 +/* "sklearn/linear_model/sgd_fast.pyx":104 * * * cdef class ModifiedHuber(Classification): # <<<<<<<<<<<<<< @@ -951,7 +1008,7 @@ struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber { static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_ModifiedHuber; -/* "sklearn/linear_model/sgd_fast.pyx":202 +/* "sklearn/linear_model/sgd_fast.pyx":198 * * * cdef class Log(Classification): # <<<<<<<<<<<<<< @@ -965,7 +1022,7 @@ struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log { static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Log; -/* "sklearn/linear_model/sgd_fast.pyx":302 +/* "sklearn/linear_model/sgd_fast.pyx":298 * * * cdef class SquaredEpsilonInsensitive(Regression): # <<<<<<<<<<<<<< @@ -1022,7 +1079,7 @@ struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset { static struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset *__pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset; -/* "sklearn/linear_model/sgd_fast.pyx":275 +/* "sklearn/linear_model/sgd_fast.pyx":271 * * * cdef class EpsilonInsensitive(Regression): # <<<<<<<<<<<<<< @@ -1036,7 +1093,7 @@ struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive { static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive; -/* "sklearn/linear_model/sgd_fast.pyx":170 +/* "sklearn/linear_model/sgd_fast.pyx":166 * * * cdef class SquaredHinge(LossFunction): # <<<<<<<<<<<<<< @@ -1050,7 +1107,7 @@ struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge { static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredHinge; -/* "sklearn/linear_model/sgd_fast.pyx":239 +/* "sklearn/linear_model/sgd_fast.pyx":235 * * * cdef class Huber(Regression): # <<<<<<<<<<<<<< @@ -1064,7 +1121,7 @@ struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber { static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Huber; -/* "sklearn/linear_model/sgd_fast.pyx":138 +/* "sklearn/linear_model/sgd_fast.pyx":134 * * * cdef class Hinge(Classification): # <<<<<<<<<<<<<< @@ -1094,12 +1151,9 @@ struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector { double (*norm)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *); }; static struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector; - - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -1112,8 +1166,21 @@ static struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__p static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -1124,7 +1191,7 @@ static struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__p #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1135,6 +1202,8 @@ static struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__p #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ @@ -1146,44 +1215,23 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static 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, const char *name, int exact); /*proto*/ -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; @@ -1191,94 +1239,126 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j Py_DECREF(j); return r; } - - #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - - #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { /* inlined PySequence_GetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } + return m->sq_item(o, i); + } } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); } - return r; +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + #if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); #else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release #endif -Py_ssize_t __Pyx_zeros[] = {0}; -Py_ssize_t __Pyx_minusones[] = {-1}; + +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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); + static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ -#if PY_MAJOR_VERSION >= 3 +#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 static PyObject* __pyx_print = 0; static PyObject* __pyx_print_kwargs = 0; #endif @@ -1297,7 +1377,6 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -1423,17 +1502,42 @@ static int __Pyx_check_binary_version(void); static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'libc.math' */ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -1442,6 +1546,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -1452,16 +1561,7 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ - -/* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ @@ -1489,7 +1589,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_max(double static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_min(double, double); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *, __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *, int); /*proto*/ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *, __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *, __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *, int, double); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE = { "DOUBLE", NULL, sizeof(__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE = { "DOUBLE", NULL, sizeof(__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE), { 0 }, 0, 'R', 0, 0 }; #define __Pyx_MODULE_NAME "sklearn.linear_model.sgd_fast" int __pyx_module_is_main_sklearn__linear_model__sgd_fast = 0; @@ -1498,6 +1598,44 @@ static PyObject *__pyx_builtin_NotImplementedError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_threshold); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_threshold); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_c); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_epsilon); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_epsilon); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, double __pyx_v_intercept, struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_loss, int __pyx_v_penalty_type, double __pyx_v_alpha, double __pyx_v_C, double __pyx_v_rho, struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *__pyx_v_dataset, int __pyx_v_n_iter, int __pyx_v_fit_intercept, int __pyx_v_verbose, int __pyx_v_shuffle, PyObject *__pyx_v_seed, double __pyx_v_weight_pos, double __pyx_v_weight_neg, int __pyx_v_learning_rate, double __pyx_v_eta0, double __pyx_v_power_t, double __pyx_v_t, double __pyx_v_intercept_decay); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "-- Epoch %d"; static char __pyx_k_2[] = "Norm: %.2f, NNZs: %d, Bias: %.6f, T: %d, Avg. loss: %.6f"; static char __pyx_k_3[] = "Total training time: %.2f seconds."; @@ -1508,7 +1646,8 @@ static char __pyx_k_10[] = "Non-native byte order not supported"; static char __pyx_k_12[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_13[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_16[] = "Format string allocated too short."; -static char __pyx_k_18[] = "sklearn.linear_model.sgd_fast"; +static char __pyx_k_20[] = "/scratch/apps/src/scikit-learn/sklearn/linear_model/sgd_fast.pyx"; +static char __pyx_k_21[] = "sklearn.linear_model.sgd_fast"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; static char __pyx_k__H[] = "H"; @@ -1527,21 +1666,27 @@ static char __pyx_k__l[] = "l"; static char __pyx_k__p[] = "p"; static char __pyx_k__q[] = "q"; static char __pyx_k__t[] = "t"; +static char __pyx_k__u[] = "u"; +static char __pyx_k__w[] = "w"; 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__any[] = "any"; +static char __pyx_k__eta[] = "eta"; static char __pyx_k__rho[] = "rho"; static char __pyx_k__sys[] = "sys"; static char __pyx_k__eta0[] = "eta0"; static char __pyx_k__loss[] = "loss"; static char __pyx_k__seed[] = "seed"; static char __pyx_k__time[] = "time"; +static char __pyx_k__xnnz[] = "xnnz"; static char __pyx_k__alpha[] = "alpha"; +static char __pyx_k__count[] = "count"; static char __pyx_k__dloss[] = "dloss"; static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__epoch[] = "epoch"; static char __pyx_k__isinf[] = "isinf"; static char __pyx_k__isnan[] = "isnan"; static char __pyx_k__numpy[] = "numpy"; @@ -1550,26 +1695,37 @@ static char __pyx_k__range[] = "range"; static char __pyx_k__shape[] = "shape"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__n_iter[] = "n_iter"; +static char __pyx_k__update[] = "update"; static char __pyx_k__dataset[] = "dataset"; static char __pyx_k__epsilon[] = "epsilon"; static char __pyx_k__float64[] = "float64"; static char __pyx_k__nonzero[] = "nonzero"; static char __pyx_k__power_t[] = "power_t"; static char __pyx_k__shuffle[] = "shuffle"; +static char __pyx_k__sumloss[] = "sumloss"; +static char __pyx_k__t_start[] = "t_start"; static char __pyx_k__verbose[] = "verbose"; static char __pyx_k__weights[] = "weights"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__is_hinge[] = "is_hinge"; static char __pyx_k__intercept[] = "intercept"; +static char __pyx_k__n_samples[] = "n_samples"; static char __pyx_k__plain_sgd[] = "plain_sgd"; static char __pyx_k__threshold[] = "threshold"; +static char __pyx_k__x_ind_ptr[] = "x_ind_ptr"; static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__n_features[] = "n_features"; +static char __pyx_k__q_data_ptr[] = "q_data_ptr"; static char __pyx_k__weight_neg[] = "weight_neg"; static char __pyx_k__weight_pos[] = "weight_pos"; +static char __pyx_k__x_data_ptr[] = "x_data_ptr"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__class_weight[] = "class_weight"; static char __pyx_k__penalty_type[] = "penalty_type"; static char __pyx_k__fit_intercept[] = "fit_intercept"; static char __pyx_k__learning_rate[] = "learning_rate"; +static char __pyx_k__sample_weight[] = "sample_weight"; static char __pyx_k__intercept_decay[] = "intercept_decay"; static char __pyx_k__NotImplementedError[] = "NotImplementedError"; static PyObject *__pyx_kp_s_1; @@ -1577,8 +1733,9 @@ static PyObject *__pyx_kp_u_10; static PyObject *__pyx_kp_u_12; static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_u_16; -static PyObject *__pyx_n_s_18; static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_20; +static PyObject *__pyx_n_s_21; static PyObject *__pyx_kp_s_3; static PyObject *__pyx_kp_s_4; static PyObject *__pyx_kp_u_6; @@ -1592,20 +1749,28 @@ static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__alpha; static PyObject *__pyx_n_s__any; static PyObject *__pyx_n_s__c; +static PyObject *__pyx_n_s__class_weight; +static PyObject *__pyx_n_s__count; static PyObject *__pyx_n_s__dataset; static PyObject *__pyx_n_s__dloss; static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__epoch; static PyObject *__pyx_n_s__epsilon; +static PyObject *__pyx_n_s__eta; static PyObject *__pyx_n_s__eta0; static PyObject *__pyx_n_s__fit_intercept; static PyObject *__pyx_n_s__float64; +static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__intercept; static PyObject *__pyx_n_s__intercept_decay; +static PyObject *__pyx_n_s__is_hinge; static PyObject *__pyx_n_s__isinf; static PyObject *__pyx_n_s__isnan; static PyObject *__pyx_n_s__learning_rate; static PyObject *__pyx_n_s__loss; +static PyObject *__pyx_n_s__n_features; static PyObject *__pyx_n_s__n_iter; +static PyObject *__pyx_n_s__n_samples; static PyObject *__pyx_n_s__nonzero; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; @@ -1614,19 +1779,30 @@ static PyObject *__pyx_n_s__p; static PyObject *__pyx_n_s__penalty_type; static PyObject *__pyx_n_s__plain_sgd; static PyObject *__pyx_n_s__power_t; +static PyObject *__pyx_n_s__q; +static PyObject *__pyx_n_s__q_data_ptr; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__rho; +static PyObject *__pyx_n_s__sample_weight; static PyObject *__pyx_n_s__seed; static PyObject *__pyx_n_s__shape; static PyObject *__pyx_n_s__shuffle; +static PyObject *__pyx_n_s__sumloss; static PyObject *__pyx_n_s__sys; static PyObject *__pyx_n_s__t; +static PyObject *__pyx_n_s__t_start; static PyObject *__pyx_n_s__threshold; static PyObject *__pyx_n_s__time; +static PyObject *__pyx_n_s__u; +static PyObject *__pyx_n_s__update; static PyObject *__pyx_n_s__verbose; +static PyObject *__pyx_n_s__w; static PyObject *__pyx_n_s__weight_neg; static PyObject *__pyx_n_s__weight_pos; static PyObject *__pyx_n_s__weights; +static PyObject *__pyx_n_s__x_data_ptr; +static PyObject *__pyx_n_s__x_ind_ptr; +static PyObject *__pyx_n_s__xnnz; static PyObject *__pyx_n_s__y; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_15; @@ -1637,8 +1813,10 @@ static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_codeobj_19; -/* "sklearn/linear_model/sgd_fast.pyx":53 +/* "sklearn/linear_model/sgd_fast.pyx":49 * """Base class for convex loss functions""" * * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -1646,8 +1824,8 @@ static PyObject *__pyx_k_tuple_17; * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1658,30 +1836,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(stru int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -1690,18 +1868,18 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(stru __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":68 + /* "sklearn/linear_model/sgd_fast.pyx":64 * The loss evaluated at `p` and `y`. * """ * raise NotImplementedError() # <<<<<<<<<<<<<< * * cpdef double dloss(self, double p, double y): */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); 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_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; @@ -1717,52 +1895,40 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(stru return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":53 - * """Base class for convex loss functions""" - * - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * """Evaluate the loss function. - * - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss[] = "Evaluate the loss function.\n\n Parameters\n ----------\n p : double\n The prediction, p = w^T x\n y : double\n The true value (aka target)\n\n Returns\n -------\n double\n The loss evaluated at `p` and `y`.\n "; -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1770,23 +1936,44 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss( values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.LossFunction.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self)->__pyx_vtab)->loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __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 = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":49 + * """Base class for convex loss functions""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * """Evaluate the loss function. + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self->__pyx_vtab)->loss(__pyx_v_self, __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __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; @@ -1800,7 +1987,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss( return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":70 +/* "sklearn/linear_model/sgd_fast.pyx":66 * raise NotImplementedError() * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -1808,8 +1995,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss( * the prediction `p`. */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1820,30 +2007,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_dloss(str int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); 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); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -1852,18 +2039,18 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_dloss(str __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":85 + /* "sklearn/linear_model/sgd_fast.pyx":81 * The derivative of the loss function w.r.t. `p`. * """ * raise NotImplementedError() # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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 = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; @@ -1879,52 +2066,40 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_dloss(str return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":70 - * raise NotImplementedError() - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * """Evaluate the derivative of the loss function with respect to - * the prediction `p`. - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dloss[] = "Evaluate the derivative of the loss function with respect to\n the prediction `p`.\n\n Parameters\n ----------\n p : double\n The prediction, p = w^T x\n y : double\n The true value (aka target)\n Returns\n -------\n double\n The derivative of the loss function w.r.t. `p`.\n "; -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss[] = "Evaluate the derivative of the loss function with respect to\n the prediction `p`.\n\n Parameters\n ----------\n p : double\n The prediction, p = w^T x\n y : double\n The true value (aka target)\n Returns\n -------\n double\n The derivative of the loss function w.r.t. `p`.\n "; +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1932,19 +2107,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dlos values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.LossFunction.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":66 + * raise NotImplementedError() + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * """Evaluate the derivative of the loss function with respect to + * the prediction `p`. + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self)->__pyx_vtab)->dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self->__pyx_vtab)->dloss(__pyx_v_self, __pyx_v_p, __pyx_v_y, 1)); 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_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1962,7 +2158,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dlos return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":91 +/* "sklearn/linear_model/sgd_fast.pyx":87 * """Base class for loss functions for regression""" * * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -1970,8 +2166,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dlos * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1982,30 +2178,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_loss(struct int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2014,18 +2210,18 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_loss(struct __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":92 + /* "sklearn/linear_model/sgd_fast.pyx":88 * * cpdef double loss(self, double p, double y): * raise NotImplementedError() # <<<<<<<<<<<<<< * * cpdef double dloss(self, double p, double y): */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; @@ -2041,51 +2237,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_loss(struct return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":91 - * """Base class for loss functions for regression""" - * - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * raise NotImplementedError() - * - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2093,19 +2277,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(Py values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Regression.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":87 + * """Base class for loss functions for regression""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2123,7 +2328,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(Py return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":94 +/* "sklearn/linear_model/sgd_fast.pyx":90 * raise NotImplementedError() * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -2131,8 +2336,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(Py * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2143,30 +2348,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_dloss(struc int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_1dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2175,18 +2380,18 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_dloss(struc __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":95 + /* "sklearn/linear_model/sgd_fast.pyx":91 * * cpdef double dloss(self, double p, double y): * raise NotImplementedError() # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __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 = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; @@ -2202,51 +2407,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_dloss(struc return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":94 - * raise NotImplementedError() - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * raise NotImplementedError() - * - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2254,19 +2447,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_1dloss( values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Regression.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":90 + * raise NotImplementedError() + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2284,7 +2498,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_1dloss( return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":101 +/* "sklearn/linear_model/sgd_fast.pyx":97 * """Base class for loss functions for classification""" * * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -2292,8 +2506,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_1dloss( * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2304,30 +2518,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_loss(st int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2336,18 +2550,18 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_loss(st __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":102 + /* "sklearn/linear_model/sgd_fast.pyx":98 * * cpdef double loss(self, double p, double y): * raise NotImplementedError() # <<<<<<<<<<<<<< * * cpdef double dloss(self, double p, double y): */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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 = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; @@ -2363,51 +2577,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_loss(st return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":101 - * """Base class for loss functions for classification""" - * - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * raise NotImplementedError() - * - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2415,19 +2617,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_los values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Classification.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":97 + * """Base class for loss functions for classification""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2445,7 +2668,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_los return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":104 +/* "sklearn/linear_model/sgd_fast.pyx":100 * raise NotImplementedError() * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -2453,8 +2676,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_los * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2465,30 +2688,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_dloss(s int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_1dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2497,18 +2720,18 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_dloss(s __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":105 + /* "sklearn/linear_model/sgd_fast.pyx":101 * * cpdef double dloss(self, double p, double y): * raise NotImplementedError() # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = 0; goto __pyx_L0; @@ -2524,51 +2747,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_dloss(s return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":104 - * raise NotImplementedError() - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * raise NotImplementedError() - * - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2576,19 +2787,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_1dl values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Classification.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":100 + * raise NotImplementedError() + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2606,7 +2838,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_1dl return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":116 +/* "sklearn/linear_model/sgd_fast.pyx":112 * Stochastic Gradient Descent', ICML'04. * """ * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -2614,8 +2846,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_1dl * if z >= 1.0: */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_z; double __pyx_r; __Pyx_RefNannyDeclarations @@ -2628,30 +2860,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(str int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2660,7 +2892,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(str __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":117 + /* "sklearn/linear_model/sgd_fast.pyx":113 * """ * cpdef double loss(self, double p, double y): * cdef double z = p * y # <<<<<<<<<<<<<< @@ -2669,7 +2901,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(str */ __pyx_v_z = (__pyx_v_p * __pyx_v_y); - /* "sklearn/linear_model/sgd_fast.pyx":118 + /* "sklearn/linear_model/sgd_fast.pyx":114 * cpdef double loss(self, double p, double y): * cdef double z = p * y * if z >= 1.0: # <<<<<<<<<<<<<< @@ -2679,7 +2911,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(str __pyx_t_6 = (__pyx_v_z >= 1.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":119 + /* "sklearn/linear_model/sgd_fast.pyx":115 * cdef double z = p * y * if z >= 1.0: * return 0.0 # <<<<<<<<<<<<<< @@ -2691,7 +2923,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(str goto __pyx_L3; } - /* "sklearn/linear_model/sgd_fast.pyx":120 + /* "sklearn/linear_model/sgd_fast.pyx":116 * if z >= 1.0: * return 0.0 * elif z >= -1.0: # <<<<<<<<<<<<<< @@ -2701,7 +2933,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(str __pyx_t_6 = (__pyx_v_z >= -1.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":121 + /* "sklearn/linear_model/sgd_fast.pyx":117 * return 0.0 * elif z >= -1.0: * return (1.0 - z) * (1.0 - z) # <<<<<<<<<<<<<< @@ -2714,7 +2946,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(str } /*else*/ { - /* "sklearn/linear_model/sgd_fast.pyx":123 + /* "sklearn/linear_model/sgd_fast.pyx":119 * return (1.0 - z) * (1.0 - z) * else: * return -4.0 * z # <<<<<<<<<<<<<< @@ -2740,51 +2972,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(str return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":116 - * Stochastic Gradient Descent', ICML'04. - * """ - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double z = p * y - * if z >= 1.0: - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2792,19 +3012,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.ModifiedHuber.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":112 + * Stochastic Gradient Descent', ICML'04. + * """ + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z >= 1.0: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2822,7 +3063,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":125 +/* "sklearn/linear_model/sgd_fast.pyx":121 * return -4.0 * z * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -2830,8 +3071,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss * if z >= 1.0: */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_z; double __pyx_r; __Pyx_RefNannyDeclarations @@ -2844,30 +3085,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(st int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2876,7 +3117,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(st __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":126 + /* "sklearn/linear_model/sgd_fast.pyx":122 * * cpdef double dloss(self, double p, double y): * cdef double z = p * y # <<<<<<<<<<<<<< @@ -2885,7 +3126,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(st */ __pyx_v_z = (__pyx_v_p * __pyx_v_y); - /* "sklearn/linear_model/sgd_fast.pyx":127 + /* "sklearn/linear_model/sgd_fast.pyx":123 * cpdef double dloss(self, double p, double y): * cdef double z = p * y * if z >= 1.0: # <<<<<<<<<<<<<< @@ -2895,7 +3136,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(st __pyx_t_6 = (__pyx_v_z >= 1.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":128 + /* "sklearn/linear_model/sgd_fast.pyx":124 * cdef double z = p * y * if z >= 1.0: * return 0.0 # <<<<<<<<<<<<<< @@ -2907,7 +3148,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(st goto __pyx_L3; } - /* "sklearn/linear_model/sgd_fast.pyx":129 + /* "sklearn/linear_model/sgd_fast.pyx":125 * if z >= 1.0: * return 0.0 * elif z >= -1.0: # <<<<<<<<<<<<<< @@ -2917,7 +3158,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(st __pyx_t_6 = (__pyx_v_z >= -1.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":130 + /* "sklearn/linear_model/sgd_fast.pyx":126 * return 0.0 * elif z >= -1.0: * return 2.0 * (1.0 - z) * -y # <<<<<<<<<<<<<< @@ -2930,7 +3171,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(st } /*else*/ { - /* "sklearn/linear_model/sgd_fast.pyx":132 + /* "sklearn/linear_model/sgd_fast.pyx":128 * return 2.0 * (1.0 - z) * -y * else: * return -4.0 * y # <<<<<<<<<<<<<< @@ -2956,51 +3197,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(st return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":125 - * return -4.0 * z - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double z = p * y - * if z >= 1.0: - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3008,19 +3237,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1dlo values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.ModifiedHuber.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":121 + * return -4.0 * z + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z >= 1.0: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3038,25 +3288,35 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1dlo return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":134 - * return -4.0 * y +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_5__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_12linear_model_8sgd_fast_13ModifiedHuber_4__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":130 + * return -4.0 * y * * def __reduce__(self): # <<<<<<<<<<<<<< * return ModifiedHuber, () * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce__"); + __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/linear_model/sgd_fast.pyx":135 + /* "sklearn/linear_model/sgd_fast.pyx":131 * * def __reduce__(self): * return ModifiedHuber, () # <<<<<<<<<<<<<< @@ -3064,8 +3324,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2__r * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber))); @@ -3088,35 +3348,26 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2__r return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":151 - * cdef double threshold - * - * def __init__(self, double threshold=1.0): # <<<<<<<<<<<<<< - * self.threshold = threshold - * - */ - -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_threshold; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__threshold,0}; - __Pyx_RefNannySetupContext("__init__"); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__threshold,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__threshold); @@ -3124,7 +3375,7 @@ static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(PyObject * } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3134,35 +3385,52 @@ static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(PyObject * } } if (values[0]) { - __pyx_v_threshold = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_threshold = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { + + /* "sklearn/linear_model/sgd_fast.pyx":147 + * cdef double threshold + * + * def __init__(self, double threshold=1.0): # <<<<<<<<<<<<<< + * self.threshold = threshold + * + */ __pyx_v_threshold = ((double)1.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Hinge.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self), __pyx_v_threshold); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "sklearn/linear_model/sgd_fast.pyx":152 +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_threshold) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":148 * * def __init__(self, double threshold=1.0): * self.threshold = threshold # <<<<<<<<<<<<<< * * cpdef double loss(self, double p, double y): */ - ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self)->threshold = __pyx_v_threshold; + __pyx_v_self->threshold = __pyx_v_threshold; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":154 +/* "sklearn/linear_model/sgd_fast.pyx":150 * self.threshold = threshold * * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -3170,7 +3438,7 @@ static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(PyObject * * if z <= self.threshold: */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_z; double __pyx_r; @@ -3184,30 +3452,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss(struct __pyx int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_1loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3216,7 +3484,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss(struct __pyx __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":155 + /* "sklearn/linear_model/sgd_fast.pyx":151 * * cpdef double loss(self, double p, double y): * cdef double z = p * y # <<<<<<<<<<<<<< @@ -3225,7 +3493,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss(struct __pyx */ __pyx_v_z = (__pyx_v_p * __pyx_v_y); - /* "sklearn/linear_model/sgd_fast.pyx":156 + /* "sklearn/linear_model/sgd_fast.pyx":152 * cpdef double loss(self, double p, double y): * cdef double z = p * y * if z <= self.threshold: # <<<<<<<<<<<<<< @@ -3235,7 +3503,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss(struct __pyx __pyx_t_6 = (__pyx_v_z <= __pyx_v_self->threshold); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":157 + /* "sklearn/linear_model/sgd_fast.pyx":153 * cdef double z = p * y * if z <= self.threshold: * return (self.threshold - z) # <<<<<<<<<<<<<< @@ -3248,7 +3516,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss(struct __pyx } __pyx_L3:; - /* "sklearn/linear_model/sgd_fast.pyx":158 + /* "sklearn/linear_model/sgd_fast.pyx":154 * if z <= self.threshold: * return (self.threshold - z) * return 0.0 # <<<<<<<<<<<<<< @@ -3272,51 +3540,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss(struct __pyx return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":154 - * self.threshold = threshold - * - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double z = p * y - * if z <= self.threshold: - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3324,19 +3580,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_1loss(PyObjec values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Hinge.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":150 + * self.threshold = threshold + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z <= self.threshold: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Hinge *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3354,7 +3631,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_1loss(PyObjec return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":160 +/* "sklearn/linear_model/sgd_fast.pyx":156 * return 0.0 * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -3362,7 +3639,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_1loss(PyObjec * if z <= self.threshold: */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_z; double __pyx_r; @@ -3376,30 +3653,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss(struct __py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3408,7 +3685,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":161 + /* "sklearn/linear_model/sgd_fast.pyx":157 * * cpdef double dloss(self, double p, double y): * cdef double z = p * y # <<<<<<<<<<<<<< @@ -3417,7 +3694,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss(struct __py */ __pyx_v_z = (__pyx_v_p * __pyx_v_y); - /* "sklearn/linear_model/sgd_fast.pyx":162 + /* "sklearn/linear_model/sgd_fast.pyx":158 * cpdef double dloss(self, double p, double y): * cdef double z = p * y * if z <= self.threshold: # <<<<<<<<<<<<<< @@ -3427,7 +3704,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss(struct __py __pyx_t_6 = (__pyx_v_z <= __pyx_v_self->threshold); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":163 + /* "sklearn/linear_model/sgd_fast.pyx":159 * cdef double z = p * y * if z <= self.threshold: * return -y # <<<<<<<<<<<<<< @@ -3440,7 +3717,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss(struct __py } __pyx_L3:; - /* "sklearn/linear_model/sgd_fast.pyx":164 + /* "sklearn/linear_model/sgd_fast.pyx":160 * if z <= self.threshold: * return -y * return 0.0 # <<<<<<<<<<<<<< @@ -3464,51 +3741,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss(struct __py return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":160 - * return 0.0 - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double z = p * y - * if z <= self.threshold: - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3516,19 +3781,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2dloss(PyObje values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Hinge.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":156 + * return 0.0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z <= self.threshold: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Hinge *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3546,7 +3832,18 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2dloss(PyObje return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":166 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_7__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_12linear_model_8sgd_fast_5Hinge_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":162 * return 0.0 * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -3554,8 +3851,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2dloss(PyObje * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3563,9 +3859,9 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_3__reduce__(P int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce__"); + __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/linear_model/sgd_fast.pyx":167 + /* "sklearn/linear_model/sgd_fast.pyx":163 * * def __reduce__(self): * return Hinge, (self.threshold,) # <<<<<<<<<<<<<< @@ -3573,15 +3869,15 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_3__reduce__(P * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self)->threshold); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->threshold); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __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 = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge))); @@ -3605,35 +3901,26 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_3__reduce__(P return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":183 - * cdef double threshold - * - * def __init__(self, double threshold=1.0): # <<<<<<<<<<<<<< - * self.threshold = threshold - * - */ - -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_threshold; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__threshold,0}; - __Pyx_RefNannySetupContext("__init__"); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__threshold,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__threshold); @@ -3641,7 +3928,7 @@ static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(Py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3651,35 +3938,52 @@ static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(Py } } if (values[0]) { - __pyx_v_threshold = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_threshold = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { + + /* "sklearn/linear_model/sgd_fast.pyx":179 + * cdef double threshold + * + * def __init__(self, double threshold=1.0): # <<<<<<<<<<<<<< + * self.threshold = threshold + * + */ __pyx_v_threshold = ((double)1.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredHinge.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self), __pyx_v_threshold); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "sklearn/linear_model/sgd_fast.pyx":184 +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_threshold) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":180 * * def __init__(self, double threshold=1.0): * self.threshold = threshold # <<<<<<<<<<<<<< * * cpdef double loss(self, double p, double y): */ - ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self)->threshold = __pyx_v_threshold; + __pyx_v_self->threshold = __pyx_v_threshold; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":186 +/* "sklearn/linear_model/sgd_fast.pyx":182 * self.threshold = threshold * * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -3687,7 +3991,7 @@ static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(Py * if z > 0: */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_z; double __pyx_r; @@ -3701,30 +4005,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss(stru int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3733,7 +4037,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss(stru __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":187 + /* "sklearn/linear_model/sgd_fast.pyx":183 * * cpdef double loss(self, double p, double y): * cdef double z = self.threshold - p * y # <<<<<<<<<<<<<< @@ -3742,7 +4046,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss(stru */ __pyx_v_z = (__pyx_v_self->threshold - (__pyx_v_p * __pyx_v_y)); - /* "sklearn/linear_model/sgd_fast.pyx":188 + /* "sklearn/linear_model/sgd_fast.pyx":184 * cpdef double loss(self, double p, double y): * cdef double z = self.threshold - p * y * if z > 0: # <<<<<<<<<<<<<< @@ -3752,7 +4056,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss(stru __pyx_t_6 = (__pyx_v_z > 0.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":189 + /* "sklearn/linear_model/sgd_fast.pyx":185 * cdef double z = self.threshold - p * y * if z > 0: * return z * z # <<<<<<<<<<<<<< @@ -3765,7 +4069,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss(stru } __pyx_L3:; - /* "sklearn/linear_model/sgd_fast.pyx":190 + /* "sklearn/linear_model/sgd_fast.pyx":186 * if z > 0: * return z * z * return 0.0 # <<<<<<<<<<<<<< @@ -3789,51 +4093,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss(stru return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":186 - * self.threshold = threshold - * - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double z = self.threshold - p * y - * if z > 0: - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3841,19 +4133,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1loss values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredHinge.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":182 + * self.threshold = threshold + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = self.threshold - p * y + * if z > 0: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3871,7 +4184,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1loss return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":192 +/* "sklearn/linear_model/sgd_fast.pyx":188 * return 0.0 * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -3879,7 +4192,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1loss * if z > 0: */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_z; double __pyx_r; @@ -3893,30 +4206,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss(str int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3925,7 +4238,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss(str __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":193 + /* "sklearn/linear_model/sgd_fast.pyx":189 * * cpdef double dloss(self, double p, double y): * cdef double z = self.threshold - p * y # <<<<<<<<<<<<<< @@ -3934,7 +4247,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss(str */ __pyx_v_z = (__pyx_v_self->threshold - (__pyx_v_p * __pyx_v_y)); - /* "sklearn/linear_model/sgd_fast.pyx":194 + /* "sklearn/linear_model/sgd_fast.pyx":190 * cpdef double dloss(self, double p, double y): * cdef double z = self.threshold - p * y * if z > 0: # <<<<<<<<<<<<<< @@ -3944,7 +4257,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss(str __pyx_t_6 = (__pyx_v_z > 0.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":195 + /* "sklearn/linear_model/sgd_fast.pyx":191 * cdef double z = self.threshold - p * y * if z > 0: * return -2 * y * z # <<<<<<<<<<<<<< @@ -3957,7 +4270,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss(str } __pyx_L3:; - /* "sklearn/linear_model/sgd_fast.pyx":196 + /* "sklearn/linear_model/sgd_fast.pyx":192 * if z > 0: * return -2 * y * z * return 0.0 # <<<<<<<<<<<<<< @@ -3981,51 +4294,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss(str return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":192 - * return 0.0 - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double z = self.threshold - p * y - * if z > 0: - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4033,19 +4334,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2dlos values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredHinge.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":188 + * return 0.0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = self.threshold - p * y + * if z > 0: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4063,7 +4385,18 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2dlos return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":198 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_7__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_12linear_model_8sgd_fast_12SquaredHinge_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":194 * return 0.0 * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -4071,8 +4404,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2dlos * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4080,9 +4412,9 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3__re int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce__"); + __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/linear_model/sgd_fast.pyx":199 + /* "sklearn/linear_model/sgd_fast.pyx":195 * * def __reduce__(self): * return SquaredHinge, (self.threshold,) # <<<<<<<<<<<<<< @@ -4090,15 +4422,15 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3__re * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self)->threshold); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->threshold); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __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 = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); 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); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge))); @@ -4122,7 +4454,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3__re return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":205 +/* "sklearn/linear_model/sgd_fast.pyx":201 * """Logistic regression loss for binary classification with y in {-1, 1}""" * * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -4130,8 +4462,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3__re * # approximately equal and saves the computation of the log */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_z; double __pyx_r; __Pyx_RefNannyDeclarations @@ -4144,30 +4476,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_o int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4176,7 +4508,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":206 + /* "sklearn/linear_model/sgd_fast.pyx":202 * * cpdef double loss(self, double p, double y): * cdef double z = p * y # <<<<<<<<<<<<<< @@ -4185,7 +4517,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_o */ __pyx_v_z = (__pyx_v_p * __pyx_v_y); - /* "sklearn/linear_model/sgd_fast.pyx":208 + /* "sklearn/linear_model/sgd_fast.pyx":204 * cdef double z = p * y * # approximately equal and saves the computation of the log * if z > 18: # <<<<<<<<<<<<<< @@ -4195,7 +4527,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_o __pyx_t_6 = (__pyx_v_z > 18.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":209 + /* "sklearn/linear_model/sgd_fast.pyx":205 * # approximately equal and saves the computation of the log * if z > 18: * return exp(-z) # <<<<<<<<<<<<<< @@ -4208,7 +4540,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_o } __pyx_L3:; - /* "sklearn/linear_model/sgd_fast.pyx":210 + /* "sklearn/linear_model/sgd_fast.pyx":206 * if z > 18: * return exp(-z) * if z < -18: # <<<<<<<<<<<<<< @@ -4218,7 +4550,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_o __pyx_t_6 = (__pyx_v_z < -18.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":211 + /* "sklearn/linear_model/sgd_fast.pyx":207 * return exp(-z) * if z < -18: * return -z # <<<<<<<<<<<<<< @@ -4231,7 +4563,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_o } __pyx_L4:; - /* "sklearn/linear_model/sgd_fast.pyx":212 + /* "sklearn/linear_model/sgd_fast.pyx":208 * if z < -18: * return -z * return log(1.0 + exp(-z)) # <<<<<<<<<<<<<< @@ -4255,51 +4587,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_o return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":205 - * """Logistic regression loss for binary classification with y in {-1, 1}""" - * - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double z = p * y - * # approximately equal and saves the computation of the log - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4307,19 +4627,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(PyObject * values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Log.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":201 + * """Logistic regression loss for binary classification with y in {-1, 1}""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * # approximately equal and saves the computation of the log + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4337,7 +4678,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(PyObject * return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":214 +/* "sklearn/linear_model/sgd_fast.pyx":210 * return log(1.0 + exp(-z)) * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -4345,8 +4686,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(PyObject * * # approximately equal and saves the computation of the log */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_z; double __pyx_r; __Pyx_RefNannyDeclarations @@ -4359,30 +4700,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_1dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4391,7 +4732,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(struct __pyx_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":215 + /* "sklearn/linear_model/sgd_fast.pyx":211 * * cpdef double dloss(self, double p, double y): * cdef double z = p * y # <<<<<<<<<<<<<< @@ -4400,7 +4741,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(struct __pyx_ */ __pyx_v_z = (__pyx_v_p * __pyx_v_y); - /* "sklearn/linear_model/sgd_fast.pyx":217 + /* "sklearn/linear_model/sgd_fast.pyx":213 * cdef double z = p * y * # approximately equal and saves the computation of the log * if z > 18.0: # <<<<<<<<<<<<<< @@ -4410,7 +4751,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(struct __pyx_ __pyx_t_6 = (__pyx_v_z > 18.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":218 + /* "sklearn/linear_model/sgd_fast.pyx":214 * # approximately equal and saves the computation of the log * if z > 18.0: * return exp(-z) * -y # <<<<<<<<<<<<<< @@ -4423,7 +4764,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(struct __pyx_ } __pyx_L3:; - /* "sklearn/linear_model/sgd_fast.pyx":219 + /* "sklearn/linear_model/sgd_fast.pyx":215 * if z > 18.0: * return exp(-z) * -y * if z < -18.0: # <<<<<<<<<<<<<< @@ -4433,7 +4774,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(struct __pyx_ __pyx_t_6 = (__pyx_v_z < -18.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":220 + /* "sklearn/linear_model/sgd_fast.pyx":216 * return exp(-z) * -y * if z < -18.0: * return -y # <<<<<<<<<<<<<< @@ -4446,7 +4787,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(struct __pyx_ } __pyx_L4:; - /* "sklearn/linear_model/sgd_fast.pyx":221 + /* "sklearn/linear_model/sgd_fast.pyx":217 * if z < -18.0: * return -y * return -y / (exp(z) + 1.0) # <<<<<<<<<<<<<< @@ -4470,51 +4811,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(struct __pyx_ return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":214 - * return log(1.0 + exp(-z)) - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double z = p * y - * # approximately equal and saves the computation of the log - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4522,19 +4851,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_1dloss(PyObject values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Log.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":210 + * return log(1.0 + exp(-z)) + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * # approximately equal and saves the computation of the log + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4552,7 +4902,18 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_1dloss(PyObject return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":223 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_5__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_12linear_model_8sgd_fast_3Log_4__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":219 * return -y / (exp(z) + 1.0) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -4560,17 +4921,16 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_1dloss(PyObject * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce__"); + __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/linear_model/sgd_fast.pyx":224 + /* "sklearn/linear_model/sgd_fast.pyx":220 * * def __reduce__(self): * return Log, () # <<<<<<<<<<<<<< @@ -4578,8 +4938,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2__reduce__(PyO * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log))); @@ -4602,7 +4962,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2__reduce__(PyO return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":229 +/* "sklearn/linear_model/sgd_fast.pyx":225 * cdef class SquaredLoss(Regression): * """Squared loss traditional used in linear regression.""" * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -4610,8 +4970,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2__reduce__(PyO * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4622,30 +4982,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(struc int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4654,7 +5014,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(struc __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":230 + /* "sklearn/linear_model/sgd_fast.pyx":226 * """Squared loss traditional used in linear regression.""" * cpdef double loss(self, double p, double y): * return 0.5 * (p - y) * (p - y) # <<<<<<<<<<<<<< @@ -4678,51 +5038,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(struc return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":229 - * cdef class SquaredLoss(Regression): - * """Squared loss traditional used in linear regression.""" - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * return 0.5 * (p - y) * (p - y) - * - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4730,19 +5078,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(P values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredLoss.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":225 + * cdef class SquaredLoss(Regression): + * """Squared loss traditional used in linear regression.""" + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * return 0.5 * (p - y) * (p - y) + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4760,7 +5129,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(P return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":232 +/* "sklearn/linear_model/sgd_fast.pyx":228 * return 0.5 * (p - y) * (p - y) * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -4768,8 +5137,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(P * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4780,30 +5149,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_dloss(stru int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4812,7 +5181,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_dloss(stru __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":233 + /* "sklearn/linear_model/sgd_fast.pyx":229 * * cpdef double dloss(self, double p, double y): * return p - y # <<<<<<<<<<<<<< @@ -4836,51 +5205,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_dloss(stru return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":232 - * return 0.5 * (p - y) * (p - y) - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * return p - y - * - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4888,19 +5245,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1dloss values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredLoss.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":228 + * return 0.5 * (p - y) * (p - y) + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * return p - y + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4918,7 +5296,18 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1dloss return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":235 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_5__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_12linear_model_8sgd_fast_11SquaredLoss_4__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":231 * return p - y * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -4926,17 +5315,16 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1dloss * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce__"); + __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/linear_model/sgd_fast.pyx":236 + /* "sklearn/linear_model/sgd_fast.pyx":232 * * def __reduce__(self): * return SquaredLoss, () # <<<<<<<<<<<<<< @@ -4944,8 +5332,8 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2__red * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss))); @@ -4968,74 +5356,81 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2__red return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":250 - * cdef double c - * - * def __init__(self, double c): # <<<<<<<<<<<<<< - * self.c = c - * - */ - -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_c; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__c,0}; - __Pyx_RefNannySetupContext("__init__"); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__c,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_c = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_c == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_c = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_c == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Huber.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self), __pyx_v_c); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "sklearn/linear_model/sgd_fast.pyx":251 +/* "sklearn/linear_model/sgd_fast.pyx":246 + * cdef double c + * + * def __init__(self, double c): # <<<<<<<<<<<<<< + * self.c = c + * + */ + +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_c) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":247 * * def __init__(self, double c): * self.c = c # <<<<<<<<<<<<<< * * cpdef double loss(self, double p, double y): */ - ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self)->c = __pyx_v_c; + __pyx_v_self->c = __pyx_v_c; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":253 +/* "sklearn/linear_model/sgd_fast.pyx":249 * self.c = c * * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -5043,7 +5438,7 @@ static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(PyObject * * cdef double abs_r = abs(r) */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_r; double __pyx_v_abs_r; @@ -5058,30 +5453,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss(struct __pyx int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_1loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5090,7 +5485,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss(struct __pyx __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":254 + /* "sklearn/linear_model/sgd_fast.pyx":250 * * cpdef double loss(self, double p, double y): * cdef double r = p - y # <<<<<<<<<<<<<< @@ -5099,23 +5494,16 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss(struct __pyx */ __pyx_v_r = (__pyx_v_p - __pyx_v_y); - /* "sklearn/linear_model/sgd_fast.pyx":255 + /* "sklearn/linear_model/sgd_fast.pyx":251 * cpdef double loss(self, double p, double y): * cdef double r = p - y * cdef double abs_r = abs(r) # <<<<<<<<<<<<<< * if abs_r <= self.c: * return 0.5 * r * r */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_r); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_abs_r = __pyx_t_5; + __pyx_v_abs_r = fabs(__pyx_v_r); - /* "sklearn/linear_model/sgd_fast.pyx":256 + /* "sklearn/linear_model/sgd_fast.pyx":252 * cdef double r = p - y * cdef double abs_r = abs(r) * if abs_r <= self.c: # <<<<<<<<<<<<<< @@ -5125,7 +5513,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss(struct __pyx __pyx_t_6 = (__pyx_v_abs_r <= __pyx_v_self->c); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":257 + /* "sklearn/linear_model/sgd_fast.pyx":253 * cdef double abs_r = abs(r) * if abs_r <= self.c: * return 0.5 * r * r # <<<<<<<<<<<<<< @@ -5138,7 +5526,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss(struct __pyx } /*else*/ { - /* "sklearn/linear_model/sgd_fast.pyx":259 + /* "sklearn/linear_model/sgd_fast.pyx":255 * return 0.5 * r * r * else: * return self.c * abs_r - (0.5 * self.c * self.c) # <<<<<<<<<<<<<< @@ -5164,51 +5552,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss(struct __pyx return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":253 - * self.c = c - * - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double r = p - y - * cdef double abs_r = abs(r) - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5216,19 +5592,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_1loss(PyObjec values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Huber.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":249 + * self.c = c + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double r = p - y + * cdef double abs_r = abs(r) + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5246,7 +5643,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_1loss(PyObjec return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":261 +/* "sklearn/linear_model/sgd_fast.pyx":257 * return self.c * abs_r - (0.5 * self.c * self.c) * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -5254,7 +5651,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_1loss(PyObjec * cdef double abs_r = abs(r) */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_r; double __pyx_v_abs_r; @@ -5269,30 +5666,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5301,7 +5698,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":262 + /* "sklearn/linear_model/sgd_fast.pyx":258 * * cpdef double dloss(self, double p, double y): * cdef double r = p - y # <<<<<<<<<<<<<< @@ -5310,23 +5707,16 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __py */ __pyx_v_r = (__pyx_v_p - __pyx_v_y); - /* "sklearn/linear_model/sgd_fast.pyx":263 + /* "sklearn/linear_model/sgd_fast.pyx":259 * cpdef double dloss(self, double p, double y): * cdef double r = p - y * cdef double abs_r = abs(r) # <<<<<<<<<<<<<< * if abs_r <= self.c: * return r */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_r); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_abs_r = __pyx_t_5; + __pyx_v_abs_r = fabs(__pyx_v_r); - /* "sklearn/linear_model/sgd_fast.pyx":264 + /* "sklearn/linear_model/sgd_fast.pyx":260 * cdef double r = p - y * cdef double abs_r = abs(r) * if abs_r <= self.c: # <<<<<<<<<<<<<< @@ -5336,7 +5726,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __py __pyx_t_6 = (__pyx_v_abs_r <= __pyx_v_self->c); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":265 + /* "sklearn/linear_model/sgd_fast.pyx":261 * cdef double abs_r = abs(r) * if abs_r <= self.c: * return r # <<<<<<<<<<<<<< @@ -5348,7 +5738,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __py goto __pyx_L3; } - /* "sklearn/linear_model/sgd_fast.pyx":266 + /* "sklearn/linear_model/sgd_fast.pyx":262 * if abs_r <= self.c: * return r * elif r > 0.0: # <<<<<<<<<<<<<< @@ -5358,7 +5748,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __py __pyx_t_6 = (__pyx_v_r > 0.0); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":267 + /* "sklearn/linear_model/sgd_fast.pyx":263 * return r * elif r > 0.0: * return self.c # <<<<<<<<<<<<<< @@ -5371,7 +5761,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __py } /*else*/ { - /* "sklearn/linear_model/sgd_fast.pyx":269 + /* "sklearn/linear_model/sgd_fast.pyx":265 * return self.c * else: * return -self.c # <<<<<<<<<<<<<< @@ -5397,51 +5787,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __py return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":261 - * return self.c * abs_r - (0.5 * self.c * self.c) - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double r = p - y - * cdef double abs_r = abs(r) - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5449,19 +5827,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2dloss(PyObje values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Huber.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":257 + * return self.c * abs_r - (0.5 * self.c * self.c) + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double r = p - y + * cdef double abs_r = abs(r) + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5479,7 +5878,18 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2dloss(PyObje return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":271 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_7__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_12linear_model_8sgd_fast_5Huber_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":267 * return -self.c * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -5487,8 +5897,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2dloss(PyObje * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5496,9 +5905,9 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_3__reduce__(P int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce__"); + __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/linear_model/sgd_fast.pyx":272 + /* "sklearn/linear_model/sgd_fast.pyx":268 * * def __reduce__(self): * return Huber, (self.c,) # <<<<<<<<<<<<<< @@ -5506,15 +5915,15 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_3__reduce__(P * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self)->c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber))); @@ -5538,74 +5947,81 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_3__reduce__(P return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":283 - * cdef double epsilon - * - * def __init__(self, double epsilon): # <<<<<<<<<<<<<< - * self.epsilon = epsilon - * - */ - -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_epsilon; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__epsilon,0}; - __Pyx_RefNannySetupContext("__init__"); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__epsilon,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__epsilon); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__epsilon)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.EpsilonInsensitive.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self), __pyx_v_epsilon); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "sklearn/linear_model/sgd_fast.pyx":284 +/* "sklearn/linear_model/sgd_fast.pyx":279 + * cdef double epsilon + * + * def __init__(self, double epsilon): # <<<<<<<<<<<<<< + * self.epsilon = epsilon + * + */ + +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_epsilon) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":280 * * def __init__(self, double epsilon): * self.epsilon = epsilon # <<<<<<<<<<<<<< * * cpdef double loss(self, double p, double y): */ - ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self)->epsilon = __pyx_v_epsilon; + __pyx_v_self->epsilon = __pyx_v_epsilon; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":286 +/* "sklearn/linear_model/sgd_fast.pyx":282 * self.epsilon = epsilon * * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -5613,7 +6029,7 @@ static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___ini * return ret if ret > 0 else 0 */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_ret; double __pyx_r; @@ -5626,30 +6042,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_los int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5658,29 +6074,16 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_los __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":287 + /* "sklearn/linear_model/sgd_fast.pyx":283 * * cpdef double loss(self, double p, double y): * cdef double ret = abs(y - p) - self.epsilon # <<<<<<<<<<<<<< * return ret if ret > 0 else 0 * */ - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_y - __pyx_v_p)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->epsilon); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ret = __pyx_t_5; + __pyx_v_ret = (fabs((__pyx_v_y - __pyx_v_p)) - __pyx_v_self->epsilon); - /* "sklearn/linear_model/sgd_fast.pyx":288 + /* "sklearn/linear_model/sgd_fast.pyx":284 * cpdef double loss(self, double p, double y): * cdef double ret = abs(y - p) - self.epsilon * return ret if ret > 0 else 0 # <<<<<<<<<<<<<< @@ -5709,51 +6112,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_los return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":286 - * self.epsilon = epsilon - * - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double ret = abs(y - p) - self.epsilon - * return ret if ret > 0 else 0 - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5761,19 +6152,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.EpsilonInsensitive.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":282 + * self.epsilon = epsilon + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double ret = abs(y - p) - self.epsilon + * return ret if ret > 0 else 0 + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5791,7 +6203,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":290 +/* "sklearn/linear_model/sgd_fast.pyx":286 * return ret if ret > 0 else 0 * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -5799,7 +6211,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive * return -1 */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_r; __Pyx_RefNannyDeclarations @@ -5812,30 +6224,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dlo int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5844,7 +6256,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dlo __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":291 + /* "sklearn/linear_model/sgd_fast.pyx":287 * * cpdef double dloss(self, double p, double y): * if y - p > self.epsilon: # <<<<<<<<<<<<<< @@ -5854,7 +6266,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dlo __pyx_t_6 = ((__pyx_v_y - __pyx_v_p) > __pyx_v_self->epsilon); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":292 + /* "sklearn/linear_model/sgd_fast.pyx":288 * cpdef double dloss(self, double p, double y): * if y - p > self.epsilon: * return -1 # <<<<<<<<<<<<<< @@ -5866,7 +6278,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dlo goto __pyx_L3; } - /* "sklearn/linear_model/sgd_fast.pyx":293 + /* "sklearn/linear_model/sgd_fast.pyx":289 * if y - p > self.epsilon: * return -1 * elif p - y > self.epsilon: # <<<<<<<<<<<<<< @@ -5876,7 +6288,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dlo __pyx_t_6 = ((__pyx_v_p - __pyx_v_y) > __pyx_v_self->epsilon); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":294 + /* "sklearn/linear_model/sgd_fast.pyx":290 * return -1 * elif p - y > self.epsilon: * return 1 # <<<<<<<<<<<<<< @@ -5889,7 +6301,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dlo } /*else*/ { - /* "sklearn/linear_model/sgd_fast.pyx":296 + /* "sklearn/linear_model/sgd_fast.pyx":292 * return 1 * else: * return 0 # <<<<<<<<<<<<<< @@ -5915,51 +6327,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dlo return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":290 - * return ret if ret > 0 else 0 - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * if y - p > self.epsilon: - * return -1 - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5967,19 +6367,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.EpsilonInsensitive.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":286 + * return ret if ret > 0 else 0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * if y - p > self.epsilon: + * return -1 + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5997,7 +6418,18 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":298 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_7__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_12linear_model_8sgd_fast_18EpsilonInsensitive_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":294 * return 0 * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -6005,8 +6437,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6014,9 +6445,9 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce__"); + __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/linear_model/sgd_fast.pyx":299 + /* "sklearn/linear_model/sgd_fast.pyx":295 * * def __reduce__(self): * return EpsilonInsensitive, (self.epsilon,) # <<<<<<<<<<<<<< @@ -6024,15 +6455,15 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self)->epsilon); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->epsilon); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __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 = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive))); @@ -6056,74 +6487,81 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":310 - * cdef double epsilon - * - * def __init__(self, double epsilon): # <<<<<<<<<<<<<< - * self.epsilon = epsilon - * - */ - -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_epsilon; int __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__epsilon,0}; - __Pyx_RefNannySetupContext("__init__"); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__epsilon,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__epsilon); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__epsilon)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self), __pyx_v_epsilon); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "sklearn/linear_model/sgd_fast.pyx":311 +/* "sklearn/linear_model/sgd_fast.pyx":306 + * cdef double epsilon + * + * def __init__(self, double epsilon): # <<<<<<<<<<<<<< + * self.epsilon = epsilon + * + */ + +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_epsilon) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":307 * * def __init__(self, double epsilon): * self.epsilon = epsilon # <<<<<<<<<<<<<< * * cpdef double loss(self, double p, double y): */ - ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self)->epsilon = __pyx_v_epsilon; + __pyx_v_self->epsilon = __pyx_v_epsilon; __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":313 +/* "sklearn/linear_model/sgd_fast.pyx":309 * self.epsilon = epsilon * * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< @@ -6131,7 +6569,7 @@ static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitiv * return ret * ret if ret > 0 else 0 */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_ret; double __pyx_r; @@ -6144,30 +6582,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1loss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6176,29 +6614,16 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":314 + /* "sklearn/linear_model/sgd_fast.pyx":310 * * cpdef double loss(self, double p, double y): * cdef double ret = abs(y - p) - self.epsilon # <<<<<<<<<<<<<< * return ret * ret if ret > 0 else 0 * */ - __pyx_t_1 = PyFloat_FromDouble((__pyx_v_y - __pyx_v_p)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->epsilon); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ret = __pyx_t_5; + __pyx_v_ret = (fabs((__pyx_v_y - __pyx_v_p)) - __pyx_v_self->epsilon); - /* "sklearn/linear_model/sgd_fast.pyx":315 + /* "sklearn/linear_model/sgd_fast.pyx":311 * cpdef double loss(self, double p, double y): * cdef double ret = abs(y - p) - self.epsilon * return ret * ret if ret > 0 else 0 # <<<<<<<<<<<<<< @@ -6227,51 +6652,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":313 - * self.epsilon = epsilon - * - * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double ret = abs(y - p) - self.epsilon - * return ret * ret if ret > 0 else 0 - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("loss"); + __Pyx_RefNannySetupContext("loss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6279,19 +6692,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInse values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":309 + * self.epsilon = epsilon + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double ret = abs(y - p) - self.epsilon + * return ret * ret if ret > 0 else 0 + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6309,7 +6743,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInse return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":317 +/* "sklearn/linear_model/sgd_fast.pyx":313 * return ret * ret if ret > 0 else 0 * * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< @@ -6317,7 +6751,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInse * z = y - p */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { double __pyx_v_z; double __pyx_r; @@ -6331,30 +6765,30 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2dloss)) { - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __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 = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6363,7 +6797,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/linear_model/sgd_fast.pyx":319 + /* "sklearn/linear_model/sgd_fast.pyx":315 * cpdef double dloss(self, double p, double y): * cdef double z * z = y - p # <<<<<<<<<<<<<< @@ -6372,7 +6806,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit */ __pyx_v_z = (__pyx_v_y - __pyx_v_p); - /* "sklearn/linear_model/sgd_fast.pyx":320 + /* "sklearn/linear_model/sgd_fast.pyx":316 * cdef double z * z = y - p * if z > self.epsilon: # <<<<<<<<<<<<<< @@ -6382,7 +6816,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit __pyx_t_6 = (__pyx_v_z > __pyx_v_self->epsilon); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":321 + /* "sklearn/linear_model/sgd_fast.pyx":317 * z = y - p * if z > self.epsilon: * return -2 * (z - self.epsilon) # <<<<<<<<<<<<<< @@ -6394,7 +6828,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit goto __pyx_L3; } - /* "sklearn/linear_model/sgd_fast.pyx":322 + /* "sklearn/linear_model/sgd_fast.pyx":318 * if z > self.epsilon: * return -2 * (z - self.epsilon) * elif z < self.epsilon: # <<<<<<<<<<<<<< @@ -6404,7 +6838,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit __pyx_t_6 = (__pyx_v_z < __pyx_v_self->epsilon); if (__pyx_t_6) { - /* "sklearn/linear_model/sgd_fast.pyx":323 + /* "sklearn/linear_model/sgd_fast.pyx":319 * return -2 * (z - self.epsilon) * elif z < self.epsilon: * return 2 * (-z - self.epsilon) # <<<<<<<<<<<<<< @@ -6417,7 +6851,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit } /*else*/ { - /* "sklearn/linear_model/sgd_fast.pyx":325 + /* "sklearn/linear_model/sgd_fast.pyx":321 * return 2 * (-z - self.epsilon) * else: * return 0 # <<<<<<<<<<<<<< @@ -6443,51 +6877,39 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensit return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":317 - * return ret * ret if ret > 0 else 0 - * - * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< - * cdef double z - * z = y - p - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_p; double __pyx_v_y; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; - __Pyx_RefNannySetupContext("dloss"); + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6495,19 +6917,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInse values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":313 + * return ret * ret if ret > 0 else 0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z + * z = y - p + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6525,7 +6968,18 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInse return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":327 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_7__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_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":323 * return 0 * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -6533,8 +6987,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInse * */ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6542,9 +6995,9 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInse int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce__"); + __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/linear_model/sgd_fast.pyx":328 + /* "sklearn/linear_model/sgd_fast.pyx":324 * * def __reduce__(self): * return SquaredEpsilonInsensitive, (self.epsilon,) # <<<<<<<<<<<<<< @@ -6552,15 +7005,15 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInse * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self)->epsilon); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->epsilon); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __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 = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive))); @@ -6584,18 +7037,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInse return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":331 - * - * - * def plain_sgd(np.ndarray[DOUBLE, ndim=1, mode='c'] weights, # <<<<<<<<<<<<<< - * double intercept, - * LossFunction loss, - */ - -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_1plain_sgd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7sklearn_12linear_model_8sgd_fast_plain_sgd[] = "Plain SGD for generic loss functions and penalties.\n\n Parameters\n ----------\n weights : ndarray[double, ndim=1]\n The allocated coef_ vector.\n intercept : double\n The initial intercept.\n loss : LossFunction\n A concrete ``LossFunction`` object.\n penalty_type : int\n The penalty 2 for L2, 1 for L1, and 3 for Elastic-Net.\n alpha : float\n The regularization parameter.\n rho : float\n The elastic net hyperparameter.\n dataset : SequentialDataset\n A concrete ``SequentialDataset`` object.\n n_iter : int\n The number of iterations (epochs).\n fit_intercept : int\n Whether or not to fit the intercept (1 or 0).\n verbose : int\n Print verbose output; 0 for quite.\n shuffle : int\n Whether to shuffle the training data before each epoch.\n weight_pos : float\n The weight of the positive class.\n weight_neg : float\n The weight of the negative class.\n seed : int or RandomState object\n The seed of the pseudo random number generator to use when\n shuffling the data\n learning_rate : int\n The learning rate:\n (1) constant, eta = eta0\n (2) optimal, eta = 1.0/(t+t0)\n (3) inverse scaling, eta = eta0 / pow(t, power_t)\n (4) Passive Agressive-I, eta = min(alpha, loss/norm(x))\n (5) Passive Agressive-II, eta = 1.0 / (norm(x) + 0.5*alpha)\n eta0 : double\n The initial learning rate.\n power_t : double\n The exponent for inverse scaling learning rate.\n t : double\n Initial state of the learning rate. This value is equal to the\n iteration count except when the learning rate is set to `optimal`.\n Default: 1.0.\n\n Returns\n -------\n weights : array, shape=[n_features]\n The fitted weight vector.\n intercept : float\n The fitted intercept term.\n\n "; -static PyMethodDef __pyx_mdef_7sklearn_12linear_model_8sgd_fast_plain_sgd = {__Pyx_NAMESTR("plain_sgd"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_12linear_model_8sgd_fast_plain_sgd)}; -static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyMethodDef __pyx_mdef_7sklearn_12linear_model_8sgd_fast_1plain_sgd = {__Pyx_NAMESTR("plain_sgd"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_1plain_sgd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_12linear_model_8sgd_fast_plain_sgd)}; +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_1plain_sgd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_weights = 0; double __pyx_v_intercept; struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_loss = 0; @@ -6616,65 +7062,16 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * double __pyx_v_power_t; double __pyx_v_t; double __pyx_v_intercept_decay; - Py_ssize_t __pyx_v_n_samples; - Py_ssize_t __pyx_v_n_features; - struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *__pyx_v_w = 0; - __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_x_data_ptr; - __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *__pyx_v_x_ind_ptr; - int __pyx_v_xnnz; - double __pyx_v_eta; - double __pyx_v_p; - double __pyx_v_update; - double __pyx_v_sumloss; - __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE __pyx_v_y; - __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE __pyx_v_sample_weight; - double __pyx_v_class_weight; - unsigned int __pyx_v_count; - unsigned int __pyx_v_epoch; - unsigned int __pyx_v_i; - int __pyx_v_is_hinge; - PyArrayObject *__pyx_v_q = 0; - __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_q_data_ptr; - double __pyx_v_u; - PyObject *__pyx_v_t_start = NULL; - Py_buffer __pyx_bstruct_q; - Py_ssize_t __pyx_bstride_0_q = 0; - Py_ssize_t __pyx_bshape_0_q = 0; - Py_buffer __pyx_bstruct_weights; - Py_ssize_t __pyx_bstride_0_weights = 0; - Py_ssize_t __pyx_bshape_0_weights = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyArrayObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - unsigned int __pyx_t_12; - Py_ssize_t __pyx_t_13; - unsigned int __pyx_t_14; - PyObject *__pyx_t_15 = NULL; - int __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__intercept,&__pyx_n_s__loss,&__pyx_n_s__penalty_type,&__pyx_n_s__alpha,&__pyx_n_s__C,&__pyx_n_s__rho,&__pyx_n_s__dataset,&__pyx_n_s__n_iter,&__pyx_n_s__fit_intercept,&__pyx_n_s__verbose,&__pyx_n_s__shuffle,&__pyx_n_s__seed,&__pyx_n_s__weight_pos,&__pyx_n_s__weight_neg,&__pyx_n_s__learning_rate,&__pyx_n_s__eta0,&__pyx_n_s__power_t,&__pyx_n_s__t,&__pyx_n_s__intercept_decay,0}; - __Pyx_RefNannySetupContext("plain_sgd"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("plain_sgd (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__intercept,&__pyx_n_s__loss,&__pyx_n_s__penalty_type,&__pyx_n_s__alpha,&__pyx_n_s__C,&__pyx_n_s__rho,&__pyx_n_s__dataset,&__pyx_n_s__n_iter,&__pyx_n_s__fit_intercept,&__pyx_n_s__verbose,&__pyx_n_s__shuffle,&__pyx_n_s__seed,&__pyx_n_s__weight_pos,&__pyx_n_s__weight_neg,&__pyx_n_s__learning_rate,&__pyx_n_s__eta0,&__pyx_n_s__power_t,&__pyx_n_s__t,&__pyx_n_s__intercept_decay,0}; PyObject* values[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); @@ -6699,112 +7096,94 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loss); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loss)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty_type); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rho); - if (likely(values[6])) kw_args--; + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rho)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dataset); - if (likely(values[7])) kw_args--; + if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dataset)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_iter); - if (likely(values[8])) kw_args--; + if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_iter)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fit_intercept); - if (likely(values[9])) kw_args--; + if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fit_intercept)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 10: - values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__verbose); - if (likely(values[10])) kw_args--; + if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__verbose)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 11: - values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shuffle); - if (likely(values[11])) kw_args--; + if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shuffle)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 12: - values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed); - if (likely(values[12])) kw_args--; + if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 13: - values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_pos); - if (likely(values[13])) kw_args--; + if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_pos)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 14: - values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_neg); - if (likely(values[14])) kw_args--; + if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_neg)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 15: - values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__learning_rate); - if (likely(values[15])) kw_args--; + if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 16: - values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eta0); - if (likely(values[16])) kw_args--; + if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eta0)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 17: - values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__power_t); - if (likely(values[17])) kw_args--; + if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__power_t)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 18: if (kw_args > 0) { @@ -6818,7 +7197,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "plain_sgd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plain_sgd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6847,28 +7226,28 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * } } __pyx_v_weights = ((PyArrayObject *)values[0]); - __pyx_v_intercept = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_intercept == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_intercept = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_intercept == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_loss = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)values[2]); - __pyx_v_penalty_type = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_penalty_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_rho = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_penalty_type = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_penalty_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_rho = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_dataset = ((struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *)values[7]); - __pyx_v_n_iter = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_n_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_fit_intercept = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_fit_intercept == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_verbose = __Pyx_PyInt_AsInt(values[10]); if (unlikely((__pyx_v_verbose == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_shuffle = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_shuffle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_iter = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_n_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fit_intercept = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_fit_intercept == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_verbose = __Pyx_PyInt_AsInt(values[10]); if (unlikely((__pyx_v_verbose == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shuffle = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_shuffle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_seed = values[12]; - __pyx_v_weight_pos = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_weight_pos == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_weight_neg = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_weight_neg == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_learning_rate = __Pyx_PyInt_AsInt(values[15]); if (unlikely((__pyx_v_learning_rate == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eta0 = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_eta0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_power_t = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_power_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_weight_pos = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_weight_pos == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_weight_neg = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_weight_neg == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_learning_rate = __Pyx_PyInt_AsInt(values[15]); if (unlikely((__pyx_v_learning_rate == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eta0 = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_eta0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_power_t = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_power_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[18]) { - __pyx_v_t = __pyx_PyFloat_AsDouble(values[18]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_t = __pyx_PyFloat_AsDouble(values[18]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/linear_model/sgd_fast.pyx":343 + /* "sklearn/linear_model/sgd_fast.pyx":339 * int learning_rate, double eta0, * double power_t, * double t=1.0, # <<<<<<<<<<<<<< @@ -6878,10 +7257,10 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * __pyx_v_t = ((double)1.0); } if (values[19]) { - __pyx_v_intercept_decay = __pyx_PyFloat_AsDouble(values[19]); if (unlikely((__pyx_v_intercept_decay == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_intercept_decay = __pyx_PyFloat_AsDouble(values[19]); if (unlikely((__pyx_v_intercept_decay == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/linear_model/sgd_fast.pyx":344 + /* "sklearn/linear_model/sgd_fast.pyx":340 * double power_t, * double t=1.0, * double intercept_decay=1.0): # <<<<<<<<<<<<<< @@ -6893,34 +7272,108 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.plain_sgd", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_q.buf = NULL; - __pyx_bstruct_weights.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loss), __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction, 1, "loss", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dataset), __pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset, 1, "dataset", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loss), __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction, 1, "loss", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dataset), __pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset, 1, "dataset", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(__pyx_self, __pyx_v_weights, __pyx_v_intercept, __pyx_v_loss, __pyx_v_penalty_type, __pyx_v_alpha, __pyx_v_C, __pyx_v_rho, __pyx_v_dataset, __pyx_v_n_iter, __pyx_v_fit_intercept, __pyx_v_verbose, __pyx_v_shuffle, __pyx_v_seed, __pyx_v_weight_pos, __pyx_v_weight_neg, __pyx_v_learning_rate, __pyx_v_eta0, __pyx_v_power_t, __pyx_v_t, __pyx_v_intercept_decay); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":327 + * + * + * def plain_sgd(np.ndarray[DOUBLE, ndim=1, mode='c'] weights, # <<<<<<<<<<<<<< + * double intercept, + * LossFunction loss, + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, double __pyx_v_intercept, struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_loss, int __pyx_v_penalty_type, double __pyx_v_alpha, double __pyx_v_C, double __pyx_v_rho, struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *__pyx_v_dataset, int __pyx_v_n_iter, int __pyx_v_fit_intercept, int __pyx_v_verbose, int __pyx_v_shuffle, PyObject *__pyx_v_seed, double __pyx_v_weight_pos, double __pyx_v_weight_neg, int __pyx_v_learning_rate, double __pyx_v_eta0, double __pyx_v_power_t, double __pyx_v_t, double __pyx_v_intercept_decay) { + Py_ssize_t __pyx_v_n_samples; + Py_ssize_t __pyx_v_n_features; + struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *__pyx_v_w = 0; + __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_x_data_ptr; + __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *__pyx_v_x_ind_ptr; + int __pyx_v_xnnz; + double __pyx_v_eta; + double __pyx_v_p; + double __pyx_v_update; + double __pyx_v_sumloss; + __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE __pyx_v_y; + __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE __pyx_v_sample_weight; + double __pyx_v_class_weight; + unsigned int __pyx_v_count; + unsigned int __pyx_v_epoch; + CYTHON_UNUSED unsigned int __pyx_v_i; + int __pyx_v_is_hinge; + PyArrayObject *__pyx_v_q = 0; + __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_q_data_ptr; + double __pyx_v_u; + PyObject *__pyx_v_t_start = NULL; + __Pyx_LocalBuf_ND __pyx_pybuffernd_q; + __Pyx_Buffer __pyx_pybuffer_q; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyArrayObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + unsigned int __pyx_t_13; + unsigned int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("plain_sgd", 0); + __pyx_pybuffer_q.pybuffer.buf = NULL; + __pyx_pybuffer_q.refcount = 0; + __pyx_pybuffernd_q.data = NULL; + __pyx_pybuffernd_q.rcbuffer = &__pyx_pybuffer_q; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_weights, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_weights = __pyx_bstruct_weights.strides[0]; - __pyx_bshape_0_weights = __pyx_bstruct_weights.shape[0]; + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; - /* "sklearn/linear_model/sgd_fast.pyx":404 + /* "sklearn/linear_model/sgd_fast.pyx":400 * * # get the data information into easy vars * cdef Py_ssize_t n_samples = dataset.n_samples # <<<<<<<<<<<<<< * cdef Py_ssize_t n_features = weights.shape[0] * */ - __pyx_v_n_samples = __pyx_v_dataset->n_samples; + __pyx_t_1 = __pyx_v_dataset->n_samples; + __pyx_v_n_samples = __pyx_t_1; - /* "sklearn/linear_model/sgd_fast.pyx":405 + /* "sklearn/linear_model/sgd_fast.pyx":401 * # get the data information into easy vars * cdef Py_ssize_t n_samples = dataset.n_samples * cdef Py_ssize_t n_features = weights.shape[0] # <<<<<<<<<<<<<< @@ -6929,25 +7382,25 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_n_features = (__pyx_v_weights->dimensions[0]); - /* "sklearn/linear_model/sgd_fast.pyx":407 + /* "sklearn/linear_model/sgd_fast.pyx":403 * cdef Py_ssize_t n_features = weights.shape[0] * * cdef WeightVector w = WeightVector(weights) # <<<<<<<<<<<<<< * * cdef DOUBLE * x_data_ptr = NULL */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_weights)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_weights)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_weights)); __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_w = ((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_w = ((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_t_3); + __pyx_t_3 = 0; - /* "sklearn/linear_model/sgd_fast.pyx":409 + /* "sklearn/linear_model/sgd_fast.pyx":405 * cdef WeightVector w = WeightVector(weights) * * cdef DOUBLE * x_data_ptr = NULL # <<<<<<<<<<<<<< @@ -6956,7 +7409,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_x_data_ptr = NULL; - /* "sklearn/linear_model/sgd_fast.pyx":410 + /* "sklearn/linear_model/sgd_fast.pyx":406 * * cdef DOUBLE * x_data_ptr = NULL * cdef INTEGER * x_ind_ptr = NULL # <<<<<<<<<<<<<< @@ -6965,7 +7418,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_x_ind_ptr = NULL; - /* "sklearn/linear_model/sgd_fast.pyx":414 + /* "sklearn/linear_model/sgd_fast.pyx":410 * # helper variable * cdef int xnnz * cdef double eta = 0.0 # <<<<<<<<<<<<<< @@ -6974,7 +7427,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_eta = 0.0; - /* "sklearn/linear_model/sgd_fast.pyx":415 + /* "sklearn/linear_model/sgd_fast.pyx":411 * cdef int xnnz * cdef double eta = 0.0 * cdef double p = 0.0 # <<<<<<<<<<<<<< @@ -6983,7 +7436,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_p = 0.0; - /* "sklearn/linear_model/sgd_fast.pyx":416 + /* "sklearn/linear_model/sgd_fast.pyx":412 * cdef double eta = 0.0 * cdef double p = 0.0 * cdef double update = 0.0 # <<<<<<<<<<<<<< @@ -6992,7 +7445,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_update = 0.0; - /* "sklearn/linear_model/sgd_fast.pyx":417 + /* "sklearn/linear_model/sgd_fast.pyx":413 * cdef double p = 0.0 * cdef double update = 0.0 * cdef double sumloss = 0.0 # <<<<<<<<<<<<<< @@ -7001,7 +7454,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_sumloss = 0.0; - /* "sklearn/linear_model/sgd_fast.pyx":418 + /* "sklearn/linear_model/sgd_fast.pyx":414 * cdef double update = 0.0 * cdef double sumloss = 0.0 * cdef DOUBLE y = 0.0 # <<<<<<<<<<<<<< @@ -7010,7 +7463,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_y = 0.0; - /* "sklearn/linear_model/sgd_fast.pyx":420 + /* "sklearn/linear_model/sgd_fast.pyx":416 * cdef DOUBLE y = 0.0 * cdef DOUBLE sample_weight * cdef double class_weight = 1.0 # <<<<<<<<<<<<<< @@ -7019,7 +7472,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_class_weight = 1.0; - /* "sklearn/linear_model/sgd_fast.pyx":421 + /* "sklearn/linear_model/sgd_fast.pyx":417 * cdef DOUBLE sample_weight * cdef double class_weight = 1.0 * cdef unsigned int count = 0 # <<<<<<<<<<<<<< @@ -7028,7 +7481,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_count = 0; - /* "sklearn/linear_model/sgd_fast.pyx":422 + /* "sklearn/linear_model/sgd_fast.pyx":418 * cdef double class_weight = 1.0 * cdef unsigned int count = 0 * cdef unsigned int epoch = 0 # <<<<<<<<<<<<<< @@ -7037,7 +7490,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_epoch = 0; - /* "sklearn/linear_model/sgd_fast.pyx":423 + /* "sklearn/linear_model/sgd_fast.pyx":419 * cdef unsigned int count = 0 * cdef unsigned int epoch = 0 * cdef unsigned int i = 0 # <<<<<<<<<<<<<< @@ -7046,41 +7499,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_i = 0; - /* "sklearn/linear_model/sgd_fast.pyx":424 + /* "sklearn/linear_model/sgd_fast.pyx":420 * cdef unsigned int epoch = 0 * cdef unsigned int i = 0 * cdef int is_hinge = isinstance(loss, Hinge) # <<<<<<<<<<<<<< * * # q vector is only used for L1 regularization */ - __pyx_t_2 = ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge)); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __Pyx_TypeCheck(((PyObject *)__pyx_v_loss), __pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_is_hinge = __pyx_t_3; + __pyx_t_3 = ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge)); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = __Pyx_TypeCheck(((PyObject *)__pyx_v_loss), __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_is_hinge = __pyx_t_4; - /* "sklearn/linear_model/sgd_fast.pyx":427 + /* "sklearn/linear_model/sgd_fast.pyx":423 * * # q vector is only used for L1 regularization * cdef np.ndarray[DOUBLE, ndim = 1, mode = "c"] q = None # <<<<<<<<<<<<<< * cdef DOUBLE * q_data_ptr = NULL * if penalty_type == L1 or penalty_type == ELASTICNET: */ - __pyx_t_4 = ((PyArrayObject *)Py_None); + __pyx_t_5 = ((PyArrayObject *)Py_None); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_q, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { - __pyx_v_q = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_q.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_q = __pyx_bstruct_q.strides[0]; - __pyx_bshape_0_q = __pyx_bstruct_q.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + __pyx_v_q = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_q.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_q.diminfo[0].strides = __pyx_pybuffernd_q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q.diminfo[0].shape = __pyx_pybuffernd_q.rcbuffer->pybuffer.shape[0]; } } - __pyx_t_4 = 0; + __pyx_t_5 = 0; __Pyx_INCREF(Py_None); __pyx_v_q = ((PyArrayObject *)Py_None); - /* "sklearn/linear_model/sgd_fast.pyx":428 + /* "sklearn/linear_model/sgd_fast.pyx":424 * # q vector is only used for L1 regularization * cdef np.ndarray[DOUBLE, ndim = 1, mode = "c"] q = None * cdef DOUBLE * q_data_ptr = NULL # <<<<<<<<<<<<<< @@ -7089,7 +7541,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_q_data_ptr = NULL; - /* "sklearn/linear_model/sgd_fast.pyx":429 + /* "sklearn/linear_model/sgd_fast.pyx":425 * cdef np.ndarray[DOUBLE, ndim = 1, mode = "c"] q = None * cdef DOUBLE * q_data_ptr = NULL * if penalty_type == L1 or penalty_type == ELASTICNET: # <<<<<<<<<<<<<< @@ -7100,70 +7552,69 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * case 1: case 3: - /* "sklearn/linear_model/sgd_fast.pyx":430 + /* "sklearn/linear_model/sgd_fast.pyx":426 * cdef DOUBLE * q_data_ptr = NULL * if penalty_type == L1 or penalty_type == ELASTICNET: * q = np.zeros((n_features,), dtype=np.float64, order="c") # <<<<<<<<<<<<<< * q_data_ptr = q.data * cdef double u = 0.0 */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n_features); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); - __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n_features); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); + __Pyx_GIVEREF(__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 = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__c)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = ((PyArrayObject *)__pyx_t_7); + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__c)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_q); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_q, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_8 < 0)) { - PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_q, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); + __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_9 < 0)) { + PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); __Pyx_RaiseBufferFallbackError(); } else { - PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); + PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12); } } - __pyx_bstride_0_q = __pyx_bstruct_q.strides[0]; - __pyx_bshape_0_q = __pyx_bstruct_q.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_q.diminfo[0].strides = __pyx_pybuffernd_q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q.diminfo[0].shape = __pyx_pybuffernd_q.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = 0; + __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_q)); - __pyx_v_q = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_v_q = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; - /* "sklearn/linear_model/sgd_fast.pyx":431 + /* "sklearn/linear_model/sgd_fast.pyx":427 * if penalty_type == L1 or penalty_type == ELASTICNET: * q = np.zeros((n_features,), dtype=np.float64, order="c") * q_data_ptr = q.data # <<<<<<<<<<<<<< @@ -7174,7 +7625,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * break; } - /* "sklearn/linear_model/sgd_fast.pyx":432 + /* "sklearn/linear_model/sgd_fast.pyx":428 * q = np.zeros((n_features,), dtype=np.float64, order="c") * q_data_ptr = q.data * cdef double u = 0.0 # <<<<<<<<<<<<<< @@ -7183,7 +7634,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_u = 0.0; - /* "sklearn/linear_model/sgd_fast.pyx":436 + /* "sklearn/linear_model/sgd_fast.pyx":432 * if penalty_type == L2: * rho = 1.0 * elif penalty_type == L1: # <<<<<<<<<<<<<< @@ -7192,7 +7643,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ switch (__pyx_v_penalty_type) { - /* "sklearn/linear_model/sgd_fast.pyx":434 + /* "sklearn/linear_model/sgd_fast.pyx":430 * cdef double u = 0.0 * * if penalty_type == L2: # <<<<<<<<<<<<<< @@ -7201,7 +7652,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ case 2: - /* "sklearn/linear_model/sgd_fast.pyx":435 + /* "sklearn/linear_model/sgd_fast.pyx":431 * * if penalty_type == L2: * rho = 1.0 # <<<<<<<<<<<<<< @@ -7211,7 +7662,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * __pyx_v_rho = 1.0; break; - /* "sklearn/linear_model/sgd_fast.pyx":436 + /* "sklearn/linear_model/sgd_fast.pyx":432 * if penalty_type == L2: * rho = 1.0 * elif penalty_type == L1: # <<<<<<<<<<<<<< @@ -7220,7 +7671,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ case 1: - /* "sklearn/linear_model/sgd_fast.pyx":437 + /* "sklearn/linear_model/sgd_fast.pyx":433 * rho = 1.0 * elif penalty_type == L1: * rho = 0.0 # <<<<<<<<<<<<<< @@ -7231,7 +7682,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * break; } - /* "sklearn/linear_model/sgd_fast.pyx":439 + /* "sklearn/linear_model/sgd_fast.pyx":435 * rho = 0.0 * * eta = eta0 # <<<<<<<<<<<<<< @@ -7240,61 +7691,61 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_eta = __pyx_v_eta0; - /* "sklearn/linear_model/sgd_fast.pyx":441 + /* "sklearn/linear_model/sgd_fast.pyx":437 * eta = eta0 * * t_start = time() # <<<<<<<<<<<<<< * for epoch in range(n_iter): * if verbose > 0: */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_t_start = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__time); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_t_start = __pyx_t_6; + __pyx_t_6 = 0; - /* "sklearn/linear_model/sgd_fast.pyx":442 + /* "sklearn/linear_model/sgd_fast.pyx":438 * * t_start = time() * for epoch in range(n_iter): # <<<<<<<<<<<<<< * if verbose > 0: * print("-- Epoch %d" % (epoch + 1)) */ - __pyx_t_8 = __pyx_v_n_iter; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_8; __pyx_t_12+=1) { - __pyx_v_epoch = __pyx_t_12; + __pyx_t_9 = __pyx_v_n_iter; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_9; __pyx_t_13+=1) { + __pyx_v_epoch = __pyx_t_13; - /* "sklearn/linear_model/sgd_fast.pyx":443 + /* "sklearn/linear_model/sgd_fast.pyx":439 * t_start = time() * for epoch in range(n_iter): * if verbose > 0: # <<<<<<<<<<<<<< * print("-- Epoch %d" % (epoch + 1)) * if shuffle: */ - __pyx_t_3 = (__pyx_v_verbose > 0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_verbose > 0); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":444 + /* "sklearn/linear_model/sgd_fast.pyx":440 * for epoch in range(n_iter): * if verbose > 0: * print("-- Epoch %d" % (epoch + 1)) # <<<<<<<<<<<<<< * if shuffle: * dataset.shuffle(seed) */ - __pyx_t_5 = PyInt_FromLong((__pyx_v_epoch + 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __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 = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - goto __pyx_L8; + __pyx_t_6 = PyInt_FromLong((__pyx_v_epoch + 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + goto __pyx_L5; } - __pyx_L8:; + __pyx_L5:; - /* "sklearn/linear_model/sgd_fast.pyx":445 + /* "sklearn/linear_model/sgd_fast.pyx":441 * if verbose > 0: * print("-- Epoch %d" % (epoch + 1)) * if shuffle: # <<<<<<<<<<<<<< @@ -7303,7 +7754,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ if (__pyx_v_shuffle) { - /* "sklearn/linear_model/sgd_fast.pyx":446 + /* "sklearn/linear_model/sgd_fast.pyx":442 * print("-- Epoch %d" % (epoch + 1)) * if shuffle: * dataset.shuffle(seed) # <<<<<<<<<<<<<< @@ -7311,22 +7762,22 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * * dataset.next( & x_data_ptr, & x_ind_ptr, & xnnz, & y, */ ((struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset *)__pyx_v_dataset->__pyx_vtab)->shuffle(__pyx_v_dataset, __pyx_v_seed); - goto __pyx_L9; + goto __pyx_L6; } - __pyx_L9:; + __pyx_L6:; - /* "sklearn/linear_model/sgd_fast.pyx":447 + /* "sklearn/linear_model/sgd_fast.pyx":443 * if shuffle: * dataset.shuffle(seed) * for i in range(n_samples): # <<<<<<<<<<<<<< * dataset.next( & x_data_ptr, & x_ind_ptr, & xnnz, & y, * & sample_weight) */ - __pyx_t_13 = __pyx_v_n_samples; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_t_1 = __pyx_v_n_samples; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_1; __pyx_t_14+=1) { __pyx_v_i = __pyx_t_14; - /* "sklearn/linear_model/sgd_fast.pyx":449 + /* "sklearn/linear_model/sgd_fast.pyx":445 * for i in range(n_samples): * dataset.next( & x_data_ptr, & x_ind_ptr, & xnnz, & y, * & sample_weight) # <<<<<<<<<<<<<< @@ -7335,7 +7786,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ ((struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset *)__pyx_v_dataset->__pyx_vtab)->next(__pyx_v_dataset, (&__pyx_v_x_data_ptr), (&__pyx_v_x_ind_ptr), (&__pyx_v_xnnz), (&__pyx_v_y), (&__pyx_v_sample_weight)); - /* "sklearn/linear_model/sgd_fast.pyx":451 + /* "sklearn/linear_model/sgd_fast.pyx":447 * & sample_weight) * * p = w.dot(x_data_ptr, x_ind_ptr, xnnz) + intercept # <<<<<<<<<<<<<< @@ -7344,7 +7795,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_p = (((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->dot(__pyx_v_w, __pyx_v_x_data_ptr, __pyx_v_x_ind_ptr, __pyx_v_xnnz) + __pyx_v_intercept); - /* "sklearn/linear_model/sgd_fast.pyx":455 + /* "sklearn/linear_model/sgd_fast.pyx":451 * if learning_rate == OPTIMAL: * eta = 1.0 / (alpha * t) * elif learning_rate == INVSCALING: # <<<<<<<<<<<<<< @@ -7353,7 +7804,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ switch (__pyx_v_learning_rate) { - /* "sklearn/linear_model/sgd_fast.pyx":453 + /* "sklearn/linear_model/sgd_fast.pyx":449 * p = w.dot(x_data_ptr, x_ind_ptr, xnnz) + intercept * * if learning_rate == OPTIMAL: # <<<<<<<<<<<<<< @@ -7362,7 +7813,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ case 2: - /* "sklearn/linear_model/sgd_fast.pyx":454 + /* "sklearn/linear_model/sgd_fast.pyx":450 * * if learning_rate == OPTIMAL: * eta = 1.0 / (alpha * t) # <<<<<<<<<<<<<< @@ -7372,7 +7823,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * __pyx_v_eta = (1.0 / (__pyx_v_alpha * __pyx_v_t)); break; - /* "sklearn/linear_model/sgd_fast.pyx":455 + /* "sklearn/linear_model/sgd_fast.pyx":451 * if learning_rate == OPTIMAL: * eta = 1.0 / (alpha * t) * elif learning_rate == INVSCALING: # <<<<<<<<<<<<<< @@ -7381,7 +7832,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ case 3: - /* "sklearn/linear_model/sgd_fast.pyx":456 + /* "sklearn/linear_model/sgd_fast.pyx":452 * eta = 1.0 / (alpha * t) * elif learning_rate == INVSCALING: * eta = eta0 / pow(t, power_t) # <<<<<<<<<<<<<< @@ -7392,17 +7843,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * break; } - /* "sklearn/linear_model/sgd_fast.pyx":458 + /* "sklearn/linear_model/sgd_fast.pyx":454 * eta = eta0 / pow(t, power_t) * * if verbose > 0: # <<<<<<<<<<<<<< * sumloss += loss.loss(p, y) * */ - __pyx_t_3 = (__pyx_v_verbose > 0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_verbose > 0); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":459 + /* "sklearn/linear_model/sgd_fast.pyx":455 * * if verbose > 0: * sumloss += loss.loss(p, y) # <<<<<<<<<<<<<< @@ -7410,21 +7861,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * * if y > 0.0: */ __pyx_v_sumloss = (__pyx_v_sumloss + ((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_loss->__pyx_vtab)->loss(__pyx_v_loss, __pyx_v_p, __pyx_v_y, 0)); - goto __pyx_L12; + goto __pyx_L9; } - __pyx_L12:; + __pyx_L9:; - /* "sklearn/linear_model/sgd_fast.pyx":461 + /* "sklearn/linear_model/sgd_fast.pyx":457 * sumloss += loss.loss(p, y) * * if y > 0.0: # <<<<<<<<<<<<<< * class_weight = weight_pos * else: */ - __pyx_t_3 = (__pyx_v_y > 0.0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_y > 0.0); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":462 + /* "sklearn/linear_model/sgd_fast.pyx":458 * * if y > 0.0: * class_weight = weight_pos # <<<<<<<<<<<<<< @@ -7432,11 +7883,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * * class_weight = weight_neg */ __pyx_v_class_weight = __pyx_v_weight_pos; - goto __pyx_L13; + goto __pyx_L10; } /*else*/ { - /* "sklearn/linear_model/sgd_fast.pyx":464 + /* "sklearn/linear_model/sgd_fast.pyx":460 * class_weight = weight_pos * else: * class_weight = weight_neg # <<<<<<<<<<<<<< @@ -7445,9 +7896,9 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_class_weight = __pyx_v_weight_neg; } - __pyx_L13:; + __pyx_L10:; - /* "sklearn/linear_model/sgd_fast.pyx":471 + /* "sklearn/linear_model/sgd_fast.pyx":467 * continue * update = min(C, loss.loss(p, y) / update) * elif learning_rate == PA2: # <<<<<<<<<<<<<< @@ -7456,7 +7907,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ switch (__pyx_v_learning_rate) { - /* "sklearn/linear_model/sgd_fast.pyx":466 + /* "sklearn/linear_model/sgd_fast.pyx":462 * class_weight = weight_neg * * if learning_rate == PA1: # <<<<<<<<<<<<<< @@ -7465,7 +7916,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ case 4: - /* "sklearn/linear_model/sgd_fast.pyx":467 + /* "sklearn/linear_model/sgd_fast.pyx":463 * * if learning_rate == PA1: * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) # <<<<<<<<<<<<<< @@ -7474,29 +7925,29 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_update = __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_v_x_data_ptr, __pyx_v_x_ind_ptr, __pyx_v_xnnz); - /* "sklearn/linear_model/sgd_fast.pyx":468 + /* "sklearn/linear_model/sgd_fast.pyx":464 * if learning_rate == PA1: * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) * if update == 0: # <<<<<<<<<<<<<< * continue * update = min(C, loss.loss(p, y) / update) */ - __pyx_t_3 = (__pyx_v_update == 0.0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_update == 0.0); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":469 + /* "sklearn/linear_model/sgd_fast.pyx":465 * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) * if update == 0: * continue # <<<<<<<<<<<<<< * update = min(C, loss.loss(p, y) / update) * elif learning_rate == PA2: */ - goto __pyx_L10_continue; - goto __pyx_L14; + goto __pyx_L7_continue; + goto __pyx_L11; } - __pyx_L14:; + __pyx_L11:; - /* "sklearn/linear_model/sgd_fast.pyx":470 + /* "sklearn/linear_model/sgd_fast.pyx":466 * if update == 0: * continue * update = min(C, loss.loss(p, y) / update) # <<<<<<<<<<<<<< @@ -7506,7 +7957,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * __pyx_v_update = __pyx_f_7sklearn_12linear_model_8sgd_fast_min(__pyx_v_C, (((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_loss->__pyx_vtab)->loss(__pyx_v_loss, __pyx_v_p, __pyx_v_y, 0) / __pyx_v_update)); break; - /* "sklearn/linear_model/sgd_fast.pyx":471 + /* "sklearn/linear_model/sgd_fast.pyx":467 * continue * update = min(C, loss.loss(p, y) / update) * elif learning_rate == PA2: # <<<<<<<<<<<<<< @@ -7515,7 +7966,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ case 5: - /* "sklearn/linear_model/sgd_fast.pyx":472 + /* "sklearn/linear_model/sgd_fast.pyx":468 * update = min(C, loss.loss(p, y) / update) * elif learning_rate == PA2: * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) # <<<<<<<<<<<<<< @@ -7524,7 +7975,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_update = __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_v_x_data_ptr, __pyx_v_x_ind_ptr, __pyx_v_xnnz); - /* "sklearn/linear_model/sgd_fast.pyx":473 + /* "sklearn/linear_model/sgd_fast.pyx":469 * elif learning_rate == PA2: * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) * update = loss.loss(p, y) / (update + 0.5 / C) # <<<<<<<<<<<<<< @@ -7535,7 +7986,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * break; default: - /* "sklearn/linear_model/sgd_fast.pyx":475 + /* "sklearn/linear_model/sgd_fast.pyx":471 * update = loss.loss(p, y) / (update + 0.5 / C) * else: * update = -eta * loss.dloss(p, y) # <<<<<<<<<<<<<< @@ -7546,17 +7997,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * break; } - /* "sklearn/linear_model/sgd_fast.pyx":477 + /* "sklearn/linear_model/sgd_fast.pyx":473 * update = -eta * loss.dloss(p, y) * * if learning_rate >= PA1: # <<<<<<<<<<<<<< * if is_hinge: * # classification */ - __pyx_t_3 = (__pyx_v_learning_rate >= 4); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_learning_rate >= 4); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":478 + /* "sklearn/linear_model/sgd_fast.pyx":474 * * if learning_rate >= PA1: * if is_hinge: # <<<<<<<<<<<<<< @@ -7565,7 +8016,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ if (__pyx_v_is_hinge) { - /* "sklearn/linear_model/sgd_fast.pyx":480 + /* "sklearn/linear_model/sgd_fast.pyx":476 * if is_hinge: * # classification * update *= y # <<<<<<<<<<<<<< @@ -7573,20 +8024,20 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * * # regression */ __pyx_v_update = (__pyx_v_update * __pyx_v_y); - goto __pyx_L16; + goto __pyx_L13; } - /* "sklearn/linear_model/sgd_fast.pyx":481 + /* "sklearn/linear_model/sgd_fast.pyx":477 * # classification * update *= y * elif y - p < 0: # <<<<<<<<<<<<<< * # regression * update *= -1 */ - __pyx_t_3 = ((__pyx_v_y - __pyx_v_p) < 0.0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_y - __pyx_v_p) < 0.0); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":483 + /* "sklearn/linear_model/sgd_fast.pyx":479 * elif y - p < 0: * # regression * update *= -1 # <<<<<<<<<<<<<< @@ -7594,14 +8045,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * * update *= class_weight * sample_weight */ __pyx_v_update = (__pyx_v_update * -1.0); - goto __pyx_L16; + goto __pyx_L13; } - __pyx_L16:; - goto __pyx_L15; + __pyx_L13:; + goto __pyx_L12; } - __pyx_L15:; + __pyx_L12:; - /* "sklearn/linear_model/sgd_fast.pyx":485 + /* "sklearn/linear_model/sgd_fast.pyx":481 * update *= -1 * * update *= class_weight * sample_weight # <<<<<<<<<<<<<< @@ -7610,17 +8061,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_update = (__pyx_v_update * (__pyx_v_class_weight * __pyx_v_sample_weight)); - /* "sklearn/linear_model/sgd_fast.pyx":487 + /* "sklearn/linear_model/sgd_fast.pyx":483 * update *= class_weight * sample_weight * * if update != 0.0: # <<<<<<<<<<<<<< * w.add(x_data_ptr, x_ind_ptr, xnnz, update) * if fit_intercept == 1: */ - __pyx_t_3 = (__pyx_v_update != 0.0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_update != 0.0); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":488 + /* "sklearn/linear_model/sgd_fast.pyx":484 * * if update != 0.0: * w.add(x_data_ptr, x_ind_ptr, xnnz, update) # <<<<<<<<<<<<<< @@ -7629,17 +8080,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ ((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->add(__pyx_v_w, __pyx_v_x_data_ptr, __pyx_v_x_ind_ptr, __pyx_v_xnnz, __pyx_v_update); - /* "sklearn/linear_model/sgd_fast.pyx":489 + /* "sklearn/linear_model/sgd_fast.pyx":485 * if update != 0.0: * w.add(x_data_ptr, x_ind_ptr, xnnz, update) * if fit_intercept == 1: # <<<<<<<<<<<<<< * intercept += update * intercept_decay * if penalty_type >= L2: */ - __pyx_t_3 = (__pyx_v_fit_intercept == 1); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_fit_intercept == 1); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":490 + /* "sklearn/linear_model/sgd_fast.pyx":486 * w.add(x_data_ptr, x_ind_ptr, xnnz, update) * if fit_intercept == 1: * intercept += update * intercept_decay # <<<<<<<<<<<<<< @@ -7647,24 +8098,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * * w.scale(1.0 - (rho * eta * alpha)) */ __pyx_v_intercept = (__pyx_v_intercept + (__pyx_v_update * __pyx_v_intercept_decay)); - goto __pyx_L18; + goto __pyx_L15; } - __pyx_L18:; - goto __pyx_L17; + __pyx_L15:; + goto __pyx_L14; } - __pyx_L17:; + __pyx_L14:; - /* "sklearn/linear_model/sgd_fast.pyx":491 + /* "sklearn/linear_model/sgd_fast.pyx":487 * if fit_intercept == 1: * intercept += update * intercept_decay * if penalty_type >= L2: # <<<<<<<<<<<<<< * w.scale(1.0 - (rho * eta * alpha)) * */ - __pyx_t_3 = (__pyx_v_penalty_type >= 2); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_penalty_type >= 2); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":492 + /* "sklearn/linear_model/sgd_fast.pyx":488 * intercept += update * intercept_decay * if penalty_type >= L2: * w.scale(1.0 - (rho * eta * alpha)) # <<<<<<<<<<<<<< @@ -7672,11 +8123,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * * if penalty_type == L1 or penalty_type == ELASTICNET: */ ((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->scale(__pyx_v_w, (1.0 - ((__pyx_v_rho * __pyx_v_eta) * __pyx_v_alpha))); - goto __pyx_L19; + goto __pyx_L16; } - __pyx_L19:; + __pyx_L16:; - /* "sklearn/linear_model/sgd_fast.pyx":494 + /* "sklearn/linear_model/sgd_fast.pyx":490 * w.scale(1.0 - (rho * eta * alpha)) * * if penalty_type == L1 or penalty_type == ELASTICNET: # <<<<<<<<<<<<<< @@ -7687,7 +8138,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * case 1: case 3: - /* "sklearn/linear_model/sgd_fast.pyx":495 + /* "sklearn/linear_model/sgd_fast.pyx":491 * * if penalty_type == L1 or penalty_type == ELASTICNET: * u += ((1.0 - rho) * eta * alpha) # <<<<<<<<<<<<<< @@ -7696,7 +8147,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_u = (__pyx_v_u + (((1.0 - __pyx_v_rho) * __pyx_v_eta) * __pyx_v_alpha)); - /* "sklearn/linear_model/sgd_fast.pyx":496 + /* "sklearn/linear_model/sgd_fast.pyx":492 * if penalty_type == L1 or penalty_type == ELASTICNET: * u += ((1.0 - rho) * eta * alpha) * l1penalty(w, q_data_ptr, x_ind_ptr, xnnz, u) # <<<<<<<<<<<<<< @@ -7707,7 +8158,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * break; } - /* "sklearn/linear_model/sgd_fast.pyx":497 + /* "sklearn/linear_model/sgd_fast.pyx":493 * u += ((1.0 - rho) * eta * alpha) * l1penalty(w, q_data_ptr, x_ind_ptr, xnnz, u) * t += 1 # <<<<<<<<<<<<<< @@ -7716,7 +8167,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ __pyx_v_t = (__pyx_v_t + 1.0); - /* "sklearn/linear_model/sgd_fast.pyx":498 + /* "sklearn/linear_model/sgd_fast.pyx":494 * l1penalty(w, q_data_ptr, x_ind_ptr, xnnz, u) * t += 1 * count += 1 # <<<<<<<<<<<<<< @@ -7724,249 +8175,249 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * * # report epoch information */ __pyx_v_count = (__pyx_v_count + 1); - __pyx_L10_continue:; + __pyx_L7_continue:; } - /* "sklearn/linear_model/sgd_fast.pyx":501 + /* "sklearn/linear_model/sgd_fast.pyx":497 * * # report epoch information * if verbose > 0: # <<<<<<<<<<<<<< * print("Norm: %.2f, NNZs: %d, " * "Bias: %.6f, T: %d, Avg. loss: %.6f" % (w.norm(), */ - __pyx_t_3 = (__pyx_v_verbose > 0); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_verbose > 0); + if (__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":503 + /* "sklearn/linear_model/sgd_fast.pyx":499 * if verbose > 0: * print("Norm: %.2f, NNZs: %d, " * "Bias: %.6f, T: %d, Avg. loss: %.6f" % (w.norm(), # <<<<<<<<<<<<<< * weights.nonzero()[0].shape[0], * intercept, count, */ - __pyx_t_7 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->norm(__pyx_v_w)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->norm(__pyx_v_w)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); - /* "sklearn/linear_model/sgd_fast.pyx":504 + /* "sklearn/linear_model/sgd_fast.pyx":500 * print("Norm: %.2f, NNZs: %d, " * "Bias: %.6f, T: %d, Avg. loss: %.6f" % (w.norm(), * weights.nonzero()[0].shape[0], # <<<<<<<<<<<<<< * intercept, count, * sumloss / count)) */ - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__nonzero); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__nonzero); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/sgd_fast.pyx":505 + /* "sklearn/linear_model/sgd_fast.pyx":501 * "Bias: %.6f, T: %d, Avg. loss: %.6f" % (w.norm(), * weights.nonzero()[0].shape[0], * intercept, count, # <<<<<<<<<<<<<< * sumloss / count)) * print("Total training time: %.2f seconds." % (time() - t_start)) */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/linear_model/sgd_fast.pyx":506 + /* "sklearn/linear_model/sgd_fast.pyx":502 * weights.nonzero()[0].shape[0], * intercept, count, * sumloss / count)) # <<<<<<<<<<<<<< * print("Total training time: %.2f seconds." % (time() - t_start)) * */ - __pyx_t_6 = PyFloat_FromDouble((__pyx_v_sumloss / __pyx_v_count)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_15 = PyTuple_New(5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_6); + __pyx_t_7 = PyFloat_FromDouble((__pyx_v_sumloss / __pyx_v_count)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_15 = PyTuple_New(5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_7 = 0; - __pyx_t_5 = 0; - __pyx_t_2 = 0; - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_8 = 0; __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - /* "sklearn/linear_model/sgd_fast.pyx":507 + /* "sklearn/linear_model/sgd_fast.pyx":503 * intercept, count, * sumloss / count)) * print("Total training time: %.2f seconds." % (time() - t_start)) # <<<<<<<<<<<<<< * * # floating-point under-/overflow check. */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__time); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_15 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_15 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Subtract(__pyx_t_15, __pyx_v_t_start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Subtract(__pyx_t_15, __pyx_v_t_start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_t_6); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_t_7); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_15)); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_15)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_15)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - goto __pyx_L20; + goto __pyx_L17; } - __pyx_L20:; + __pyx_L17:; - /* "sklearn/linear_model/sgd_fast.pyx":510 + /* "sklearn/linear_model/sgd_fast.pyx":506 * * # floating-point under-/overflow check. * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ # <<<<<<<<<<<<<< * or np.isnan(intercept) or np.isinf(intercept): * raise ValueError("floating-point under-/overflow occured.") */ - __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__any); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__any); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__isinf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__isinf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_v_weights)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_weights)); __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __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_15)); __pyx_t_15 = 0; - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_3) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_4) { - /* "sklearn/linear_model/sgd_fast.pyx":511 + /* "sklearn/linear_model/sgd_fast.pyx":507 * # floating-point under-/overflow check. * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ * or np.isnan(intercept) or np.isinf(intercept): # <<<<<<<<<<<<<< * raise ValueError("floating-point under-/overflow occured.") * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__any); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/sgd_fast.pyx":510 + /* "sklearn/linear_model/sgd_fast.pyx":506 * * # floating-point under-/overflow check. * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ # <<<<<<<<<<<<<< * or np.isnan(intercept) or np.isinf(intercept): * raise ValueError("floating-point under-/overflow occured.") */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isnan); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __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 = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__isnan); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __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 = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_weights)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_weights)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_weights)); __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); - __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __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_15, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_16) { - /* "sklearn/linear_model/sgd_fast.pyx":511 + /* "sklearn/linear_model/sgd_fast.pyx":507 * # floating-point under-/overflow check. * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ * or np.isnan(intercept) or np.isinf(intercept): # <<<<<<<<<<<<<< * raise ValueError("floating-point under-/overflow occured.") * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isnan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); - PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isnan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __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_15)); __pyx_t_15 = 0; - __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_17) { - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_15 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__isinf); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isinf); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __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 = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __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 = 507; __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_15, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_19 = __pyx_t_18; } else { __pyx_t_19 = __pyx_t_17; @@ -7977,28 +8428,28 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * } __pyx_t_16 = __pyx_t_17; } else { - __pyx_t_16 = __pyx_t_3; + __pyx_t_16 = __pyx_t_4; } if (__pyx_t_16) { - /* "sklearn/linear_model/sgd_fast.pyx":512 + /* "sklearn/linear_model/sgd_fast.pyx":508 * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ * or np.isnan(intercept) or np.isinf(intercept): * raise ValueError("floating-point under-/overflow occured.") # <<<<<<<<<<<<<< * * w.reset_wscale() */ - __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 = 512; __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 = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L21; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __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[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L18; } - __pyx_L21:; + __pyx_L18:; } - /* "sklearn/linear_model/sgd_fast.pyx":514 + /* "sklearn/linear_model/sgd_fast.pyx":510 * raise ValueError("floating-point under-/overflow occured.") * * w.reset_wscale() # <<<<<<<<<<<<<< @@ -8007,7 +8458,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * */ ((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->reset_wscale(__pyx_v_w); - /* "sklearn/linear_model/sgd_fast.pyx":516 + /* "sklearn/linear_model/sgd_fast.pyx":512 * w.reset_wscale() * * return weights, intercept # <<<<<<<<<<<<<< @@ -8015,40 +8466,40 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __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 = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_weights)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_weights)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_weights)); __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 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_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_15); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_q); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_weights); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.plain_sgd", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_q); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_weights); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_w); __Pyx_XDECREF((PyObject *)__pyx_v_q); @@ -8058,7 +8509,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(PyObject * return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":519 +/* "sklearn/linear_model/sgd_fast.pyx":515 * * * cdef inline double max(double a, double b): # <<<<<<<<<<<<<< @@ -8070,9 +8521,9 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_max(double double __pyx_r; __Pyx_RefNannyDeclarations double __pyx_t_1; - __Pyx_RefNannySetupContext("max"); + __Pyx_RefNannySetupContext("max", 0); - /* "sklearn/linear_model/sgd_fast.pyx":520 + /* "sklearn/linear_model/sgd_fast.pyx":516 * * cdef inline double max(double a, double b): * return a if a >= b else b # <<<<<<<<<<<<<< @@ -8093,7 +8544,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_max(double return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":523 +/* "sklearn/linear_model/sgd_fast.pyx":519 * * * cdef inline double min(double a, double b): # <<<<<<<<<<<<<< @@ -8105,9 +8556,9 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_min(double double __pyx_r; __Pyx_RefNannyDeclarations double __pyx_t_1; - __Pyx_RefNannySetupContext("min"); + __Pyx_RefNannySetupContext("min", 0); - /* "sklearn/linear_model/sgd_fast.pyx":524 + /* "sklearn/linear_model/sgd_fast.pyx":520 * * cdef inline double min(double a, double b): * return a if a <= b else b # <<<<<<<<<<<<<< @@ -8128,7 +8579,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_min(double return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":526 +/* "sklearn/linear_model/sgd_fast.pyx":522 * return a if a <= b else b * * cdef double sqnorm(DOUBLE * x_data_ptr, INTEGER * x_ind_ptr, int xnnz): # <<<<<<<<<<<<<< @@ -8136,7 +8587,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_min(double * cdef int j */ -static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_x_data_ptr, __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *__pyx_v_x_ind_ptr, int __pyx_v_xnnz) { +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_x_data_ptr, CYTHON_UNUSED __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *__pyx_v_x_ind_ptr, int __pyx_v_xnnz) { double __pyx_v_x_norm; int __pyx_v_j; double __pyx_v_z; @@ -8144,9 +8595,9 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_ __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("sqnorm"); + __Pyx_RefNannySetupContext("sqnorm", 0); - /* "sklearn/linear_model/sgd_fast.pyx":527 + /* "sklearn/linear_model/sgd_fast.pyx":523 * * cdef double sqnorm(DOUBLE * x_data_ptr, INTEGER * x_ind_ptr, int xnnz): * cdef double x_norm = 0.0 # <<<<<<<<<<<<<< @@ -8155,7 +8606,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_ */ __pyx_v_x_norm = 0.0; - /* "sklearn/linear_model/sgd_fast.pyx":530 + /* "sklearn/linear_model/sgd_fast.pyx":526 * cdef int j * cdef double z * for j in range(xnnz): # <<<<<<<<<<<<<< @@ -8166,7 +8617,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_j = __pyx_t_2; - /* "sklearn/linear_model/sgd_fast.pyx":531 + /* "sklearn/linear_model/sgd_fast.pyx":527 * cdef double z * for j in range(xnnz): * z = x_data_ptr[j] # <<<<<<<<<<<<<< @@ -8175,7 +8626,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_ */ __pyx_v_z = (__pyx_v_x_data_ptr[__pyx_v_j]); - /* "sklearn/linear_model/sgd_fast.pyx":532 + /* "sklearn/linear_model/sgd_fast.pyx":528 * for j in range(xnnz): * z = x_data_ptr[j] * x_norm += z * z # <<<<<<<<<<<<<< @@ -8185,7 +8636,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_ __pyx_v_x_norm = (__pyx_v_x_norm + (__pyx_v_z * __pyx_v_z)); } - /* "sklearn/linear_model/sgd_fast.pyx":533 + /* "sklearn/linear_model/sgd_fast.pyx":529 * z = x_data_ptr[j] * x_norm += z * z * return x_norm # <<<<<<<<<<<<<< @@ -8201,7 +8652,7 @@ static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_ return __pyx_r; } -/* "sklearn/linear_model/sgd_fast.pyx":535 +/* "sklearn/linear_model/sgd_fast.pyx":531 * return x_norm * * cdef void l1penalty(WeightVector w, DOUBLE * q_data_ptr, # <<<<<<<<<<<<<< @@ -8216,13 +8667,15 @@ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj double __pyx_v_wscale; double *__pyx_v_w_data_ptr; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + double __pyx_t_1; + __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *__pyx_t_2; int __pyx_t_3; int __pyx_t_4; - __Pyx_RefNannySetupContext("l1penalty"); + int __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("l1penalty", 0); - /* "sklearn/linear_model/sgd_fast.pyx":542 + /* "sklearn/linear_model/sgd_fast.pyx":538 * [Tsuruoka, Y., Tsujii, J., and Ananiadou, S., 2009]. * """ * cdef double z = 0.0 # <<<<<<<<<<<<<< @@ -8231,7 +8684,7 @@ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj */ __pyx_v_z = 0.0; - /* "sklearn/linear_model/sgd_fast.pyx":543 + /* "sklearn/linear_model/sgd_fast.pyx":539 * """ * cdef double z = 0.0 * cdef int j = 0 # <<<<<<<<<<<<<< @@ -8240,7 +8693,7 @@ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj */ __pyx_v_j = 0; - /* "sklearn/linear_model/sgd_fast.pyx":544 + /* "sklearn/linear_model/sgd_fast.pyx":540 * cdef double z = 0.0 * cdef int j = 0 * cdef int idx = 0 # <<<<<<<<<<<<<< @@ -8249,36 +8702,38 @@ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj */ __pyx_v_idx = 0; - /* "sklearn/linear_model/sgd_fast.pyx":545 + /* "sklearn/linear_model/sgd_fast.pyx":541 * cdef int j = 0 * cdef int idx = 0 * cdef double wscale = w.wscale # <<<<<<<<<<<<<< * cdef double * w_data_ptr = w.w_data_ptr * for j in range(xnnz): */ - __pyx_v_wscale = __pyx_v_w->wscale; + __pyx_t_1 = __pyx_v_w->wscale; + __pyx_v_wscale = __pyx_t_1; - /* "sklearn/linear_model/sgd_fast.pyx":546 + /* "sklearn/linear_model/sgd_fast.pyx":542 * cdef int idx = 0 * cdef double wscale = w.wscale * cdef double * w_data_ptr = w.w_data_ptr # <<<<<<<<<<<<<< * for j in range(xnnz): * idx = x_ind_ptr[j] */ - __pyx_v_w_data_ptr = __pyx_v_w->w_data_ptr; + __pyx_t_2 = __pyx_v_w->w_data_ptr; + __pyx_v_w_data_ptr = __pyx_t_2; - /* "sklearn/linear_model/sgd_fast.pyx":547 + /* "sklearn/linear_model/sgd_fast.pyx":543 * cdef double wscale = w.wscale * cdef double * w_data_ptr = w.w_data_ptr * for j in range(xnnz): # <<<<<<<<<<<<<< * idx = x_ind_ptr[j] * z = w_data_ptr[idx] */ - __pyx_t_1 = __pyx_v_xnnz; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_j = __pyx_t_2; + __pyx_t_3 = __pyx_v_xnnz; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; - /* "sklearn/linear_model/sgd_fast.pyx":548 + /* "sklearn/linear_model/sgd_fast.pyx":544 * cdef double * w_data_ptr = w.w_data_ptr * for j in range(xnnz): * idx = x_ind_ptr[j] # <<<<<<<<<<<<<< @@ -8287,7 +8742,7 @@ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj */ __pyx_v_idx = (__pyx_v_x_ind_ptr[__pyx_v_j]); - /* "sklearn/linear_model/sgd_fast.pyx":549 + /* "sklearn/linear_model/sgd_fast.pyx":545 * for j in range(xnnz): * idx = x_ind_ptr[j] * z = w_data_ptr[idx] # <<<<<<<<<<<<<< @@ -8296,17 +8751,17 @@ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj */ __pyx_v_z = (__pyx_v_w_data_ptr[__pyx_v_idx]); - /* "sklearn/linear_model/sgd_fast.pyx":550 + /* "sklearn/linear_model/sgd_fast.pyx":546 * idx = x_ind_ptr[j] * z = w_data_ptr[idx] * if (wscale * w_data_ptr[idx]) > 0.0: # <<<<<<<<<<<<<< * w_data_ptr[idx] = max( * 0.0, w_data_ptr[idx] - ((u + q_data_ptr[idx]) / wscale)) */ - __pyx_t_3 = ((__pyx_v_wscale * (__pyx_v_w_data_ptr[__pyx_v_idx])) > 0.0); - if (__pyx_t_3) { + __pyx_t_5 = ((__pyx_v_wscale * (__pyx_v_w_data_ptr[__pyx_v_idx])) > 0.0); + if (__pyx_t_5) { - /* "sklearn/linear_model/sgd_fast.pyx":551 + /* "sklearn/linear_model/sgd_fast.pyx":547 * z = w_data_ptr[idx] * if (wscale * w_data_ptr[idx]) > 0.0: * w_data_ptr[idx] = max( # <<<<<<<<<<<<<< @@ -8317,17 +8772,17 @@ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj goto __pyx_L5; } - /* "sklearn/linear_model/sgd_fast.pyx":554 + /* "sklearn/linear_model/sgd_fast.pyx":550 * 0.0, w_data_ptr[idx] - ((u + q_data_ptr[idx]) / wscale)) * * elif (wscale * w_data_ptr[idx]) < 0.0: # <<<<<<<<<<<<<< * w_data_ptr[idx] = min( * 0.0, w_data_ptr[idx] + ((u - q_data_ptr[idx]) / wscale)) */ - __pyx_t_3 = ((__pyx_v_wscale * (__pyx_v_w_data_ptr[__pyx_v_idx])) < 0.0); - if (__pyx_t_3) { + __pyx_t_5 = ((__pyx_v_wscale * (__pyx_v_w_data_ptr[__pyx_v_idx])) < 0.0); + if (__pyx_t_5) { - /* "sklearn/linear_model/sgd_fast.pyx":555 + /* "sklearn/linear_model/sgd_fast.pyx":551 * * elif (wscale * w_data_ptr[idx]) < 0.0: * w_data_ptr[idx] = min( # <<<<<<<<<<<<<< @@ -8339,19 +8794,30 @@ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj } __pyx_L5:; - /* "sklearn/linear_model/sgd_fast.pyx":558 + /* "sklearn/linear_model/sgd_fast.pyx":554 * 0.0, w_data_ptr[idx] + ((u - q_data_ptr[idx]) / wscale)) * * q_data_ptr[idx] += (wscale * (w_data_ptr[idx] - z)) # <<<<<<<<<<<<<< */ - __pyx_t_4 = __pyx_v_idx; - (__pyx_v_q_data_ptr[__pyx_t_4]) = ((__pyx_v_q_data_ptr[__pyx_t_4]) + (__pyx_v_wscale * ((__pyx_v_w_data_ptr[__pyx_v_idx]) - __pyx_v_z))); + __pyx_t_6 = __pyx_v_idx; + (__pyx_v_q_data_ptr[__pyx_t_6]) = ((__pyx_v_q_data_ptr[__pyx_t_6]) + (__pyx_v_wscale * ((__pyx_v_w_data_ptr[__pyx_v_idx]) - __pyx_v_z))); } __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":190 +/* 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) { + int __pyx_r; + __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)); + __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): # <<<<<<<<<<<<<< @@ -8359,8 +8825,7 @@ static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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; int __pyx_v_ndim; @@ -8385,13 +8850,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -8402,11 +8867,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -8415,7 +8880,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -8424,16 +8889,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -8443,7 +8908,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -8451,11 +8916,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -8464,9 +8929,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8476,37 +8941,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * 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") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.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_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -8516,46 +8981,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * 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") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.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_9), 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, ((PyObject *)__pyx_k_tuple_9), 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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -8564,7 +9029,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -8573,7 +9038,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.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) # <<<<<<<<<<<<<< @@ -8582,7 +9047,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.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 # <<<<<<<<<<<<<< @@ -8591,7 +9056,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -8602,49 +9067,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -8653,25 +9118,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -8680,17 +9145,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -8699,7 +9166,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -8715,7 +9182,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -8727,49 +9194,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -8780,10 +9248,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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" */ @@ -8800,24 +9268,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), 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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (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" @@ -8826,10 +9294,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -8839,10 +9307,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -8852,10 +9320,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -8865,10 +9333,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -8878,10 +9346,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -8891,10 +9359,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -8904,10 +9372,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -8917,10 +9385,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -8930,10 +9398,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -8943,10 +9411,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -8956,10 +9424,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -8969,10 +9437,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -8982,10 +9450,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -8995,10 +9463,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -9008,10 +9476,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -9021,10 +9489,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -9034,37 +9502,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __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_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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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)); __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -9073,7 +9541,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -9082,57 +9550,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -9157,31 +9625,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* 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)); + __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 CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -9189,11 +9665,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -9203,7 +9679,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -9211,14 +9687,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -9233,9 +9709,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -9243,7 +9719,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9261,7 +9737,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -9276,9 +9752,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -9286,7 +9762,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9304,7 +9780,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -9319,9 +9795,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -9329,7 +9805,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9347,7 +9823,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -9362,9 +9838,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -9372,7 +9848,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9390,7 +9866,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -9405,9 +9881,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -9415,7 +9891,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9433,7 +9909,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.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: # <<<<<<<<<<<<<< @@ -9456,18 +9932,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -9476,7 +9953,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -9485,7 +9962,7 @@ 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":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -9493,31 +9970,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -9526,20 +10008,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} + #endif + } else if (1) { + __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -9547,99 +10058,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), 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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * 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_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), 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_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -9647,16 +10157,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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -9665,7 +10174,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -9674,430 +10183,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.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_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.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_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_17), 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_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.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 = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.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_12), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -10105,25 +10597,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_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __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_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -10152,7 +10644,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -10164,9 +10656,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -10176,7 +10668,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -10188,7 +10680,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -10197,7 +10689,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -10208,7 +10700,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -10217,7 +10709,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -10229,7 +10721,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -10241,9 +10733,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -10253,7 +10745,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -10268,7 +10760,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -10288,7 +10780,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction __pyx_vtable_7sklearn_12linear_model_8sgd_fast_LossFunction; -static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -10302,8 +10794,8 @@ static void __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction(PyOb } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_LossFunction[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_1dloss)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss)}, {0, 0, 0, 0} }; @@ -10472,8 +10964,8 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Regression(PyTyp } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Regression[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_1dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -10642,8 +11134,8 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Classification(P } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Classification[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_1dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -10812,9 +11304,9 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_ModifiedHuber(Py } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_ModifiedHuber[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -10983,9 +11475,9 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Hinge(PyTypeObje } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Hinge[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -11127,7 +11619,7 @@ static PyTypeObject __pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__, /*tp_init*/ + __pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Hinge, /*tp_new*/ 0, /*tp_free*/ @@ -11154,9 +11646,9 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredHinge(PyT } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_SquaredHinge[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -11298,7 +11790,7 @@ static PyTypeObject __pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge = 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__, /*tp_init*/ + __pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredHinge, /*tp_new*/ 0, /*tp_free*/ @@ -11325,9 +11817,9 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Log(PyTypeObject } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Log[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_1dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -11496,9 +11988,9 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredLoss(PyTy } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_SquaredLoss[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -11667,9 +12159,9 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Huber(PyTypeObje } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Huber[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -11811,7 +12303,7 @@ static PyTypeObject __pyx_type_7sklearn_12linear_model_8sgd_fast_Huber = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__, /*tp_init*/ + __pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Huber, /*tp_new*/ 0, /*tp_free*/ @@ -11838,9 +12330,9 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_EpsilonInsensiti } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -11982,7 +12474,7 @@ static PyTypeObject __pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensit 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__, /*tp_init*/ + __pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive, /*tp_new*/ 0, /*tp_free*/ @@ -12009,9 +12501,9 @@ static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonIn } static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive[] = { - {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -12153,7 +12645,7 @@ static PyTypeObject __pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonI 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__, /*tp_init*/ + __pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive, /*tp_new*/ 0, /*tp_free*/ @@ -12193,8 +12685,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, - {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__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_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, @@ -12208,20 +12701,28 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1}, {&__pyx_n_s__any, __pyx_k__any, sizeof(__pyx_k__any), 0, 0, 1, 1}, {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, + {&__pyx_n_s__class_weight, __pyx_k__class_weight, sizeof(__pyx_k__class_weight), 0, 0, 1, 1}, + {&__pyx_n_s__count, __pyx_k__count, sizeof(__pyx_k__count), 0, 0, 1, 1}, {&__pyx_n_s__dataset, __pyx_k__dataset, sizeof(__pyx_k__dataset), 0, 0, 1, 1}, {&__pyx_n_s__dloss, __pyx_k__dloss, sizeof(__pyx_k__dloss), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__epoch, __pyx_k__epoch, sizeof(__pyx_k__epoch), 0, 0, 1, 1}, {&__pyx_n_s__epsilon, __pyx_k__epsilon, sizeof(__pyx_k__epsilon), 0, 0, 1, 1}, + {&__pyx_n_s__eta, __pyx_k__eta, sizeof(__pyx_k__eta), 0, 0, 1, 1}, {&__pyx_n_s__eta0, __pyx_k__eta0, sizeof(__pyx_k__eta0), 0, 0, 1, 1}, {&__pyx_n_s__fit_intercept, __pyx_k__fit_intercept, sizeof(__pyx_k__fit_intercept), 0, 0, 1, 1}, {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__intercept, __pyx_k__intercept, sizeof(__pyx_k__intercept), 0, 0, 1, 1}, {&__pyx_n_s__intercept_decay, __pyx_k__intercept_decay, sizeof(__pyx_k__intercept_decay), 0, 0, 1, 1}, + {&__pyx_n_s__is_hinge, __pyx_k__is_hinge, sizeof(__pyx_k__is_hinge), 0, 0, 1, 1}, {&__pyx_n_s__isinf, __pyx_k__isinf, sizeof(__pyx_k__isinf), 0, 0, 1, 1}, {&__pyx_n_s__isnan, __pyx_k__isnan, sizeof(__pyx_k__isnan), 0, 0, 1, 1}, {&__pyx_n_s__learning_rate, __pyx_k__learning_rate, sizeof(__pyx_k__learning_rate), 0, 0, 1, 1}, {&__pyx_n_s__loss, __pyx_k__loss, sizeof(__pyx_k__loss), 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_iter, __pyx_k__n_iter, sizeof(__pyx_k__n_iter), 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__nonzero, __pyx_k__nonzero, sizeof(__pyx_k__nonzero), 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}, @@ -12230,28 +12731,39 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__penalty_type, __pyx_k__penalty_type, sizeof(__pyx_k__penalty_type), 0, 0, 1, 1}, {&__pyx_n_s__plain_sgd, __pyx_k__plain_sgd, sizeof(__pyx_k__plain_sgd), 0, 0, 1, 1}, {&__pyx_n_s__power_t, __pyx_k__power_t, sizeof(__pyx_k__power_t), 0, 0, 1, 1}, + {&__pyx_n_s__q, __pyx_k__q, sizeof(__pyx_k__q), 0, 0, 1, 1}, + {&__pyx_n_s__q_data_ptr, __pyx_k__q_data_ptr, sizeof(__pyx_k__q_data_ptr), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__rho, __pyx_k__rho, sizeof(__pyx_k__rho), 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__seed, __pyx_k__seed, sizeof(__pyx_k__seed), 0, 0, 1, 1}, {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {&__pyx_n_s__shuffle, __pyx_k__shuffle, sizeof(__pyx_k__shuffle), 0, 0, 1, 1}, + {&__pyx_n_s__sumloss, __pyx_k__sumloss, sizeof(__pyx_k__sumloss), 0, 0, 1, 1}, {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1}, + {&__pyx_n_s__t_start, __pyx_k__t_start, sizeof(__pyx_k__t_start), 0, 0, 1, 1}, {&__pyx_n_s__threshold, __pyx_k__threshold, sizeof(__pyx_k__threshold), 0, 0, 1, 1}, {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1}, + {&__pyx_n_s__u, __pyx_k__u, sizeof(__pyx_k__u), 0, 0, 1, 1}, + {&__pyx_n_s__update, __pyx_k__update, sizeof(__pyx_k__update), 0, 0, 1, 1}, {&__pyx_n_s__verbose, __pyx_k__verbose, sizeof(__pyx_k__verbose), 0, 0, 1, 1}, + {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1}, {&__pyx_n_s__weight_neg, __pyx_k__weight_neg, sizeof(__pyx_k__weight_neg), 0, 0, 1, 1}, {&__pyx_n_s__weight_pos, __pyx_k__weight_pos, sizeof(__pyx_k__weight_pos), 0, 0, 1, 1}, {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, + {&__pyx_n_s__x_data_ptr, __pyx_k__x_data_ptr, sizeof(__pyx_k__x_data_ptr), 0, 0, 1, 1}, + {&__pyx_n_s__x_ind_ptr, __pyx_k__x_ind_ptr, sizeof(__pyx_k__x_ind_ptr), 0, 0, 1, 1}, + {&__pyx_n_s__xnnz, __pyx_k__xnnz, sizeof(__pyx_k__xnnz), 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_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -12259,105 +12771,240 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/linear_model/sgd_fast.pyx":512 + /* "sklearn/linear_model/sgd_fast.pyx":508 * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ * or np.isnan(intercept) or np.isinf(intercept): * raise ValueError("floating-point under-/overflow occured.") # <<<<<<<<<<<<<< * * w.reset_wscale() */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "numpy.pxd":211 + /* "numpy.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_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - /* "numpy.pxd":215 + /* "numpy.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_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); - /* "numpy.pxd":819 + /* "numpy.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_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "sklearn/linear_model/sgd_fast.pyx":327 + * + * + * def plain_sgd(np.ndarray[DOUBLE, ndim=1, mode='c'] weights, # <<<<<<<<<<<<<< + * double intercept, + * LossFunction loss, + */ + __pyx_k_tuple_18 = PyTuple_New(41); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); + __Pyx_INCREF(((PyObject *)__pyx_n_s__weights)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__intercept)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 1, ((PyObject *)__pyx_n_s__intercept)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__intercept)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__loss)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 2, ((PyObject *)__pyx_n_s__loss)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__loss)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__penalty_type)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 3, ((PyObject *)__pyx_n_s__penalty_type)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__penalty_type)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 4, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 5, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__rho)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 6, ((PyObject *)__pyx_n_s__rho)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rho)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dataset)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 7, ((PyObject *)__pyx_n_s__dataset)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dataset)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_iter)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 8, ((PyObject *)__pyx_n_s__n_iter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_iter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fit_intercept)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 9, ((PyObject *)__pyx_n_s__fit_intercept)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fit_intercept)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__verbose)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 10, ((PyObject *)__pyx_n_s__verbose)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__verbose)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__shuffle)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 11, ((PyObject *)__pyx_n_s__shuffle)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shuffle)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__seed)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 12, ((PyObject *)__pyx_n_s__seed)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__seed)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__weight_pos)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 13, ((PyObject *)__pyx_n_s__weight_pos)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weight_pos)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__weight_neg)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 14, ((PyObject *)__pyx_n_s__weight_neg)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weight_neg)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__learning_rate)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 15, ((PyObject *)__pyx_n_s__learning_rate)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__learning_rate)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__eta0)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 16, ((PyObject *)__pyx_n_s__eta0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__eta0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__power_t)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 17, ((PyObject *)__pyx_n_s__power_t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__power_t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 18, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__intercept_decay)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 19, ((PyObject *)__pyx_n_s__intercept_decay)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__intercept_decay)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 20, ((PyObject *)__pyx_n_s__n_samples)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_samples)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 21, ((PyObject *)__pyx_n_s__n_features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 22, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x_data_ptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 23, ((PyObject *)__pyx_n_s__x_data_ptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x_data_ptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x_ind_ptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 24, ((PyObject *)__pyx_n_s__x_ind_ptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x_ind_ptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__xnnz)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 25, ((PyObject *)__pyx_n_s__xnnz)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xnnz)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__eta)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 26, ((PyObject *)__pyx_n_s__eta)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__eta)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__p)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 27, ((PyObject *)__pyx_n_s__p)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__update)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 28, ((PyObject *)__pyx_n_s__update)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__update)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__sumloss)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 29, ((PyObject *)__pyx_n_s__sumloss)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumloss)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 30, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__sample_weight)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 31, ((PyObject *)__pyx_n_s__sample_weight)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sample_weight)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__class_weight)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 32, ((PyObject *)__pyx_n_s__class_weight)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__class_weight)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__count)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 33, ((PyObject *)__pyx_n_s__count)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__epoch)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 34, ((PyObject *)__pyx_n_s__epoch)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epoch)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 35, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__is_hinge)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 36, ((PyObject *)__pyx_n_s__is_hinge)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__is_hinge)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__q)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 37, ((PyObject *)__pyx_n_s__q)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__q)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__q_data_ptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 38, ((PyObject *)__pyx_n_s__q_data_ptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__q_data_ptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__u)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 39, ((PyObject *)__pyx_n_s__u)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__u)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t_start)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 40, ((PyObject *)__pyx_n_s__t_start)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t_start)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(20, 0, 41, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s__plain_sgd, 327, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -12393,12 +13040,18 @@ PyMODINIT_FUNC PyInit_sgd_fast(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_sgd_fast(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_sgd_fast(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -12409,16 +13062,23 @@ PyMODINIT_FUNC PyInit_sgd_fast(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("sgd_fast"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("sgd_fast"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__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.linear_model.sgd_fast")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.linear_model.sgd_fast", __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); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -12436,114 +13096,121 @@ PyMODINIT_FUNC PyInit_sgd_fast(void) __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_LossFunction; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_LossFunction.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_LossFunction.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_dloss; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "LossFunction", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "LossFunction", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction = &__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Regression; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Regression.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Regression.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Regression.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_Regression.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Regression", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Regression", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Classification; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Classification.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Classification.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Classification.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_Classification.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Classification", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Classification", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_ModifiedHuber = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_ModifiedHuber; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_ModifiedHuber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ModifiedHuber", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_ModifiedHuber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ModifiedHuber", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber = &__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Hinge = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Hinge; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Hinge.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Hinge.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Hinge.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Hinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Hinge", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Hinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Hinge", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredHinge = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredHinge; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredHinge.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredHinge.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredHinge.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredHinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SquaredHinge", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredHinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SquaredHinge", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge = &__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Log = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Log; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Log.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Log.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Log.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_Log.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Log) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Log.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Log) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Log", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Log) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Log) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Log.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Log) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Log", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Log) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Log; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredLoss = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredLoss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredLoss.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredLoss.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredLoss.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredLoss) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SquaredLoss", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredLoss) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SquaredLoss", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss = &__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Huber = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Huber; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Huber.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Huber.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Huber.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_Huber.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Huber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Huber", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Huber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Huber", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "EpsilonInsensitive", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "EpsilonInsensitive", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive = &__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive; __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_loss; __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_dloss; __pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression; - if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SquaredEpsilonInsensitive", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SquaredEpsilonInsensitive", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive = &__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector = __Pyx_ImportType("sklearn.utils.weight_vector", "WeightVector", sizeof(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector = (struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset = __Pyx_ImportType("sklearn.utils.seq_dataset", "SequentialDataset", sizeof(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset = (struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset = __Pyx_ImportType("sklearn.utils.seq_dataset", "ArrayDataset", sizeof(struct __pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset = (struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_ArrayDataset*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset = __Pyx_ImportType("sklearn.utils.seq_dataset", "CSRDataset", sizeof(struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset = (struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector = __Pyx_ImportType("sklearn.utils.weight_vector", "WeightVector", sizeof(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector = (struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset = __Pyx_ImportType("sklearn.utils.seq_dataset", "SequentialDataset", sizeof(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset = (struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset = __Pyx_ImportType("sklearn.utils.seq_dataset", "ArrayDataset", sizeof(struct __pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset = (struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_ArrayDataset*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset = __Pyx_ImportType("sklearn.utils.seq_dataset", "CSRDataset", sizeof(struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset = (struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -12577,32 +13244,45 @@ PyMODINIT_FUNC PyInit_sgd_fast(void) * import sys * from time import time # <<<<<<<<<<<<<< * - * cimport numpy as np + * from libc.math cimport exp, log, sqrt, pow, fabs */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__time)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__time)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__time)); __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__time), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__time); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__time); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__time); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__time, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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; - /* "sklearn/linear_model/sgd_fast.pyx":331 + /* "sklearn/linear_model/sgd_fast.pyx":22 + * from sklearn.utils.seq_dataset cimport SequentialDataset + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/linear_model/sgd_fast.pyx":327 * * * def plain_sgd(np.ndarray[DOUBLE, ndim=1, mode='c'] weights, # <<<<<<<<<<<<<< * double intercept, * LossFunction loss, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_8sgd_fast_plain_sgd, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_8sgd_fast_1plain_sgd, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__plain_sgd, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__plain_sgd, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/linear_model/sgd_fast.pyx":1 @@ -12615,7 +13295,7 @@ PyMODINIT_FUNC PyInit_sgd_fast(void) if (PyObject_SetAttr(__pyx_m, __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; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -12642,7 +13322,6 @@ PyMODINIT_FUNC PyInit_sgd_fast(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -12675,9 +13354,9 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { } static CYTHON_INLINE void __Pyx_ErrRestore(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->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -12687,55 +13366,60 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -12758,7 +13442,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -12767,10 +13450,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -12780,22 +13462,44 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + 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; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -12812,14 +13516,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -12829,8 +13528,8 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif @@ -12844,7 +13543,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -12856,7 +13554,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -12870,7 +13568,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -12886,55 +13584,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -12977,18 +13697,6 @@ static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; -} __Pyx_BufFmt_Context; - static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { @@ -13007,6 +13715,8 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; @@ -13014,7 +13724,6 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, type = type->fields->type; } } - static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; @@ -13030,15 +13739,21 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { *ts = t; return count; } - +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } - static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { - case 'b': return "'char'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; @@ -13054,14 +13769,14 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } - static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; @@ -13077,10 +13792,9 @@ static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { return 0; } } - static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'B': return 1; + case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); @@ -13097,7 +13811,6 @@ static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { } } } - typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; @@ -13108,10 +13821,9 @@ typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); @@ -13127,21 +13839,59 @@ static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { return 0; } } - +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } - static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; @@ -13166,16 +13916,37 @@ static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { parent->type->name, field->name); } } - static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; - size_t size, offset; + size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { @@ -13187,35 +13958,35 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } - offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } - ctx->fmt_offset += size; - + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; @@ -13247,7 +14018,48 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { ctx->is_complex = 0; return 0; } - +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { @@ -13262,7 +14074,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } - return ts; + return ts; case ' ': case 10: case 13: @@ -13294,12 +14106,17 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { @@ -13307,10 +14124,19 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (!ts_after_sub) return NULL; } ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ - ++ts; + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; @@ -13331,13 +14157,11 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': - case 'O': + case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { - /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { - /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; @@ -13353,20 +14177,18 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha while(*ts != ':') ++ts; ++ts; break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; default: { - int number = __Pyx_BufFmt_ParseNumber(&ts); - if (number == -1) { /* First char was not a digit */ - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%c')", *ts); - return NULL; - } - ctx->new_count = (size_t)number; + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } } } } - static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; @@ -13374,8 +14196,10 @@ static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; @@ -13395,7 +14219,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* ob } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; @@ -13406,7 +14230,6 @@ fail:; __Pyx_ZeroBuffer(buf); return -1; } - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; @@ -13430,60 +14253,140 @@ static void __Pyx_RaiseBufferFallbackError(void) { "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } - - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +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 { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); - #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; } - static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { - #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} - #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); + PyObject *obj = view->obj; + CYTHON_UNUSED PyObject *releasebuffer_cobj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: Py_DECREF(obj); view->obj = NULL; - } } +#endif /* PY_MAJOR_VERSION < 3 */ -#endif -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; @@ -13509,12 +14412,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -13531,7 +14455,16 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { return module; } +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", + PyString_AsString(name)); +#else + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); +#endif +} + +#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 static PyObject *__Pyx_GetStdout(void) { PyObject *f = PySys_GetObject((char *)"stdout"); if (!f) { @@ -13539,23 +14472,22 @@ static PyObject *__Pyx_GetStdout(void) { } return f; } - static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - PyObject* v; int i; - if (!f) { if (!(f = __Pyx_GetStdout())) return -1; } + Py_INCREF(f); for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { + PyObject* v; if (PyFile_SoftSpace(f, 1)) { if (PyFile_WriteString(" ", f) < 0) - return -1; + goto error; } v = PyTuple_GET_ITEM(arg_tuple, i); if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - return -1; + goto error; if (PyString_Check(v)) { char *s = PyString_AsString(v); Py_ssize_t len = PyString_Size(v); @@ -13567,14 +14499,16 @@ static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { } if (newline) { if (PyFile_WriteString("\n", f) < 0) - return -1; + goto error; PyFile_SoftSpace(f, 0); } + Py_DECREF(f); return 0; +error: + Py_DECREF(f); + return -1; } - #else /* Python 3 has a print function */ - static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { PyObject* kwargs = 0; PyObject* result = 0; @@ -13628,44 +14562,42 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { Py_XDECREF(kwargs); return -1; } - #endif -#if PY_MAJOR_VERSION < 3 - +#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 static int __Pyx_PrintOne(PyObject* f, PyObject *o) { if (!f) { if (!(f = __Pyx_GetStdout())) return -1; } + Py_INCREF(f); if (PyFile_SoftSpace(f, 0)) { if (PyFile_WriteString(" ", f) < 0) - return -1; + goto error; } if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - return -1; + goto error; if (PyFile_WriteString("\n", f) < 0) - return -1; + goto error; + Py_DECREF(f); return 0; - /* the line below is just to avoid compiler - * compiler warnings about unused functions */ +error: + Py_DECREF(f); + return -1; + /* the line below is just to avoid C compiler + * warnings about unused functions */ return __Pyx_Print(f, NULL, 0); } - #else /* Python 3 has a print function */ - static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { int res; - PyObject* arg_tuple = PyTuple_New(1); + PyObject* arg_tuple = PyTuple_Pack(1, o); if (unlikely(!arg_tuple)) return -1; - Py_INCREF(o); - PyTuple_SET_ITEM(arg_tuple, 0, o); res = __Pyx_Print(stream, arg_tuple, 1); Py_DECREF(arg_tuple); return res; } - #endif #if CYTHON_CCOMPLEX @@ -14308,8 +15240,8 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename) { +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); @@ -14363,6 +15295,23 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -14372,15 +15321,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -14396,7 +15340,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -14406,7 +15350,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -14420,28 +15364,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - static void* __Pyx_GetVtable(PyObject *dict) { void* ptr; PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); @@ -14461,29 +15383,105 @@ static void* __Pyx_GetVtable(PyObject *dict) { return NULL; } +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -14494,28 +15492,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -14523,11 +15538,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -14562,6 +15575,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/sklearn/linear_model/sgd_fast.pyx b/sklearn/linear_model/sgd_fast.pyx index 035f5f4eda531..9aa5c0a7cdf3b 100644 --- a/sklearn/linear_model/sgd_fast.pyx +++ b/sklearn/linear_model/sgd_fast.pyx @@ -12,19 +12,15 @@ import numpy as np import sys from time import time +from libc.math cimport exp, log, sqrt, pow, fabs cimport numpy as np cimport cython from sklearn.utils.weight_vector cimport WeightVector from sklearn.utils.seq_dataset cimport SequentialDataset +np.import_array() -cdef extern from "math.h": - cdef extern double exp(double x) - cdef extern double log(double x) - cdef extern double sqrt(double x) - cdef extern double pow(double x, double y) - cdef extern double fabs(double x) ctypedef np.float64_t DOUBLE ctypedef np.int32_t INTEGER diff --git a/sklearn/metrics/cluster/expected_mutual_info_fast.pyx b/sklearn/metrics/cluster/expected_mutual_info_fast.pyx index adbdd50d33802..d67dc85df6dc2 100644 --- a/sklearn/metrics/cluster/expected_mutual_info_fast.pyx +++ b/sklearn/metrics/cluster/expected_mutual_info_fast.pyx @@ -6,14 +6,14 @@ # Corey Lynch # License: BSD Style. +from libc.math cimport exp, lgamma from scipy.special import gammaln import numpy as np cimport numpy as np cimport cython -cdef extern from "math.h": - cdef extern double exp(double x) - cdef extern double lgamma(double x) +np.import_array() + @cython.boundscheck(False) @cython.wraparound(False) diff --git a/sklearn/metrics/pairwise_fast.c b/sklearn/metrics/pairwise_fast.c index 71177775718e2..5fd5eadf0e7d7 100644 --- a/sklearn/metrics/pairwise_fast.c +++ b/sklearn/metrics/pairwise_fast.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.1 on Sun Nov 25 22:43:53 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:49 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -53,12 +53,15 @@ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) - #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) @@ -1089,7 +1092,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* #define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) -static 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); /*proto*/ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/ @@ -1100,7 +1103,7 @@ static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/ #include -static 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); /*proto*/ static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/ @@ -1546,7 +1549,7 @@ static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(stru static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */ static char __pyx_k_1[] = "Expected at least %d arguments"; static char __pyx_k_5[] = "()"; -static char __pyx_k_7[] = ", "; +static char __pyx_k_7[] = "|"; static char __pyx_k_9[] = "No matching signature found"; static char __pyx_k_11[] = "Function call with ambiguous argument types"; static char __pyx_k_13[] = "ndarray is not C contiguous"; @@ -1575,10 +1578,10 @@ static char __pyx_k_54[] = "Out of bounds on buffer access (axis %d)"; static char __pyx_k_55[] = "Cannot transpose memoryview with indirect dimensions"; static char __pyx_k_56[] = "got differing extents in dimension %d (got %d and %d)"; static char __pyx_k_57[] = "Dimension %d is not direct"; -static char __pyx_k_60[] = "/home/andy/checkout/scikit-learn/sklearn/metrics/pairwise_fast.pyx"; -static char __pyx_k_61[] = "float, float, float"; +static char __pyx_k_60[] = "/scratch/apps/src/scikit-learn/sklearn/metrics/pairwise_fast.pyx"; +static char __pyx_k_61[] = "float|float|float"; static char __pyx_k_62[] = "sklearn.metrics.pairwise_fast"; -static char __pyx_k_63[] = "double, double, double"; +static char __pyx_k_63[] = "double|double|double"; static char __pyx_k_64[] = "getbuffer(obj, view, flags)"; static char __pyx_k_65[] = ""; static char __pyx_k_67[] = ""; @@ -1786,6 +1789,7 @@ static PyObject *__pyx_n_s__xrange; static PyObject *__pyx_n_s__zip; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_int_15; static PyObject *__pyx_int_105; @@ -1823,12 +1827,12 @@ static PyObject *__pyx_k_tuple_72; static PyObject *__pyx_k_tuple_74; static PyObject *__pyx_k_codeobj_59; -/* "sklearn/metrics/pairwise_fast.pyx":13 +/* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ /* Python wrapper */ @@ -1864,21 +1868,21 @@ static PyObject *__pyx_pw_7sklearn_7metrics_13pairwise_fast_1_chi2_kernel_fast(P case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__args)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kwargs)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__defaults)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -1895,7 +1899,7 @@ static PyObject *__pyx_pw_7sklearn_7metrics_13pairwise_fast_1_chi2_kernel_fast(P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.metrics.pairwise_fast.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -1947,7 +1951,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_chi2_kernel_fast", 0); __Pyx_INCREF(__pyx_v_kwargs); - __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(Py_None); PyList_SET_ITEM(__pyx_t_1, 0, Py_None); @@ -1962,7 +1966,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_t_1 = 0; __pyx_t_2 = (__pyx_v_kwargs == Py_None); if (__pyx_t_2) { - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = ((PyObject *)__pyx_t_1); @@ -1976,7 +1980,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L4_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_numpy = __pyx_t_1; __pyx_t_1 = 0; @@ -1990,7 +1994,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError); if (__pyx_t_6) { __Pyx_AddTraceback("sklearn.metrics.pairwise_fast.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} + if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); @@ -2016,41 +2020,41 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_L11_try_end:; } __pyx_v_itemsize = -1; - __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (0 < __pyx_t_9); if (__pyx_t_2) { - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_args, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_v_arg = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L14; } - __pyx_t_2 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__X), __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__X), __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - __pyx_t_8 = PyObject_GetItem(__pyx_v_kwargs, ((PyObject *)__pyx_n_s__X)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetItem(__pyx_v_kwargs, ((PyObject *)__pyx_n_s__X)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_v_arg = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L14; } /*else*/ { - __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__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[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L14:; if (0) { @@ -2061,12 +2065,12 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY if (!1) break; __pyx_t_2 = (__pyx_v_numpy != Py_None); if (__pyx_t_2) { - __pyx_t_7 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_7); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_7); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_2) { - __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_v_dtype = __pyx_t_7; __pyx_t_7 = 0; @@ -2074,11 +2078,11 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY } __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg); if (__pyx_t_2) { - __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = PyObject_IsInstance(__pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_IsInstance(__pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_11 = __pyx_t_10; @@ -2086,9 +2090,9 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_t_11 = __pyx_t_2; } if (__pyx_t_11) { - __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_dtype = __pyx_t_7; @@ -2103,77 +2107,99 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_v_itemsize = -1; __pyx_t_11 = (__pyx_v_dtype != Py_None); if (__pyx_t_11) { - __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_itemsize = __pyx_t_9; - __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyInt_AsChar(__pyx_t_7); if (unlikely((__pyx_t_12 == (char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_AsChar(__pyx_t_7); if (unlikely((__pyx_t_12 == (char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_kind = __pyx_t_12; - __pyx_t_7 = PyInt_FromLong(__pyx_v_kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromLong(__pyx_v_kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_int_105, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_int_105, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_dtype_signed = __pyx_t_11; - __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_11 = (__Pyx_PySequence_Contains(__pyx_t_8, ((PyObject *)__pyx_k_tuple_2), Py_EQ)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = (__Pyx_PySequence_Contains(__pyx_t_8, ((PyObject *)__pyx_k_tuple_2), Py_EQ)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_11) { goto __pyx_L21; } - __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__f), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__f), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_11) { __pyx_t_11 = ((sizeof(float)) == __pyx_v_itemsize); if (__pyx_t_11) { - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __pyx_t_2; + } else { + __pyx_t_10 = __pyx_t_11; + } + if (__pyx_t_10) { + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L17_break; goto __pyx_L22; } __pyx_L22:; - __pyx_t_11 = ((sizeof(double)) == __pyx_v_itemsize); - if (__pyx_t_11) { - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((sizeof(double)) == __pyx_v_itemsize); + if (__pyx_t_10) { + __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__ndim); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = __pyx_t_11; + } else { + __pyx_t_2 = __pyx_t_10; + } + if (__pyx_t_2) { + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L17_break; goto __pyx_L23; } __pyx_L23:; goto __pyx_L21; } - __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__c), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__c), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_11) { + if (__pyx_t_2) { goto __pyx_L21; } - __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11) { + if (__pyx_t_2) { goto __pyx_L21; } __pyx_L21:; @@ -2183,19 +2209,19 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY goto __pyx_L18; } __pyx_L18:; - __pyx_t_11 = (__pyx_v_itemsize == -1); - if (!__pyx_t_11) { - __pyx_t_2 = (__pyx_v_itemsize == (sizeof(float))); - __pyx_t_10 = __pyx_t_2; + __pyx_t_2 = (__pyx_v_itemsize == -1); + if (!__pyx_t_2) { + __pyx_t_10 = (__pyx_v_itemsize == (sizeof(float))); + __pyx_t_11 = __pyx_t_10; } else { - __pyx_t_10 = __pyx_t_11; + __pyx_t_11 = __pyx_t_2; } - if (__pyx_t_10) { + if (__pyx_t_11) { __pyx_v_memslice = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_arg); - __pyx_t_10 = (__pyx_v_memslice.memview != 0); - if (__pyx_t_10) { + __pyx_t_11 = (__pyx_v_memslice.memview != 0); + if (__pyx_t_11) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L17_break; goto __pyx_L25; } @@ -2206,19 +2232,19 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY goto __pyx_L24; } __pyx_L24:; - __pyx_t_10 = (__pyx_v_itemsize == -1); - if (!__pyx_t_10) { - __pyx_t_11 = (__pyx_v_itemsize == (sizeof(double))); - __pyx_t_2 = __pyx_t_11; + __pyx_t_11 = (__pyx_v_itemsize == -1); + if (!__pyx_t_11) { + __pyx_t_2 = (__pyx_v_itemsize == (sizeof(double))); + __pyx_t_10 = __pyx_t_2; } else { - __pyx_t_2 = __pyx_t_10; + __pyx_t_10 = __pyx_t_11; } - if (__pyx_t_2) { + if (__pyx_t_10) { __pyx_v_memslice = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_arg); - __pyx_t_2 = (__pyx_v_memslice.memview != 0); - if (__pyx_t_2) { + __pyx_t_10 = (__pyx_v_memslice.memview != 0); + if (__pyx_t_10) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L17_break; goto __pyx_L27; } @@ -2229,25 +2255,25 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY goto __pyx_L26; } __pyx_L26:; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, Py_None, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 0, Py_None, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L17_break; } __pyx_L17_break:; } __pyx_L15:; - __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = (1 < __pyx_t_9); - if (__pyx_t_2) { - __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_args, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = (1 < __pyx_t_9); + if (__pyx_t_10) { + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_args, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_v_arg); __pyx_v_arg = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L28; } - __pyx_t_2 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__Y), __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { - __pyx_t_7 = PyObject_GetItem(__pyx_v_kwargs, ((PyObject *)__pyx_n_s__Y)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__Y), __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_10) { + __pyx_t_7 = PyObject_GetItem(__pyx_v_kwargs, ((PyObject *)__pyx_n_s__Y)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_v_arg); __pyx_v_arg = __pyx_t_7; @@ -2255,23 +2281,23 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY goto __pyx_L28; } /*else*/ { - __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L28:; if (0) { @@ -2280,37 +2306,37 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY /*else*/ { while (1) { if (!1) break; - __pyx_t_2 = (__pyx_v_numpy != Py_None); - if (__pyx_t_2) { - __pyx_t_8 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = (__pyx_v_numpy != Py_None); + if (__pyx_t_10) { + __pyx_t_8 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_8); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_8); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_2) { - __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__dtype); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_10) { + __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__dtype); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_v_dtype); __pyx_v_dtype = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L33; } - __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg); - if (__pyx_t_2) { - __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __pyx_memoryview_check(__pyx_v_arg); + if (__pyx_t_10) { + __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = PyObject_IsInstance(__pyx_t_8, __pyx_t_7); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_IsInstance(__pyx_t_8, __pyx_t_7); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __pyx_t_10; + __pyx_t_2 = __pyx_t_11; } else { - __pyx_t_11 = __pyx_t_2; + __pyx_t_2 = __pyx_t_10; } - if (__pyx_t_11) { - __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__dtype); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__dtype); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_v_dtype); @@ -2325,79 +2351,101 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY } __pyx_L33:; __pyx_v_itemsize = -1; - __pyx_t_11 = (__pyx_v_dtype != Py_None); - if (__pyx_t_11) { - __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__pyx_v_dtype != Py_None); + if (__pyx_t_2) { + __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_itemsize = __pyx_t_9; - __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_12 = __Pyx_PyInt_AsChar(__pyx_t_8); if (unlikely((__pyx_t_12 == (char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_AsChar(__pyx_t_8); if (unlikely((__pyx_t_12 == (char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_kind = __pyx_t_12; - __pyx_t_8 = PyInt_FromLong(__pyx_v_kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong(__pyx_v_kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_int_105, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_int_105, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_dtype_signed = __pyx_t_11; - __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_dtype_signed = __pyx_t_2; + __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = (__Pyx_PySequence_Contains(__pyx_t_7, ((PyObject *)__pyx_k_tuple_3), Py_EQ)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_t_7, ((PyObject *)__pyx_k_tuple_3), Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11) { + if (__pyx_t_2) { goto __pyx_L35; } - __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__f), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__f), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_11) { - __pyx_t_11 = ((sizeof(float)) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_2 = ((sizeof(float)) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__ndim); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = __pyx_t_10; + } else { + __pyx_t_11 = __pyx_t_2; + } if (__pyx_t_11) { - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L31_break; goto __pyx_L36; } __pyx_L36:; __pyx_t_11 = ((sizeof(double)) == __pyx_v_itemsize); if (__pyx_t_11) { - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __pyx_t_2; + } else { + __pyx_t_10 = __pyx_t_11; + } + if (__pyx_t_10) { + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L31_break; goto __pyx_L37; } __pyx_L37:; goto __pyx_L35; } - __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__c), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__c), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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 = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11) { + if (__pyx_t_10) { goto __pyx_L35; } - __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_11) { + if (__pyx_t_10) { goto __pyx_L35; } __pyx_L35:; @@ -2407,19 +2455,19 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY goto __pyx_L32; } __pyx_L32:; - __pyx_t_11 = (__pyx_v_itemsize == -1); - if (!__pyx_t_11) { - __pyx_t_2 = (__pyx_v_itemsize == (sizeof(float))); - __pyx_t_10 = __pyx_t_2; + __pyx_t_10 = (__pyx_v_itemsize == -1); + if (!__pyx_t_10) { + __pyx_t_11 = (__pyx_v_itemsize == (sizeof(float))); + __pyx_t_2 = __pyx_t_11; } else { - __pyx_t_10 = __pyx_t_11; + __pyx_t_2 = __pyx_t_10; } - if (__pyx_t_10) { + if (__pyx_t_2) { __pyx_v_memslice = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_arg); - __pyx_t_10 = (__pyx_v_memslice.memview != 0); - if (__pyx_t_10) { + __pyx_t_2 = (__pyx_v_memslice.memview != 0); + if (__pyx_t_2) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L31_break; goto __pyx_L39; } @@ -2430,19 +2478,19 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY goto __pyx_L38; } __pyx_L38:; - __pyx_t_10 = (__pyx_v_itemsize == -1); - if (!__pyx_t_10) { - __pyx_t_11 = (__pyx_v_itemsize == (sizeof(double))); - __pyx_t_2 = __pyx_t_11; + __pyx_t_2 = (__pyx_v_itemsize == -1); + if (!__pyx_t_2) { + __pyx_t_10 = (__pyx_v_itemsize == (sizeof(double))); + __pyx_t_11 = __pyx_t_10; } else { - __pyx_t_2 = __pyx_t_10; + __pyx_t_11 = __pyx_t_2; } - if (__pyx_t_2) { + if (__pyx_t_11) { __pyx_v_memslice = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_arg); - __pyx_t_2 = (__pyx_v_memslice.memview != 0); - if (__pyx_t_2) { + __pyx_t_11 = (__pyx_v_memslice.memview != 0); + if (__pyx_t_11) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L31_break; goto __pyx_L41; } @@ -2453,25 +2501,25 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY goto __pyx_L40; } __pyx_L40:; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, Py_None, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 1, Py_None, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L31_break; } __pyx_L31_break:; } __pyx_L29:; - __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = (2 < __pyx_t_9); - if (__pyx_t_2) { - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_args, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = (2 < __pyx_t_9); + if (__pyx_t_11) { + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_args, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_v_arg); __pyx_v_arg = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L42; } - __pyx_t_2 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__result), __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_2) { - __pyx_t_8 = PyObject_GetItem(__pyx_v_kwargs, ((PyObject *)__pyx_n_s__result)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = (__Pyx_PySequence_Contains(((PyObject *)__pyx_n_s__result), __pyx_v_kwargs, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_11) { + __pyx_t_8 = PyObject_GetItem(__pyx_v_kwargs, ((PyObject *)__pyx_n_s__result)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_v_arg); __pyx_v_arg = __pyx_t_8; @@ -2479,23 +2527,23 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY goto __pyx_L42; } /*else*/ { - __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__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[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 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 = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L42:; if (0) { @@ -2504,37 +2552,37 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY /*else*/ { while (1) { if (!1) break; - __pyx_t_2 = (__pyx_v_numpy != Py_None); - if (__pyx_t_2) { - __pyx_t_7 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = (__pyx_v_numpy != Py_None); + if (__pyx_t_11) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_7); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_IsInstance(__pyx_v_arg, __pyx_t_7); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_2) { - __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_11) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_XDECREF(__pyx_v_dtype); __pyx_v_dtype = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L47; } - __pyx_t_2 = __pyx_memoryview_check(__pyx_v_arg); - if (__pyx_t_2) { - __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_memoryview_check(__pyx_v_arg); + if (__pyx_t_11) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_numpy, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = PyObject_IsInstance(__pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_IsInstance(__pyx_t_7, __pyx_t_8); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_11 = __pyx_t_10; + __pyx_t_10 = __pyx_t_2; } else { - __pyx_t_11 = __pyx_t_2; + __pyx_t_10 = __pyx_t_11; } - if (__pyx_t_11) { - __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_10) { + __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__base); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_v_dtype); @@ -2549,77 +2597,99 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY } __pyx_L47:; __pyx_v_itemsize = -1; - __pyx_t_11 = (__pyx_v_dtype != Py_None); - if (__pyx_t_11) { - __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = (__pyx_v_dtype != Py_None); + if (__pyx_t_10) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_itemsize = __pyx_t_9; - __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_ord, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_12 = __Pyx_PyInt_AsChar(__pyx_t_7); if (unlikely((__pyx_t_12 == (char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_AsChar(__pyx_t_7); if (unlikely((__pyx_t_12 == (char)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_kind = __pyx_t_12; - __pyx_t_7 = PyInt_FromLong(__pyx_v_kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromLong(__pyx_v_kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_int_105, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_int_105, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_v_dtype_signed = __pyx_t_11; - __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_dtype_signed = __pyx_t_10; + __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_11 = (__Pyx_PySequence_Contains(__pyx_t_8, ((PyObject *)__pyx_k_tuple_4), Py_EQ)); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = (__Pyx_PySequence_Contains(__pyx_t_8, ((PyObject *)__pyx_k_tuple_4), Py_EQ)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_11) { + if (__pyx_t_10) { goto __pyx_L49; } - __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__f), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__f), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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 = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_11) { - __pyx_t_11 = ((sizeof(float)) == __pyx_v_itemsize); - if (__pyx_t_11) { - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_10) { + __pyx_t_10 = ((sizeof(float)) == __pyx_v_itemsize); + if (__pyx_t_10) { + __pyx_t_7 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_2 = __pyx_t_11; + } else { + __pyx_t_2 = __pyx_t_10; + } + if (__pyx_t_2) { + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L45_break; goto __pyx_L50; } __pyx_L50:; - __pyx_t_11 = ((sizeof(double)) == __pyx_v_itemsize); + __pyx_t_2 = ((sizeof(double)) == __pyx_v_itemsize); + if (__pyx_t_2) { + __pyx_t_8 = PyObject_GetAttr(__pyx_v_arg, __pyx_n_s__ndim); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_11 = __pyx_t_10; + } else { + __pyx_t_11 = __pyx_t_2; + } if (__pyx_t_11) { - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L45_break; goto __pyx_L51; } __pyx_L51:; goto __pyx_L49; } - __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__c), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, ((PyObject *)__pyx_n_s__c), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_11) { goto __pyx_L49; } - __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_11) { goto __pyx_L49; @@ -2643,7 +2713,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_t_10 = (__pyx_v_memslice.memview != 0); if (__pyx_t_10) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, ((PyObject *)__pyx_n_s__float), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L45_break; goto __pyx_L53; } @@ -2666,7 +2736,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_t_2 = (__pyx_v_memslice.memview != 0); if (__pyx_t_2) { __PYX_XDEC_MEMVIEW((&__pyx_v_memslice), 1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, ((PyObject *)__pyx_n_s__double), sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L45_break; goto __pyx_L55; } @@ -2677,13 +2747,13 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY goto __pyx_L54; } __pyx_L54:; - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, Py_None, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dest_sig), 2, Py_None, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L45_break; } __pyx_L45_break:; } __pyx_L43:; - __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_v_candidates = __pyx_t_7; __pyx_t_7 = 0; @@ -2691,7 +2761,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_t_7 = __pyx_v_signatures; __Pyx_INCREF(__pyx_t_7); __pyx_t_9 = 0; __pyx_t_13 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_signatures); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_signatures); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_13 = Py_TYPE(__pyx_t_7)->tp_iternext; } @@ -2699,23 +2769,23 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY if (!__pyx_t_13 && PyList_CheckExact(__pyx_t_7)) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_13 && PyTuple_CheckExact(__pyx_t_7)) { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_7)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_8 = __pyx_t_13(__pyx_t_7); if (unlikely(!__pyx_t_8)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -2725,18 +2795,18 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_v_sig = __pyx_t_8; __pyx_t_8 = 0; __pyx_v_match_found = 0; - __pyx_t_8 = PyObject_GetAttr(__pyx_v_sig, __pyx_n_s__strip); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_sig, __pyx_n_s__strip); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__split); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __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); @@ -2744,14 +2814,14 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_dest_sig)); __Pyx_GIVEREF(((PyObject *)__pyx_v_dest_sig)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_zip, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_8 = __pyx_t_1; __Pyx_INCREF(__pyx_t_8); __pyx_t_14 = 0; __pyx_t_15 = NULL; } else { - __pyx_t_14 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext; } @@ -2760,23 +2830,23 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_8)) { if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_8)) { if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -2792,7 +2862,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -2805,14 +2875,14 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __Pyx_INCREF(__pyx_t_16); __Pyx_INCREF(__pyx_t_17); #else - __pyx_t_16 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_17 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_18 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_18 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_18); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_19 = Py_TYPE(__pyx_t_18)->tp_iternext; @@ -2820,7 +2890,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __Pyx_GOTREF(__pyx_t_16); index = 1; __pyx_t_17 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_17)) goto __pyx_L60_unpacking_failed; __Pyx_GOTREF(__pyx_t_17); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_18), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_18), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = NULL; __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; goto __pyx_L61_unpacking_done; @@ -2828,7 +2898,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __pyx_t_19 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L61_unpacking_done:; } __Pyx_XDECREF(__pyx_v_src_type); @@ -2839,8 +2909,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_t_17 = 0; __pyx_t_2 = (__pyx_v_dst_type != Py_None); if (__pyx_t_2) { - __pyx_t_1 = PyObject_RichCompare(__pyx_v_src_type, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_src_type, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { __pyx_v_match_found = 1; @@ -2858,7 +2928,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_L59_break:; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_v_match_found) { - __pyx_t_20 = PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_20 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_20 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L64; } __pyx_L64:; @@ -2867,26 +2937,26 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast__chi2_kernel_fast(CY __pyx_t_2 = (((PyObject *)__pyx_v_candidates) != Py_None) && (PyList_GET_SIZE(((PyObject *)__pyx_v_candidates)) != 0); __pyx_t_10 = (!__pyx_t_2); if (__pyx_t_10) { - __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L65; } - __pyx_t_9 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidates)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyList_GET_SIZE(((PyObject *)__pyx_v_candidates)); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = (__pyx_t_9 > 1); if (__pyx_t_10) { - __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L65; } /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = PyObject_GetItem(__pyx_v_signatures, PyList_GET_ITEM(__pyx_v_candidates, 0)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetItem(__pyx_v_signatures, PyList_GET_ITEM(__pyx_v_candidates, 0)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; @@ -2951,16 +3021,16 @@ static PyObject *__pyx_fuse_0_0_0__pyx_pw_7sklearn_7metrics_13pairwise_fast_3_ch case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -2969,13 +3039,13 @@ static PyObject *__pyx_fuse_0_0_0__pyx_pw_7sklearn_7metrics_13pairwise_fast_3_ch values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.metrics.pairwise_fast._chi2_kernel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3015,8 +3085,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C int __pyx_t_15; __Pyx_RefNannySetupContext("__pyx_fuse_0_0_0_chi2_kernel_fast", 0); - /* "sklearn/metrics/pairwise_fast.pyx":15 - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): + /* "sklearn/metrics/pairwise_fast.pyx":19 + * cython.floating[:, :] result): * cdef int i, j, k * cdef int n_samples_X = X.shape[0] # <<<<<<<<<<<<<< * cdef int n_samples_Y = Y.shape[0] @@ -3024,7 +3094,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C */ __pyx_v_n_samples_X = (__pyx_v_X.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":16 + /* "sklearn/metrics/pairwise_fast.pyx":20 * cdef int i, j, k * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] # <<<<<<<<<<<<<< @@ -3033,7 +3103,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C */ __pyx_v_n_samples_Y = (__pyx_v_Y.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":17 + /* "sklearn/metrics/pairwise_fast.pyx":21 * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] * cdef int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -3042,7 +3112,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C */ __pyx_v_n_features = (__pyx_v_X.shape[1]); - /* "sklearn/metrics/pairwise_fast.pyx":19 + /* "sklearn/metrics/pairwise_fast.pyx":23 * cdef int n_features = X.shape[1] * cdef double res, nom, denom * for i in xrange(n_samples_X): # <<<<<<<<<<<<<< @@ -3053,7 +3123,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/metrics/pairwise_fast.pyx":20 + /* "sklearn/metrics/pairwise_fast.pyx":24 * cdef double res, nom, denom * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): # <<<<<<<<<<<<<< @@ -3064,7 +3134,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/metrics/pairwise_fast.pyx":21 + /* "sklearn/metrics/pairwise_fast.pyx":25 * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): * res = 0 # <<<<<<<<<<<<<< @@ -3073,7 +3143,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C */ __pyx_v_res = 0.0; - /* "sklearn/metrics/pairwise_fast.pyx":22 + /* "sklearn/metrics/pairwise_fast.pyx":26 * for j in xrange(n_samples_Y): * res = 0 * for k in xrange(n_features): # <<<<<<<<<<<<<< @@ -3084,7 +3154,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_k = __pyx_t_6; - /* "sklearn/metrics/pairwise_fast.pyx":23 + /* "sklearn/metrics/pairwise_fast.pyx":27 * res = 0 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) # <<<<<<<<<<<<<< @@ -3097,7 +3167,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C __pyx_t_10 = __pyx_v_k; __pyx_v_denom = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) ) + __pyx_t_8 * __pyx_v_X.strides[1]) ))) - (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) ) + __pyx_t_10 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":24 + /* "sklearn/metrics/pairwise_fast.pyx":28 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) # <<<<<<<<<<<<<< @@ -3110,7 +3180,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C __pyx_t_14 = __pyx_v_k; __pyx_v_nom = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_11 * __pyx_v_X.strides[0]) ) + __pyx_t_12 * __pyx_v_X.strides[1]) ))) + (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_13 * __pyx_v_Y.strides[0]) ) + __pyx_t_14 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":25 + /* "sklearn/metrics/pairwise_fast.pyx":29 * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) * if nom != 0: # <<<<<<<<<<<<<< @@ -3120,7 +3190,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C __pyx_t_15 = (__pyx_v_nom != 0.0); if (__pyx_t_15) { - /* "sklearn/metrics/pairwise_fast.pyx":26 + /* "sklearn/metrics/pairwise_fast.pyx":30 * nom = (X[i, k] + Y[j, k]) * if nom != 0: * res += denom * denom / nom # <<<<<<<<<<<<<< @@ -3132,7 +3202,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C __pyx_L9:; } - /* "sklearn/metrics/pairwise_fast.pyx":27 + /* "sklearn/metrics/pairwise_fast.pyx":31 * if nom != 0: * res += denom * denom / nom * result[i, j] = -res # <<<<<<<<<<<<<< @@ -3152,12 +3222,12 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_2_chi2_kernel_fast(C return __pyx_r; } -/* "sklearn/metrics/pairwise_fast.pyx":13 +/* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ /* Python wrapper */ @@ -3191,16 +3261,16 @@ static PyObject *__pyx_fuse_0_0_1__pyx_pw_7sklearn_7metrics_13pairwise_fast_5_ch case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3209,13 +3279,13 @@ static PyObject *__pyx_fuse_0_0_1__pyx_pw_7sklearn_7metrics_13pairwise_fast_5_ch values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.metrics.pairwise_fast._chi2_kernel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3255,8 +3325,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C int __pyx_t_15; __Pyx_RefNannySetupContext("__pyx_fuse_0_0_1_chi2_kernel_fast", 0); - /* "sklearn/metrics/pairwise_fast.pyx":15 - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): + /* "sklearn/metrics/pairwise_fast.pyx":19 + * cython.floating[:, :] result): * cdef int i, j, k * cdef int n_samples_X = X.shape[0] # <<<<<<<<<<<<<< * cdef int n_samples_Y = Y.shape[0] @@ -3264,7 +3334,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C */ __pyx_v_n_samples_X = (__pyx_v_X.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":16 + /* "sklearn/metrics/pairwise_fast.pyx":20 * cdef int i, j, k * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] # <<<<<<<<<<<<<< @@ -3273,7 +3343,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C */ __pyx_v_n_samples_Y = (__pyx_v_Y.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":17 + /* "sklearn/metrics/pairwise_fast.pyx":21 * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] * cdef int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -3282,7 +3352,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C */ __pyx_v_n_features = (__pyx_v_X.shape[1]); - /* "sklearn/metrics/pairwise_fast.pyx":19 + /* "sklearn/metrics/pairwise_fast.pyx":23 * cdef int n_features = X.shape[1] * cdef double res, nom, denom * for i in xrange(n_samples_X): # <<<<<<<<<<<<<< @@ -3293,7 +3363,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/metrics/pairwise_fast.pyx":20 + /* "sklearn/metrics/pairwise_fast.pyx":24 * cdef double res, nom, denom * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): # <<<<<<<<<<<<<< @@ -3304,7 +3374,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/metrics/pairwise_fast.pyx":21 + /* "sklearn/metrics/pairwise_fast.pyx":25 * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): * res = 0 # <<<<<<<<<<<<<< @@ -3313,7 +3383,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C */ __pyx_v_res = 0.0; - /* "sklearn/metrics/pairwise_fast.pyx":22 + /* "sklearn/metrics/pairwise_fast.pyx":26 * for j in xrange(n_samples_Y): * res = 0 * for k in xrange(n_features): # <<<<<<<<<<<<<< @@ -3324,7 +3394,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_k = __pyx_t_6; - /* "sklearn/metrics/pairwise_fast.pyx":23 + /* "sklearn/metrics/pairwise_fast.pyx":27 * res = 0 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) # <<<<<<<<<<<<<< @@ -3337,7 +3407,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C __pyx_t_10 = __pyx_v_k; __pyx_v_denom = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) ) + __pyx_t_8 * __pyx_v_X.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) ) + __pyx_t_10 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":24 + /* "sklearn/metrics/pairwise_fast.pyx":28 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) # <<<<<<<<<<<<<< @@ -3350,7 +3420,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C __pyx_t_14 = __pyx_v_k; __pyx_v_nom = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_11 * __pyx_v_X.strides[0]) ) + __pyx_t_12 * __pyx_v_X.strides[1]) ))) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_13 * __pyx_v_Y.strides[0]) ) + __pyx_t_14 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":25 + /* "sklearn/metrics/pairwise_fast.pyx":29 * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) * if nom != 0: # <<<<<<<<<<<<<< @@ -3360,7 +3430,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C __pyx_t_15 = (__pyx_v_nom != 0.0); if (__pyx_t_15) { - /* "sklearn/metrics/pairwise_fast.pyx":26 + /* "sklearn/metrics/pairwise_fast.pyx":30 * nom = (X[i, k] + Y[j, k]) * if nom != 0: * res += denom * denom / nom # <<<<<<<<<<<<<< @@ -3372,7 +3442,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C __pyx_L9:; } - /* "sklearn/metrics/pairwise_fast.pyx":27 + /* "sklearn/metrics/pairwise_fast.pyx":31 * if nom != 0: * res += denom * denom / nom * result[i, j] = -res # <<<<<<<<<<<<<< @@ -3392,12 +3462,12 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_4_chi2_kernel_fast(C return __pyx_r; } -/* "sklearn/metrics/pairwise_fast.pyx":13 +/* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ /* Python wrapper */ @@ -3431,16 +3501,16 @@ static PyObject *__pyx_fuse_0_1_0__pyx_pw_7sklearn_7metrics_13pairwise_fast_7_ch case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3449,13 +3519,13 @@ static PyObject *__pyx_fuse_0_1_0__pyx_pw_7sklearn_7metrics_13pairwise_fast_7_ch values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.metrics.pairwise_fast._chi2_kernel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3495,8 +3565,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C int __pyx_t_15; __Pyx_RefNannySetupContext("__pyx_fuse_0_1_0_chi2_kernel_fast", 0); - /* "sklearn/metrics/pairwise_fast.pyx":15 - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): + /* "sklearn/metrics/pairwise_fast.pyx":19 + * cython.floating[:, :] result): * cdef int i, j, k * cdef int n_samples_X = X.shape[0] # <<<<<<<<<<<<<< * cdef int n_samples_Y = Y.shape[0] @@ -3504,7 +3574,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C */ __pyx_v_n_samples_X = (__pyx_v_X.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":16 + /* "sklearn/metrics/pairwise_fast.pyx":20 * cdef int i, j, k * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] # <<<<<<<<<<<<<< @@ -3513,7 +3583,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C */ __pyx_v_n_samples_Y = (__pyx_v_Y.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":17 + /* "sklearn/metrics/pairwise_fast.pyx":21 * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] * cdef int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -3522,7 +3592,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C */ __pyx_v_n_features = (__pyx_v_X.shape[1]); - /* "sklearn/metrics/pairwise_fast.pyx":19 + /* "sklearn/metrics/pairwise_fast.pyx":23 * cdef int n_features = X.shape[1] * cdef double res, nom, denom * for i in xrange(n_samples_X): # <<<<<<<<<<<<<< @@ -3533,7 +3603,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/metrics/pairwise_fast.pyx":20 + /* "sklearn/metrics/pairwise_fast.pyx":24 * cdef double res, nom, denom * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): # <<<<<<<<<<<<<< @@ -3544,7 +3614,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/metrics/pairwise_fast.pyx":21 + /* "sklearn/metrics/pairwise_fast.pyx":25 * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): * res = 0 # <<<<<<<<<<<<<< @@ -3553,7 +3623,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C */ __pyx_v_res = 0.0; - /* "sklearn/metrics/pairwise_fast.pyx":22 + /* "sklearn/metrics/pairwise_fast.pyx":26 * for j in xrange(n_samples_Y): * res = 0 * for k in xrange(n_features): # <<<<<<<<<<<<<< @@ -3564,7 +3634,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_k = __pyx_t_6; - /* "sklearn/metrics/pairwise_fast.pyx":23 + /* "sklearn/metrics/pairwise_fast.pyx":27 * res = 0 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) # <<<<<<<<<<<<<< @@ -3577,7 +3647,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C __pyx_t_10 = __pyx_v_k; __pyx_v_denom = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) ) + __pyx_t_8 * __pyx_v_X.strides[1]) ))) - (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) ) + __pyx_t_10 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":24 + /* "sklearn/metrics/pairwise_fast.pyx":28 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) # <<<<<<<<<<<<<< @@ -3590,7 +3660,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C __pyx_t_14 = __pyx_v_k; __pyx_v_nom = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_11 * __pyx_v_X.strides[0]) ) + __pyx_t_12 * __pyx_v_X.strides[1]) ))) + (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_13 * __pyx_v_Y.strides[0]) ) + __pyx_t_14 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":25 + /* "sklearn/metrics/pairwise_fast.pyx":29 * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) * if nom != 0: # <<<<<<<<<<<<<< @@ -3600,7 +3670,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C __pyx_t_15 = (__pyx_v_nom != 0.0); if (__pyx_t_15) { - /* "sklearn/metrics/pairwise_fast.pyx":26 + /* "sklearn/metrics/pairwise_fast.pyx":30 * nom = (X[i, k] + Y[j, k]) * if nom != 0: * res += denom * denom / nom # <<<<<<<<<<<<<< @@ -3612,7 +3682,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C __pyx_L9:; } - /* "sklearn/metrics/pairwise_fast.pyx":27 + /* "sklearn/metrics/pairwise_fast.pyx":31 * if nom != 0: * res += denom * denom / nom * result[i, j] = -res # <<<<<<<<<<<<<< @@ -3632,12 +3702,12 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_6_chi2_kernel_fast(C return __pyx_r; } -/* "sklearn/metrics/pairwise_fast.pyx":13 +/* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ /* Python wrapper */ @@ -3671,16 +3741,16 @@ static PyObject *__pyx_fuse_0_1_1__pyx_pw_7sklearn_7metrics_13pairwise_fast_9_ch case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3689,13 +3759,13 @@ static PyObject *__pyx_fuse_0_1_1__pyx_pw_7sklearn_7metrics_13pairwise_fast_9_ch values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.metrics.pairwise_fast._chi2_kernel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3735,8 +3805,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C int __pyx_t_15; __Pyx_RefNannySetupContext("__pyx_fuse_0_1_1_chi2_kernel_fast", 0); - /* "sklearn/metrics/pairwise_fast.pyx":15 - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): + /* "sklearn/metrics/pairwise_fast.pyx":19 + * cython.floating[:, :] result): * cdef int i, j, k * cdef int n_samples_X = X.shape[0] # <<<<<<<<<<<<<< * cdef int n_samples_Y = Y.shape[0] @@ -3744,7 +3814,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C */ __pyx_v_n_samples_X = (__pyx_v_X.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":16 + /* "sklearn/metrics/pairwise_fast.pyx":20 * cdef int i, j, k * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] # <<<<<<<<<<<<<< @@ -3753,7 +3823,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C */ __pyx_v_n_samples_Y = (__pyx_v_Y.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":17 + /* "sklearn/metrics/pairwise_fast.pyx":21 * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] * cdef int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -3762,7 +3832,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C */ __pyx_v_n_features = (__pyx_v_X.shape[1]); - /* "sklearn/metrics/pairwise_fast.pyx":19 + /* "sklearn/metrics/pairwise_fast.pyx":23 * cdef int n_features = X.shape[1] * cdef double res, nom, denom * for i in xrange(n_samples_X): # <<<<<<<<<<<<<< @@ -3773,7 +3843,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/metrics/pairwise_fast.pyx":20 + /* "sklearn/metrics/pairwise_fast.pyx":24 * cdef double res, nom, denom * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): # <<<<<<<<<<<<<< @@ -3784,7 +3854,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/metrics/pairwise_fast.pyx":21 + /* "sklearn/metrics/pairwise_fast.pyx":25 * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): * res = 0 # <<<<<<<<<<<<<< @@ -3793,7 +3863,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C */ __pyx_v_res = 0.0; - /* "sklearn/metrics/pairwise_fast.pyx":22 + /* "sklearn/metrics/pairwise_fast.pyx":26 * for j in xrange(n_samples_Y): * res = 0 * for k in xrange(n_features): # <<<<<<<<<<<<<< @@ -3804,7 +3874,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_k = __pyx_t_6; - /* "sklearn/metrics/pairwise_fast.pyx":23 + /* "sklearn/metrics/pairwise_fast.pyx":27 * res = 0 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) # <<<<<<<<<<<<<< @@ -3817,7 +3887,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C __pyx_t_10 = __pyx_v_k; __pyx_v_denom = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) ) + __pyx_t_8 * __pyx_v_X.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) ) + __pyx_t_10 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":24 + /* "sklearn/metrics/pairwise_fast.pyx":28 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) # <<<<<<<<<<<<<< @@ -3830,7 +3900,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C __pyx_t_14 = __pyx_v_k; __pyx_v_nom = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_11 * __pyx_v_X.strides[0]) ) + __pyx_t_12 * __pyx_v_X.strides[1]) ))) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_13 * __pyx_v_Y.strides[0]) ) + __pyx_t_14 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":25 + /* "sklearn/metrics/pairwise_fast.pyx":29 * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) * if nom != 0: # <<<<<<<<<<<<<< @@ -3840,7 +3910,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C __pyx_t_15 = (__pyx_v_nom != 0.0); if (__pyx_t_15) { - /* "sklearn/metrics/pairwise_fast.pyx":26 + /* "sklearn/metrics/pairwise_fast.pyx":30 * nom = (X[i, k] + Y[j, k]) * if nom != 0: * res += denom * denom / nom # <<<<<<<<<<<<<< @@ -3852,7 +3922,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C __pyx_L9:; } - /* "sklearn/metrics/pairwise_fast.pyx":27 + /* "sklearn/metrics/pairwise_fast.pyx":31 * if nom != 0: * res += denom * denom / nom * result[i, j] = -res # <<<<<<<<<<<<<< @@ -3872,12 +3942,12 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_8_chi2_kernel_fast(C return __pyx_r; } -/* "sklearn/metrics/pairwise_fast.pyx":13 +/* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ /* Python wrapper */ @@ -3911,16 +3981,16 @@ static PyObject *__pyx_fuse_1_0_0__pyx_pw_7sklearn_7metrics_13pairwise_fast_11_c case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3929,13 +3999,13 @@ static PyObject *__pyx_fuse_1_0_0__pyx_pw_7sklearn_7metrics_13pairwise_fast_11_c values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.metrics.pairwise_fast._chi2_kernel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3975,8 +4045,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( int __pyx_t_15; __Pyx_RefNannySetupContext("__pyx_fuse_1_0_0_chi2_kernel_fast", 0); - /* "sklearn/metrics/pairwise_fast.pyx":15 - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): + /* "sklearn/metrics/pairwise_fast.pyx":19 + * cython.floating[:, :] result): * cdef int i, j, k * cdef int n_samples_X = X.shape[0] # <<<<<<<<<<<<<< * cdef int n_samples_Y = Y.shape[0] @@ -3984,7 +4054,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( */ __pyx_v_n_samples_X = (__pyx_v_X.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":16 + /* "sklearn/metrics/pairwise_fast.pyx":20 * cdef int i, j, k * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] # <<<<<<<<<<<<<< @@ -3993,7 +4063,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( */ __pyx_v_n_samples_Y = (__pyx_v_Y.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":17 + /* "sklearn/metrics/pairwise_fast.pyx":21 * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] * cdef int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -4002,7 +4072,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( */ __pyx_v_n_features = (__pyx_v_X.shape[1]); - /* "sklearn/metrics/pairwise_fast.pyx":19 + /* "sklearn/metrics/pairwise_fast.pyx":23 * cdef int n_features = X.shape[1] * cdef double res, nom, denom * for i in xrange(n_samples_X): # <<<<<<<<<<<<<< @@ -4013,7 +4083,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/metrics/pairwise_fast.pyx":20 + /* "sklearn/metrics/pairwise_fast.pyx":24 * cdef double res, nom, denom * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): # <<<<<<<<<<<<<< @@ -4024,7 +4094,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/metrics/pairwise_fast.pyx":21 + /* "sklearn/metrics/pairwise_fast.pyx":25 * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): * res = 0 # <<<<<<<<<<<<<< @@ -4033,7 +4103,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( */ __pyx_v_res = 0.0; - /* "sklearn/metrics/pairwise_fast.pyx":22 + /* "sklearn/metrics/pairwise_fast.pyx":26 * for j in xrange(n_samples_Y): * res = 0 * for k in xrange(n_features): # <<<<<<<<<<<<<< @@ -4044,7 +4114,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_k = __pyx_t_6; - /* "sklearn/metrics/pairwise_fast.pyx":23 + /* "sklearn/metrics/pairwise_fast.pyx":27 * res = 0 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) # <<<<<<<<<<<<<< @@ -4057,7 +4127,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( __pyx_t_10 = __pyx_v_k; __pyx_v_denom = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) ) + __pyx_t_8 * __pyx_v_X.strides[1]) ))) - (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) ) + __pyx_t_10 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":24 + /* "sklearn/metrics/pairwise_fast.pyx":28 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) # <<<<<<<<<<<<<< @@ -4070,7 +4140,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( __pyx_t_14 = __pyx_v_k; __pyx_v_nom = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_11 * __pyx_v_X.strides[0]) ) + __pyx_t_12 * __pyx_v_X.strides[1]) ))) + (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_13 * __pyx_v_Y.strides[0]) ) + __pyx_t_14 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":25 + /* "sklearn/metrics/pairwise_fast.pyx":29 * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) * if nom != 0: # <<<<<<<<<<<<<< @@ -4080,7 +4150,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( __pyx_t_15 = (__pyx_v_nom != 0.0); if (__pyx_t_15) { - /* "sklearn/metrics/pairwise_fast.pyx":26 + /* "sklearn/metrics/pairwise_fast.pyx":30 * nom = (X[i, k] + Y[j, k]) * if nom != 0: * res += denom * denom / nom # <<<<<<<<<<<<<< @@ -4092,7 +4162,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( __pyx_L9:; } - /* "sklearn/metrics/pairwise_fast.pyx":27 + /* "sklearn/metrics/pairwise_fast.pyx":31 * if nom != 0: * res += denom * denom / nom * result[i, j] = -res # <<<<<<<<<<<<<< @@ -4112,12 +4182,12 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_10_chi2_kernel_fast( return __pyx_r; } -/* "sklearn/metrics/pairwise_fast.pyx":13 +/* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ /* Python wrapper */ @@ -4151,16 +4221,16 @@ static PyObject *__pyx_fuse_1_0_1__pyx_pw_7sklearn_7metrics_13pairwise_fast_13_c case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -4169,13 +4239,13 @@ static PyObject *__pyx_fuse_1_0_1__pyx_pw_7sklearn_7metrics_13pairwise_fast_13_c values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.metrics.pairwise_fast._chi2_kernel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4215,8 +4285,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( int __pyx_t_15; __Pyx_RefNannySetupContext("__pyx_fuse_1_0_1_chi2_kernel_fast", 0); - /* "sklearn/metrics/pairwise_fast.pyx":15 - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): + /* "sklearn/metrics/pairwise_fast.pyx":19 + * cython.floating[:, :] result): * cdef int i, j, k * cdef int n_samples_X = X.shape[0] # <<<<<<<<<<<<<< * cdef int n_samples_Y = Y.shape[0] @@ -4224,7 +4294,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( */ __pyx_v_n_samples_X = (__pyx_v_X.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":16 + /* "sklearn/metrics/pairwise_fast.pyx":20 * cdef int i, j, k * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] # <<<<<<<<<<<<<< @@ -4233,7 +4303,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( */ __pyx_v_n_samples_Y = (__pyx_v_Y.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":17 + /* "sklearn/metrics/pairwise_fast.pyx":21 * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] * cdef int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -4242,7 +4312,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( */ __pyx_v_n_features = (__pyx_v_X.shape[1]); - /* "sklearn/metrics/pairwise_fast.pyx":19 + /* "sklearn/metrics/pairwise_fast.pyx":23 * cdef int n_features = X.shape[1] * cdef double res, nom, denom * for i in xrange(n_samples_X): # <<<<<<<<<<<<<< @@ -4253,7 +4323,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/metrics/pairwise_fast.pyx":20 + /* "sklearn/metrics/pairwise_fast.pyx":24 * cdef double res, nom, denom * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): # <<<<<<<<<<<<<< @@ -4264,7 +4334,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/metrics/pairwise_fast.pyx":21 + /* "sklearn/metrics/pairwise_fast.pyx":25 * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): * res = 0 # <<<<<<<<<<<<<< @@ -4273,7 +4343,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( */ __pyx_v_res = 0.0; - /* "sklearn/metrics/pairwise_fast.pyx":22 + /* "sklearn/metrics/pairwise_fast.pyx":26 * for j in xrange(n_samples_Y): * res = 0 * for k in xrange(n_features): # <<<<<<<<<<<<<< @@ -4284,7 +4354,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_k = __pyx_t_6; - /* "sklearn/metrics/pairwise_fast.pyx":23 + /* "sklearn/metrics/pairwise_fast.pyx":27 * res = 0 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) # <<<<<<<<<<<<<< @@ -4297,7 +4367,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( __pyx_t_10 = __pyx_v_k; __pyx_v_denom = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) ) + __pyx_t_8 * __pyx_v_X.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) ) + __pyx_t_10 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":24 + /* "sklearn/metrics/pairwise_fast.pyx":28 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) # <<<<<<<<<<<<<< @@ -4310,7 +4380,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( __pyx_t_14 = __pyx_v_k; __pyx_v_nom = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_11 * __pyx_v_X.strides[0]) ) + __pyx_t_12 * __pyx_v_X.strides[1]) ))) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_13 * __pyx_v_Y.strides[0]) ) + __pyx_t_14 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":25 + /* "sklearn/metrics/pairwise_fast.pyx":29 * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) * if nom != 0: # <<<<<<<<<<<<<< @@ -4320,7 +4390,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( __pyx_t_15 = (__pyx_v_nom != 0.0); if (__pyx_t_15) { - /* "sklearn/metrics/pairwise_fast.pyx":26 + /* "sklearn/metrics/pairwise_fast.pyx":30 * nom = (X[i, k] + Y[j, k]) * if nom != 0: * res += denom * denom / nom # <<<<<<<<<<<<<< @@ -4332,7 +4402,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( __pyx_L9:; } - /* "sklearn/metrics/pairwise_fast.pyx":27 + /* "sklearn/metrics/pairwise_fast.pyx":31 * if nom != 0: * res += denom * denom / nom * result[i, j] = -res # <<<<<<<<<<<<<< @@ -4352,12 +4422,12 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_12_chi2_kernel_fast( return __pyx_r; } -/* "sklearn/metrics/pairwise_fast.pyx":13 +/* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ /* Python wrapper */ @@ -4391,16 +4461,16 @@ static PyObject *__pyx_fuse_1_1_0__pyx_pw_7sklearn_7metrics_13pairwise_fast_15_c case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -4409,13 +4479,13 @@ static PyObject *__pyx_fuse_1_1_0__pyx_pw_7sklearn_7metrics_13pairwise_fast_15_c values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.metrics.pairwise_fast._chi2_kernel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4455,8 +4525,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( int __pyx_t_15; __Pyx_RefNannySetupContext("__pyx_fuse_1_1_0_chi2_kernel_fast", 0); - /* "sklearn/metrics/pairwise_fast.pyx":15 - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): + /* "sklearn/metrics/pairwise_fast.pyx":19 + * cython.floating[:, :] result): * cdef int i, j, k * cdef int n_samples_X = X.shape[0] # <<<<<<<<<<<<<< * cdef int n_samples_Y = Y.shape[0] @@ -4464,7 +4534,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( */ __pyx_v_n_samples_X = (__pyx_v_X.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":16 + /* "sklearn/metrics/pairwise_fast.pyx":20 * cdef int i, j, k * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] # <<<<<<<<<<<<<< @@ -4473,7 +4543,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( */ __pyx_v_n_samples_Y = (__pyx_v_Y.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":17 + /* "sklearn/metrics/pairwise_fast.pyx":21 * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] * cdef int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -4482,7 +4552,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( */ __pyx_v_n_features = (__pyx_v_X.shape[1]); - /* "sklearn/metrics/pairwise_fast.pyx":19 + /* "sklearn/metrics/pairwise_fast.pyx":23 * cdef int n_features = X.shape[1] * cdef double res, nom, denom * for i in xrange(n_samples_X): # <<<<<<<<<<<<<< @@ -4493,7 +4563,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/metrics/pairwise_fast.pyx":20 + /* "sklearn/metrics/pairwise_fast.pyx":24 * cdef double res, nom, denom * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): # <<<<<<<<<<<<<< @@ -4504,7 +4574,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/metrics/pairwise_fast.pyx":21 + /* "sklearn/metrics/pairwise_fast.pyx":25 * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): * res = 0 # <<<<<<<<<<<<<< @@ -4513,7 +4583,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( */ __pyx_v_res = 0.0; - /* "sklearn/metrics/pairwise_fast.pyx":22 + /* "sklearn/metrics/pairwise_fast.pyx":26 * for j in xrange(n_samples_Y): * res = 0 * for k in xrange(n_features): # <<<<<<<<<<<<<< @@ -4524,7 +4594,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_k = __pyx_t_6; - /* "sklearn/metrics/pairwise_fast.pyx":23 + /* "sklearn/metrics/pairwise_fast.pyx":27 * res = 0 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) # <<<<<<<<<<<<<< @@ -4537,7 +4607,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( __pyx_t_10 = __pyx_v_k; __pyx_v_denom = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) ) + __pyx_t_8 * __pyx_v_X.strides[1]) ))) - (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) ) + __pyx_t_10 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":24 + /* "sklearn/metrics/pairwise_fast.pyx":28 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) # <<<<<<<<<<<<<< @@ -4550,7 +4620,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( __pyx_t_14 = __pyx_v_k; __pyx_v_nom = ((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_11 * __pyx_v_X.strides[0]) ) + __pyx_t_12 * __pyx_v_X.strides[1]) ))) + (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_13 * __pyx_v_Y.strides[0]) ) + __pyx_t_14 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":25 + /* "sklearn/metrics/pairwise_fast.pyx":29 * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) * if nom != 0: # <<<<<<<<<<<<<< @@ -4560,7 +4630,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( __pyx_t_15 = (__pyx_v_nom != 0.0); if (__pyx_t_15) { - /* "sklearn/metrics/pairwise_fast.pyx":26 + /* "sklearn/metrics/pairwise_fast.pyx":30 * nom = (X[i, k] + Y[j, k]) * if nom != 0: * res += denom * denom / nom # <<<<<<<<<<<<<< @@ -4572,7 +4642,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( __pyx_L9:; } - /* "sklearn/metrics/pairwise_fast.pyx":27 + /* "sklearn/metrics/pairwise_fast.pyx":31 * if nom != 0: * res += denom * denom / nom * result[i, j] = -res # <<<<<<<<<<<<<< @@ -4592,12 +4662,12 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_14_chi2_kernel_fast( return __pyx_r; } -/* "sklearn/metrics/pairwise_fast.pyx":13 +/* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ /* Python wrapper */ @@ -4631,16 +4701,16 @@ static PyObject *__pyx_fuse_1_1_1__pyx_pw_7sklearn_7metrics_13pairwise_fast_17_c case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__result)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_chi2_kernel_fast") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -4649,13 +4719,13 @@ static PyObject *__pyx_fuse_1_1_1__pyx_pw_7sklearn_7metrics_13pairwise_fast_17_c values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_X = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0]); if (unlikely(!__pyx_v_X.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1]); if (unlikely(!__pyx_v_Y.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_result = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2]); if (unlikely(!__pyx_v_result.memview)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_chi2_kernel_fast", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.metrics.pairwise_fast._chi2_kernel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4695,8 +4765,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( int __pyx_t_15; __Pyx_RefNannySetupContext("__pyx_fuse_1_1_1_chi2_kernel_fast", 0); - /* "sklearn/metrics/pairwise_fast.pyx":15 - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): + /* "sklearn/metrics/pairwise_fast.pyx":19 + * cython.floating[:, :] result): * cdef int i, j, k * cdef int n_samples_X = X.shape[0] # <<<<<<<<<<<<<< * cdef int n_samples_Y = Y.shape[0] @@ -4704,7 +4774,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( */ __pyx_v_n_samples_X = (__pyx_v_X.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":16 + /* "sklearn/metrics/pairwise_fast.pyx":20 * cdef int i, j, k * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] # <<<<<<<<<<<<<< @@ -4713,7 +4783,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( */ __pyx_v_n_samples_Y = (__pyx_v_Y.shape[0]); - /* "sklearn/metrics/pairwise_fast.pyx":17 + /* "sklearn/metrics/pairwise_fast.pyx":21 * cdef int n_samples_X = X.shape[0] * cdef int n_samples_Y = Y.shape[0] * cdef int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -4722,7 +4792,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( */ __pyx_v_n_features = (__pyx_v_X.shape[1]); - /* "sklearn/metrics/pairwise_fast.pyx":19 + /* "sklearn/metrics/pairwise_fast.pyx":23 * cdef int n_features = X.shape[1] * cdef double res, nom, denom * for i in xrange(n_samples_X): # <<<<<<<<<<<<<< @@ -4733,7 +4803,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/metrics/pairwise_fast.pyx":20 + /* "sklearn/metrics/pairwise_fast.pyx":24 * cdef double res, nom, denom * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): # <<<<<<<<<<<<<< @@ -4744,7 +4814,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "sklearn/metrics/pairwise_fast.pyx":21 + /* "sklearn/metrics/pairwise_fast.pyx":25 * for i in xrange(n_samples_X): * for j in xrange(n_samples_Y): * res = 0 # <<<<<<<<<<<<<< @@ -4753,7 +4823,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( */ __pyx_v_res = 0.0; - /* "sklearn/metrics/pairwise_fast.pyx":22 + /* "sklearn/metrics/pairwise_fast.pyx":26 * for j in xrange(n_samples_Y): * res = 0 * for k in xrange(n_features): # <<<<<<<<<<<<<< @@ -4764,7 +4834,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_k = __pyx_t_6; - /* "sklearn/metrics/pairwise_fast.pyx":23 + /* "sklearn/metrics/pairwise_fast.pyx":27 * res = 0 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) # <<<<<<<<<<<<<< @@ -4777,7 +4847,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( __pyx_t_10 = __pyx_v_k; __pyx_v_denom = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_7 * __pyx_v_X.strides[0]) ) + __pyx_t_8 * __pyx_v_X.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_9 * __pyx_v_Y.strides[0]) ) + __pyx_t_10 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":24 + /* "sklearn/metrics/pairwise_fast.pyx":28 * for k in xrange(n_features): * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) # <<<<<<<<<<<<<< @@ -4790,7 +4860,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( __pyx_t_14 = __pyx_v_k; __pyx_v_nom = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_X.data + __pyx_t_11 * __pyx_v_X.strides[0]) ) + __pyx_t_12 * __pyx_v_X.strides[1]) ))) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Y.data + __pyx_t_13 * __pyx_v_Y.strides[0]) ) + __pyx_t_14 * __pyx_v_Y.strides[1]) )))); - /* "sklearn/metrics/pairwise_fast.pyx":25 + /* "sklearn/metrics/pairwise_fast.pyx":29 * denom = (X[i, k] - Y[j, k]) * nom = (X[i, k] + Y[j, k]) * if nom != 0: # <<<<<<<<<<<<<< @@ -4800,7 +4870,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( __pyx_t_15 = (__pyx_v_nom != 0.0); if (__pyx_t_15) { - /* "sklearn/metrics/pairwise_fast.pyx":26 + /* "sklearn/metrics/pairwise_fast.pyx":30 * nom = (X[i, k] + Y[j, k]) * if nom != 0: * res += denom * denom / nom # <<<<<<<<<<<<<< @@ -4812,7 +4882,7 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( __pyx_L9:; } - /* "sklearn/metrics/pairwise_fast.pyx":27 + /* "sklearn/metrics/pairwise_fast.pyx":31 * if nom != 0: * res += denom * denom / nom * result[i, j] = -res # <<<<<<<<<<<<<< @@ -4833,8 +4903,8 @@ static PyObject *__pyx_pf_7sklearn_7metrics_13pairwise_fast_16_chi2_kernel_fast( } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -5178,8 +5248,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset @@ -5254,7 +5326,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: @@ -5649,8 +5722,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -7549,8 +7622,8 @@ static int __pyx_array_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx } /* Python wrapper */ -static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -7573,7 +7646,10 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; + char *__pyx_t_3; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + Py_ssize_t *__pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7668,7 +7744,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * info.len = self.len * info.ndim = self.ndim */ - __pyx_v_info->buf = __pyx_v_self->data; + __pyx_t_3 = __pyx_v_self->data; + __pyx_v_info->buf = __pyx_t_3; /* "View.MemoryView":192 * raise ValueError("Can only create a buffer that is contiguous in memory.") @@ -7677,7 +7754,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * info.ndim = self.ndim * info.shape = self._shape */ - __pyx_v_info->len = __pyx_v_self->len; + __pyx_t_4 = __pyx_v_self->len; + __pyx_v_info->len = __pyx_t_4; /* "View.MemoryView":193 * info.buf = self.data @@ -7686,7 +7764,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * info.shape = self._shape * info.strides = self._strides */ - __pyx_v_info->ndim = __pyx_v_self->ndim; + __pyx_t_5 = __pyx_v_self->ndim; + __pyx_v_info->ndim = __pyx_t_5; /* "View.MemoryView":194 * info.len = self.len @@ -7695,7 +7774,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * info.strides = self._strides * info.suboffsets = NULL */ - __pyx_v_info->shape = __pyx_v_self->_shape; + __pyx_t_6 = __pyx_v_self->_shape; + __pyx_v_info->shape = __pyx_t_6; /* "View.MemoryView":195 * info.ndim = self.ndim @@ -7704,7 +7784,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * info.suboffsets = NULL * info.itemsize = self.itemsize */ - __pyx_v_info->strides = __pyx_v_self->_strides; + __pyx_t_6 = __pyx_v_self->_strides; + __pyx_v_info->strides = __pyx_t_6; /* "View.MemoryView":196 * info.shape = self._shape @@ -7722,7 +7803,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * info.readonly = 0 * */ - __pyx_v_info->itemsize = __pyx_v_self->itemsize; + __pyx_t_4 = __pyx_v_self->itemsize; + __pyx_v_info->itemsize = __pyx_t_4; /* "View.MemoryView":198 * info.suboffsets = NULL @@ -7740,8 +7822,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * info.format = self.format * else: */ - __pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT); - if (__pyx_t_3) { + __pyx_t_5 = (__pyx_v_flags & PyBUF_FORMAT); + if (__pyx_t_5) { /* "View.MemoryView":201 * @@ -7750,7 +7832,8 @@ static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_a * else: * info.format = NULL */ - __pyx_v_info->format = __pyx_v_self->format; + __pyx_t_3 = __pyx_v_self->format; + __pyx_v_info->format = __pyx_t_3; goto __pyx_L5; } /*else*/ { @@ -10348,8 +10431,8 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie } /* Python wrapper */ -static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -10370,6 +10453,10 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + char *__pyx_t_3; + void *__pyx_t_4; + Py_ssize_t __pyx_t_5; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); @@ -10393,7 +10480,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str * else: * info.shape = NULL */ - __pyx_v_info->shape = __pyx_v_self->view.shape; + __pyx_t_2 = __pyx_v_self->view.shape; + __pyx_v_info->shape = __pyx_t_2; goto __pyx_L3; } /*else*/ { @@ -10426,7 +10514,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str * else: * info.strides = NULL */ - __pyx_v_info->strides = __pyx_v_self->view.strides; + __pyx_t_2 = __pyx_v_self->view.strides; + __pyx_v_info->strides = __pyx_t_2; goto __pyx_L4; } /*else*/ { @@ -10459,7 +10548,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str * else: * info.suboffsets = NULL */ - __pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets; + __pyx_t_2 = __pyx_v_self->view.suboffsets; + __pyx_v_info->suboffsets = __pyx_t_2; goto __pyx_L5; } /*else*/ { @@ -10492,7 +10582,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str * else: * info.format = NULL */ - __pyx_v_info->format = __pyx_v_self->view.format; + __pyx_t_3 = __pyx_v_self->view.format; + __pyx_v_info->format = __pyx_t_3; goto __pyx_L6; } /*else*/ { @@ -10515,7 +10606,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize */ - __pyx_v_info->buf = __pyx_v_self->view.buf; + __pyx_t_4 = __pyx_v_self->view.buf; + __pyx_v_info->buf = __pyx_t_4; /* "View.MemoryView":497 * @@ -10524,7 +10616,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str * info.itemsize = self.view.itemsize * info.len = self.view.len */ - __pyx_v_info->ndim = __pyx_v_self->view.ndim; + __pyx_t_1 = __pyx_v_self->view.ndim; + __pyx_v_info->ndim = __pyx_t_1; /* "View.MemoryView":498 * info.buf = self.view.buf @@ -10533,7 +10626,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str * info.len = self.view.len * info.readonly = 0 */ - __pyx_v_info->itemsize = __pyx_v_self->view.itemsize; + __pyx_t_5 = __pyx_v_self->view.itemsize; + __pyx_v_info->itemsize = __pyx_t_5; /* "View.MemoryView":499 * info.ndim = self.view.ndim @@ -10542,7 +10636,8 @@ static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(str * info.readonly = 0 * info.obj = self */ - __pyx_v_info->len = __pyx_v_self->view.len; + __pyx_t_5 = __pyx_v_self->view.len; + __pyx_v_info->len = __pyx_t_5; /* "View.MemoryView":500 * info.itemsize = self.view.itemsize @@ -12219,7 +12314,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_2 = (!__pyx_t_3); if (__pyx_t_2) { - __pyx_t_3 = (!PyIndex_Check(__pyx_v_item)); + __pyx_t_3 = (!__Pyx_PyIndex_Check(__pyx_v_item)); __pyx_t_12 = __pyx_t_3; } else { __pyx_t_12 = __pyx_t_2; @@ -12499,13 +12594,15 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_t_3; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *__pyx_t_9 = NULL; + struct __pyx_memoryview_obj *__pyx_t_3; + char *__pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *(*__pyx_t_7)(PyObject *); + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + Py_ssize_t __pyx_t_10; + PyObject *__pyx_t_11 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -12607,7 +12704,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * dst.data = p_src.data * */ - __pyx_v_dst.memview = __pyx_v_p_src->memview; + __pyx_t_3 = __pyx_v_p_src->memview; + __pyx_v_dst.memview = __pyx_t_3; /* "View.MemoryView":698 * @@ -12616,7 +12714,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * * */ - __pyx_v_dst.data = __pyx_v_p_src->data; + __pyx_t_4 = __pyx_v_p_src->data; + __pyx_v_dst.data = __pyx_t_4; /* "View.MemoryView":703 * @@ -12643,46 +12742,46 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * if PyIndex_Check(index): * slice_memviewslice( */ - __pyx_t_3 = 0; + __pyx_t_5 = 0; if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) { - __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0; - __pyx_t_5 = NULL; + __pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; + __pyx_t_7 = NULL; } else { - __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; } for (;;) { - if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (!__pyx_t_7 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + } else if (!__pyx_t_7 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { - __pyx_t_6 = __pyx_t_5(__pyx_t_1); - if (unlikely(!__pyx_t_6)) { + __pyx_t_8 = __pyx_t_7(__pyx_t_1); + if (unlikely(!__pyx_t_8)) { 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;} } break; } - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_8); } __Pyx_XDECREF(__pyx_v_index); - __pyx_v_index = __pyx_t_6; - __pyx_t_6 = 0; - __pyx_v_dim = __pyx_t_3; - __pyx_t_3 = (__pyx_t_3 + 1); + __pyx_v_index = __pyx_t_8; + __pyx_t_8 = 0; + __pyx_v_dim = __pyx_t_5; + __pyx_t_5 = (__pyx_t_5 + 1); /* "View.MemoryView":709 * @@ -12691,8 +12790,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * slice_memviewslice( * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], */ - __pyx_t_7 = PyIndex_Check(__pyx_v_index); - if (__pyx_t_7) { + __pyx_t_9 = __Pyx_PyIndex_Check(__pyx_v_index); + if (__pyx_t_9) { /* "View.MemoryView":713 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], @@ -12701,7 +12800,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * 0, 0, 0, # have_{start,stop,step} * False) */ - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (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 = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "View.MemoryView":715 * index, 0, 0, # start, stop, step @@ -12710,7 +12809,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * elif index is None: * p_dst.shape[new_ndim] = 1 */ - __pyx_t_7 = __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_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __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_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } @@ -12770,20 +12869,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * stop = index.stop or 0 * step = index.step or 0 */ - __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_2) { - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_INCREF(__pyx_int_0); - __pyx_t_9 = __pyx_int_0; + __pyx_t_11 = __pyx_int_0; } else { - __pyx_t_9 = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_11 = __pyx_t_8; + __pyx_t_8 = 0; } - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_start = __pyx_t_8; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); 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_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_start = __pyx_t_10; /* "View.MemoryView":723 * else: @@ -12792,20 +12891,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * step = index.step or 0 * */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_2) { - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_INCREF(__pyx_int_0); - __pyx_t_6 = __pyx_int_0; + __pyx_t_8 = __pyx_int_0; } else { - __pyx_t_6 = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_t_8 = __pyx_t_11; + __pyx_t_11 = 0; } - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_stop = __pyx_t_8; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); 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_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_stop = __pyx_t_10; /* "View.MemoryView":724 * start = index.start or 0 @@ -12814,20 +12913,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * * have_start = index.start is not None */ - __pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_2) { - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_INCREF(__pyx_int_0); - __pyx_t_9 = __pyx_int_0; + __pyx_t_11 = __pyx_int_0; } else { - __pyx_t_9 = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_11 = __pyx_t_8; + __pyx_t_8 = 0; } - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_step = __pyx_t_8; + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_t_11); 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_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_v_step = __pyx_t_10; /* "View.MemoryView":726 * step = index.step or 0 @@ -12836,10 +12935,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * have_stop = index.stop is not None * have_step = index.step is not None */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_11 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = (__pyx_t_11 != Py_None); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_v_have_start = __pyx_t_2; /* "View.MemoryView":727 @@ -12849,10 +12948,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * have_step = index.step is not None * */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); 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_2 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_11 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = (__pyx_t_11 != Py_None); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_v_have_stop = __pyx_t_2; /* "View.MemoryView":728 @@ -12862,10 +12961,10 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * * slice_memviewslice( */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = (__pyx_t_9 != Py_None); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_11 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_2 = (__pyx_t_11 != Py_None); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_v_have_step = __pyx_t_2; /* "View.MemoryView":735 @@ -12875,7 +12974,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * new_ndim += 1 * */ - __pyx_t_7 = __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_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __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_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "View.MemoryView":736 * have_start, have_stop, have_step, @@ -12967,8 +13066,8 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -13600,9 +13699,10 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P char *__pyx_v_resultp; char *__pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -13624,7 +13724,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P * cdef char *resultp * */ - __pyx_v_itemsize = __pyx_v_view->itemsize; + __pyx_t_1 = __pyx_v_view->itemsize; + __pyx_v_itemsize = __pyx_t_1; /* "View.MemoryView":878 * cdef char *resultp @@ -13633,8 +13734,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P * shape = view.len / itemsize * stride = itemsize */ - __pyx_t_1 = (__pyx_v_view->ndim == 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_view->ndim == 0); + if (__pyx_t_2) { /* "View.MemoryView":879 * @@ -13690,8 +13791,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P * suboffset = view.suboffsets[dim] * */ - __pyx_t_1 = (__pyx_v_view->suboffsets != NULL); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_view->suboffsets != NULL); + if (__pyx_t_2) { /* "View.MemoryView":885 * stride = view.strides[dim] @@ -13714,8 +13815,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P * index += view.shape[dim] * if index < 0: */ - __pyx_t_1 = (__pyx_v_index < 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { /* "View.MemoryView":888 * @@ -13733,8 +13834,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * */ - __pyx_t_1 = (__pyx_v_index < 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_index < 0); + if (__pyx_t_2) { /* "View.MemoryView":890 * index += view.shape[dim] @@ -13743,21 +13844,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P * * if index >= shape: */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), __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_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_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__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_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__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; } @@ -13773,8 +13874,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * */ - __pyx_t_1 = (__pyx_v_index >= __pyx_v_shape); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape); + if (__pyx_t_2) { /* "View.MemoryView":893 * @@ -13783,21 +13884,21 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P * * resultp = bufp + index * stride */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_dim); 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_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), __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_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_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__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_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_54), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__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_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_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__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 = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } @@ -13819,8 +13920,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P * resultp = ( resultp)[0] + suboffset * */ - __pyx_t_1 = (__pyx_v_suboffset >= 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_suboffset >= 0); + if (__pyx_t_2) { /* "View.MemoryView":897 * resultp = bufp + index * stride @@ -13847,8 +13948,8 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -13871,14 +13972,15 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { int __pyx_v_i; int __pyx_v_j; int __pyx_r; - long __pyx_t_1; - int __pyx_t_2; - Py_ssize_t __pyx_t_3; + int __pyx_t_1; + Py_ssize_t *__pyx_t_2; + long __pyx_t_3; Py_ssize_t __pyx_t_4; - int __pyx_t_5; + Py_ssize_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; + int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -13890,7 +13992,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { * * cdef Py_ssize_t *shape = memslice.shape */ - __pyx_v_ndim = __pyx_v_memslice->memview->view.ndim; + __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; + __pyx_v_ndim = __pyx_t_1; /* "View.MemoryView":908 * cdef int ndim = memslice.memview.view.ndim @@ -13899,7 +14002,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { * cdef Py_ssize_t *strides = memslice.strides * */ - __pyx_v_shape = __pyx_v_memslice->shape; + __pyx_t_2 = __pyx_v_memslice->shape; + __pyx_v_shape = __pyx_t_2; /* "View.MemoryView":909 * @@ -13908,7 +14012,8 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { * * */ - __pyx_v_strides = __pyx_v_memslice->strides; + __pyx_t_2 = __pyx_v_memslice->strides; + __pyx_v_strides = __pyx_t_2; /* "View.MemoryView":913 * @@ -13917,9 +14022,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] */ - __pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2); - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; + __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2); + for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) { + __pyx_v_i = __pyx_t_1; /* "View.MemoryView":914 * cdef int i, j @@ -13937,10 +14042,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { * shape[i], shape[j] = shape[j], shape[i] * */ - __pyx_t_3 = (__pyx_v_strides[__pyx_v_j]); - __pyx_t_4 = (__pyx_v_strides[__pyx_v_i]); - (__pyx_v_strides[__pyx_v_i]) = __pyx_t_3; - (__pyx_v_strides[__pyx_v_j]) = __pyx_t_4; + __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]); + __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]); + (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4; + (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5; /* "View.MemoryView":916 * j = ndim - 1 - i @@ -13949,10 +14054,10 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: */ - __pyx_t_4 = (__pyx_v_shape[__pyx_v_j]); - __pyx_t_3 = (__pyx_v_shape[__pyx_v_i]); - (__pyx_v_shape[__pyx_v_i]) = __pyx_t_4; - (__pyx_v_shape[__pyx_v_j]) = __pyx_t_3; + __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]); + __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]); + (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5; + (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4; /* "View.MemoryView":918 * shape[i], shape[j] = shape[j], shape[i] @@ -13961,14 +14066,14 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * */ - __pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); - if (!__pyx_t_5) { - __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); - __pyx_t_7 = __pyx_t_6; + __pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0); + if (!__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0); + __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_7 = __pyx_t_5; + __pyx_t_8 = __pyx_t_6; } - if (__pyx_t_7) { + if (__pyx_t_8) { /* "View.MemoryView":919 * @@ -13977,7 +14082,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { * * return 1 */ - __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_55); if (unlikely(__pyx_t_8 == -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_55); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; @@ -14241,8 +14346,11 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + __Pyx_TypeInfo *__pyx_t_4; + Py_buffer __pyx_t_5; + Py_ssize_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -14339,7 +14447,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl * * result.view = memviewslice.memview.view */ - __pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo; + __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; + __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; /* "View.MemoryView":985 * result.typeinfo = memviewslice.memview.typeinfo @@ -14348,7 +14457,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl * result.view.buf = memviewslice.data * result.view.ndim = ndim */ - __pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view; + __pyx_t_5 = __pyx_v_memviewslice.memview->view; + __pyx_v_result->__pyx_base.view = __pyx_t_5; /* "View.MemoryView":986 * @@ -14429,7 +14539,8 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl * for i in range(ndim): * result.view.len *= result.view.shape[i] */ - __pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_t_6 = __pyx_v_result->__pyx_base.view.itemsize; + __pyx_v_result->__pyx_base.view.len = __pyx_t_6; /* "View.MemoryView":998 * @@ -14438,9 +14549,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl * result.view.len *= result.view.shape[i] * */ - __pyx_t_4 = __pyx_v_ndim; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; + __pyx_t_7 = __pyx_v_ndim; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; /* "View.MemoryView":999 * result.view.len = result.view.itemsize @@ -14599,9 +14710,10 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem Py_ssize_t *__pyx_v_strides; Py_ssize_t *__pyx_v_suboffsets; __Pyx_RefNannyDeclarations - int __pyx_t_1; + Py_ssize_t *__pyx_t_1; int __pyx_t_2; int __pyx_t_3; + int __pyx_t_4; __Pyx_RefNannySetupContext("slice_copy", 0); /* "View.MemoryView":1022 @@ -14611,7 +14723,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem * strides = memview.view.strides * suboffsets = memview.view.suboffsets */ - __pyx_v_shape = __pyx_v_memview->view.shape; + __pyx_t_1 = __pyx_v_memview->view.shape; + __pyx_v_shape = __pyx_t_1; /* "View.MemoryView":1023 * @@ -14620,7 +14733,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem * suboffsets = memview.view.suboffsets * */ - __pyx_v_strides = __pyx_v_memview->view.strides; + __pyx_t_1 = __pyx_v_memview->view.strides; + __pyx_v_strides = __pyx_t_1; /* "View.MemoryView":1024 * shape = memview.view.shape @@ -14629,7 +14743,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem * * dst.memview = <__pyx_memoryview *> memview */ - __pyx_v_suboffsets = __pyx_v_memview->view.suboffsets; + __pyx_t_1 = __pyx_v_memview->view.suboffsets; + __pyx_v_suboffsets = __pyx_t_1; /* "View.MemoryView":1026 * suboffsets = memview.view.suboffsets @@ -14656,9 +14771,9 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] */ - __pyx_t_1 = __pyx_v_memview->view.ndim; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_dim = __pyx_t_2; + __pyx_t_2 = __pyx_v_memview->view.ndim; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_dim = __pyx_t_3; /* "View.MemoryView":1030 * @@ -14685,8 +14800,8 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem * dst.suboffsets[dim] = -1 * else: */ - __pyx_t_3 = (__pyx_v_suboffsets == NULL); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_suboffsets == NULL); + if (__pyx_t_4) { /* "View.MemoryView":1033 * dst.strides[dim] = strides[dim] @@ -14783,6 +14898,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; + PyObject *(*__pyx_t_3)(char *); + int (*__pyx_t_4)(char *, PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -14808,7 +14925,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func * else: */ - __pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; + __pyx_v_to_object_func = __pyx_t_3; /* "View.MemoryView":1054 * if isinstance(memview, _memoryviewslice): @@ -14817,7 +14935,8 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview * else: * to_object_func = NULL */ - __pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; + __pyx_v_to_dtype_func = __pyx_t_4; goto __pyx_L3; } /*else*/ { @@ -15322,8 +15441,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr int __pyx_v_i; Py_ssize_t __pyx_v_size; Py_ssize_t __pyx_r; - int __pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; + int __pyx_t_3; /* "View.MemoryView":1138 * "Return the size of the memory occupied by the slice in number of bytes" @@ -15332,7 +15452,8 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr * * for i in range(ndim): */ - __pyx_v_size = __pyx_v_src->memview->view.itemsize; + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_size = __pyx_t_1; /* "View.MemoryView":1140 * cdef Py_ssize_t size = src.memview.view.itemsize @@ -15341,9 +15462,9 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr * size *= src.shape[i] * */ - __pyx_t_1 = __pyx_v_ndim; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; + __pyx_t_2 = __pyx_v_ndim; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; /* "View.MemoryView":1141 * @@ -15488,9 +15609,11 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, size_t __pyx_v_itemsize; size_t __pyx_v_size; void *__pyx_r; - int __pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; + struct __pyx_memoryview_obj *__pyx_t_4; + int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -15502,7 +15625,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, * cdef size_t size = slice_get_size(src, ndim) * */ - __pyx_v_itemsize = __pyx_v_src->memview->view.itemsize; + __pyx_t_1 = __pyx_v_src->memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; /* "View.MemoryView":1179 * @@ -15529,8 +15653,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, * _err(MemoryError, NULL) * */ - __pyx_t_1 = (!(__pyx_v_result != 0)); - if (__pyx_t_1) { + __pyx_t_2 = (!(__pyx_v_result != 0)); + if (__pyx_t_2) { /* "View.MemoryView":1183 * result = malloc(size) @@ -15539,7 +15663,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, * * */ - __pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -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 = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; @@ -15560,7 +15684,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] */ - __pyx_v_tmpslice->memview = __pyx_v_src->memview; + __pyx_t_4 = __pyx_v_src->memview; + __pyx_v_tmpslice->memview = __pyx_t_4; /* "View.MemoryView":1188 * tmpslice.data = result @@ -15569,9 +15694,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, * tmpslice.shape[i] = src.shape[i] * tmpslice.suboffsets[i] = -1 */ - __pyx_t_2 = __pyx_v_ndim; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_3 = __pyx_v_ndim; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; /* "View.MemoryView":1189 * tmpslice.memview = src.memview @@ -15608,9 +15733,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, * if tmpslice.shape[i] == 1: * tmpslice.strides[i] = 0 */ - __pyx_t_2 = __pyx_v_ndim; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_3 = __pyx_v_ndim; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; /* "View.MemoryView":1197 * @@ -15619,8 +15744,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, * tmpslice.strides[i] = 0 * */ - __pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { /* "View.MemoryView":1198 * for i in range(ndim): @@ -15642,8 +15767,8 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, * memcpy(result, src.data, size) * else: */ - __pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim); - if (__pyx_t_1) { + __pyx_t_2 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim); + if (__pyx_t_2) { /* "View.MemoryView":1201 * @@ -15944,11 +16069,12 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __Pyx_memviewslice __pyx_v_tmp; int __pyx_v_ndim; int __pyx_r; - int __pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - void *__pyx_t_5; + int __pyx_t_5; + void *__pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -15969,7 +16095,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * cdef int i * cdef char order = get_best_order(&src, src_ndim) */ - __pyx_v_itemsize = __pyx_v_src.memview->view.itemsize; + __pyx_t_1 = __pyx_v_src.memview->view.itemsize; + __pyx_v_itemsize = __pyx_t_1; /* "View.MemoryView":1238 * cdef size_t itemsize = src.memview.view.itemsize @@ -16005,8 +16132,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: */ - __pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_src_ndim < __pyx_v_dst_ndim); + if (__pyx_t_2) { /* "View.MemoryView":1244 * @@ -16026,8 +16153,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * broadcast_leading(&dst, dst_ndim, src_ndim) * */ - __pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dst_ndim < __pyx_v_src_ndim); + if (__pyx_t_2) { /* "View.MemoryView":1246 * broadcast_leading(&src, src_ndim, dst_ndim) @@ -16048,14 +16175,14 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * * for i in range(ndim): */ - __pyx_t_2 = __pyx_v_dst_ndim; - __pyx_t_3 = __pyx_v_src_ndim; - if ((__pyx_t_2 > __pyx_t_3)) { - __pyx_t_4 = __pyx_t_2; + __pyx_t_3 = __pyx_v_dst_ndim; + __pyx_t_4 = __pyx_v_src_ndim; + if ((__pyx_t_3 > __pyx_t_4)) { + __pyx_t_5 = __pyx_t_3; } else { - __pyx_t_4 = __pyx_t_3; + __pyx_t_5 = __pyx_t_4; } - __pyx_v_ndim = __pyx_t_4; + __pyx_v_ndim = __pyx_t_5; /* "View.MemoryView":1250 * cdef int ndim = max(src_ndim, dst_ndim) @@ -16064,9 +16191,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: */ - __pyx_t_4 = __pyx_v_ndim; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; /* "View.MemoryView":1251 * @@ -16075,8 +16202,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * if src.shape[i] == 1: * broadcasting = True */ - __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])); + if (__pyx_t_2) { /* "View.MemoryView":1252 * for i in range(ndim): @@ -16085,8 +16212,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * broadcasting = True * src.strides[i] = 0 */ - __pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_src.shape[__pyx_v_i]) == 1); + if (__pyx_t_2) { /* "View.MemoryView":1253 * if src.shape[i] != dst.shape[i]: @@ -16116,7 +16243,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * * if src.suboffsets[i] >= 0: */ - __pyx_t_3 = __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_3 == -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 = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L7:; goto __pyx_L6; @@ -16130,8 +16257,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * _err_dim(ValueError, "Dimension %d is not direct", i) * */ - __pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0); + if (__pyx_t_2) { /* "View.MemoryView":1259 * @@ -16140,7 +16267,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_57, __pyx_v_i); if (unlikely(__pyx_t_3 == -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_57, __pyx_v_i); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; @@ -16153,8 +16280,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * * if not slice_is_contig(&src, order, ndim): */ - __pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - if (__pyx_t_1) { + __pyx_t_2 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); + if (__pyx_t_2) { /* "View.MemoryView":1263 * if slices_overlap(&src, &dst, ndim, itemsize): @@ -16163,8 +16290,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * order = get_best_order(&dst, ndim) * */ - __pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim)); - if (__pyx_t_1) { + __pyx_t_2 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim)); + if (__pyx_t_2) { /* "View.MemoryView":1264 * @@ -16185,8 +16312,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * src = tmp * */ - __pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_tmpdata = __pyx_t_5; + __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_v_tmpdata = __pyx_t_6; /* "View.MemoryView":1267 * @@ -16207,8 +16334,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * * */ - __pyx_t_1 = (!__pyx_v_broadcasting); - if (__pyx_t_1) { + __pyx_t_2 = (!__pyx_v_broadcasting); + if (__pyx_t_2) { /* "View.MemoryView":1272 * @@ -16217,8 +16344,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * direct_copy = slice_is_contig(&dst, 'C', ndim) * elif slice_is_contig(&src, 'F', ndim): */ - __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim); - if (__pyx_t_1) { + __pyx_t_2 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim); + if (__pyx_t_2) { /* "View.MemoryView":1273 * @@ -16238,8 +16365,8 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * direct_copy = slice_is_contig(&dst, 'F', ndim) * */ - __pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim); - if (__pyx_t_1) { + __pyx_t_2 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim); + if (__pyx_t_2) { /* "View.MemoryView":1275 * direct_copy = slice_is_contig(&dst, 'C', ndim) @@ -16312,11 +16439,11 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * * */ - __pyx_t_1 = (__pyx_v_order == 'F'); - if (__pyx_t_1) { - __pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); + __pyx_t_2 = (__pyx_v_order == 'F'); + if (__pyx_t_2) { + __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim)); } - if (__pyx_t_1) { + if (__pyx_t_2) { /* "View.MemoryView":1287 * @@ -16325,7 +16452,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * transpose_memslice(&dst) * */ - __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 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 = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "View.MemoryView":1288 * @@ -16334,7 +16461,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * * refcount_copying(&dst, dtype_is_object, ndim, False) */ - __pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 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 = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; @@ -16828,6 +16955,7 @@ 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); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); @@ -16839,6 +16967,7 @@ static void __pyx_tp_dealloc_array(PyObject *o) { } Py_CLEAR(p->mode); Py_CLEAR(p->_format); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -17072,7 +17201,9 @@ 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; + PyObject_GC_UnTrack(o); Py_CLEAR(p->name); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -17271,6 +17402,7 @@ 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; + PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); @@ -17283,6 +17415,7 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { Py_CLEAR(p->obj); Py_CLEAR(p->_size); Py_CLEAR(p->_array_interface); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -17563,6 +17696,7 @@ 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; + PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); @@ -17573,6 +17707,7 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->from_object); + PyObject_GC_Track(o); __pyx_tp_dealloc_memoryview(o); } @@ -17922,14 +18057,14 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ImportError = __Pyx_GetName(__pyx_b, __pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_zip = __Pyx_GetName(__pyx_b, __pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ImportError = __Pyx_GetName(__pyx_b, __pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ord = __Pyx_GetName(__pyx_b, __pyx_n_s__ord); if (!__pyx_builtin_ord) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_zip = __Pyx_GetName(__pyx_b, __pyx_n_s__zip); if (!__pyx_builtin_zip) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -17948,14 +18083,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/metrics/pairwise_fast.pyx":13 + /* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ - __pyx_k_tuple_2 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_2 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_n_s__i)); @@ -17964,7 +18099,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_2, 1, ((PyObject *)__pyx_n_s__u)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__u)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - __pyx_k_tuple_3 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_3 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_n_s__i)); @@ -17973,7 +18108,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_3, 1, ((PyObject *)__pyx_n_s__u)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__u)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); - __pyx_k_tuple_4 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_4 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__i)); @@ -17982,25 +18117,25 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_4, 1, ((PyObject *)__pyx_n_s__u)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__u)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11)); @@ -18273,14 +18408,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50)); - /* "sklearn/metrics/pairwise_fast.pyx":13 + /* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ - __pyx_k_tuple_58 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_58 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_58); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, ((PyObject *)__pyx_n_s__X)); @@ -18319,7 +18454,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_58, 11, ((PyObject *)__pyx_n_s__denom)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__denom)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58)); - __pyx_k_codeobj_59 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_60, __pyx_n_s___chi2_kernel_fast, 13, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_59 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_60, __pyx_n_s___chi2_kernel_fast, 15, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "View.MemoryView":282 * return self.name @@ -18401,6 +18536,7 @@ static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__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_105 = PyInt_FromLong(105); if (unlikely(!__pyx_int_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; @@ -18457,6 +18593,14 @@ PyMODINIT_FUNC PyInit_pairwise_fast(void) __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__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.metrics.pairwise_fast")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.metrics.pairwise_fast", __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); @@ -18536,61 +18680,70 @@ PyMODINIT_FUNC PyInit_pairwise_fast(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/metrics/pairwise_fast.pyx":13 + /* "sklearn/metrics/pairwise_fast.pyx":9 + * import cython + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/metrics/pairwise_fast.pyx":15 * @cython.wraparound(False) * @cython.cdivision(True) - * def _chi2_kernel_fast(cython.floating[:,:] X, cython.floating[:,:] Y, cython.floating[:, :] result): # <<<<<<<<<<<<<< - * cdef int i, j, k - * cdef int n_samples_X = X.shape[0] + * def _chi2_kernel_fast(cython.floating[:,:] X, # <<<<<<<<<<<<<< + * cython.floating[:,:] Y, + * cython.floating[:, :] result): */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_0_0__pyx_mdef_7sklearn_7metrics_13pairwise_fast_3_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_0_0__pyx_mdef_7sklearn_7metrics_13pairwise_fast_3_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_empty_tuple)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_61), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_61), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_0_1__pyx_mdef_7sklearn_7metrics_13pairwise_fast_5_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_0_1__pyx_mdef_7sklearn_7metrics_13pairwise_fast_5_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_empty_tuple)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_63), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_63), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_1_0__pyx_mdef_7sklearn_7metrics_13pairwise_fast_7_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_1_0__pyx_mdef_7sklearn_7metrics_13pairwise_fast_7_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_empty_tuple)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_61), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_61), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_1_1__pyx_mdef_7sklearn_7metrics_13pairwise_fast_9_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0_1_1__pyx_mdef_7sklearn_7metrics_13pairwise_fast_9_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_empty_tuple)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_63), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_63), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_0_0__pyx_mdef_7sklearn_7metrics_13pairwise_fast_11_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_0_0__pyx_mdef_7sklearn_7metrics_13pairwise_fast_11_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_empty_tuple)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_61), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_61), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_0_1__pyx_mdef_7sklearn_7metrics_13pairwise_fast_13_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_0_1__pyx_mdef_7sklearn_7metrics_13pairwise_fast_13_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_empty_tuple)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_63), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_63), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_1_0__pyx_mdef_7sklearn_7metrics_13pairwise_fast_15_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_1_0__pyx_mdef_7sklearn_7metrics_13pairwise_fast_15_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_empty_tuple)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_61), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_61), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_1_1__pyx_mdef_7sklearn_7metrics_13pairwise_fast_17_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1_1_1__pyx_mdef_7sklearn_7metrics_13pairwise_fast_17_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_empty_tuple)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_63), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_s_63), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_mdef_7sklearn_7metrics_13pairwise_fast_1_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_mdef_7sklearn_7metrics_13pairwise_fast_1_chi2_kernel_fast, 0, NULL, __pyx_n_s_62, ((PyObject *)__pyx_k_codeobj_59)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, ((PyObject *)__pyx_empty_tuple)); ((__pyx_FusedFunctionObject *) __pyx_t_2)->__signatures__ = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___chi2_kernel_fast, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___chi2_kernel_fast, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/metrics/pairwise_fast.pyx":1 @@ -20943,7 +21096,7 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx) goto __pyx_err; Py_DECREF(string); } - sep = PyUnicode_FromString(", "); + sep = PyUnicode_FromString("|"); if (sep) signature = PyUnicode_Join(sep, list); __pyx_err: diff --git a/sklearn/metrics/pairwise_fast.pyx b/sklearn/metrics/pairwise_fast.pyx index fb0ce0fd43d01..cb996db9e077e 100644 --- a/sklearn/metrics/pairwise_fast.pyx +++ b/sklearn/metrics/pairwise_fast.pyx @@ -6,6 +6,8 @@ import numpy as np cimport numpy as np import cython +np.import_array() + @cython.boundscheck(False) @cython.wraparound(False) diff --git a/sklearn/neighbors/ball_tree.c b/sklearn/neighbors/ball_tree.c index c743ec8d3c5c5..3a77c90720a8c 100644 --- a/sklearn/neighbors/ball_tree.c +++ b/sklearn/neighbors/ball_tree.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Thu Jan 26 09:36:33 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:50 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #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 PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #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) #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) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 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_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])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -266,7 +285,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -290,8 +309,12 @@ 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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -316,7 +339,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -326,7 +348,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -334,18 +355,19 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "ball_tree.pyx", "numpy.pxd", + "type.pxd", }; -/* "numpy.pxd":719 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -354,7 +376,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -363,7 +385,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -372,7 +394,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -381,7 +403,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -390,7 +412,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -399,7 +421,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -408,7 +430,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -417,7 +439,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -426,7 +448,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -435,7 +457,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.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 # <<<<<<<<<<<<<< @@ -444,7 +466,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -453,7 +475,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -462,7 +484,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -471,7 +493,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -480,7 +502,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -489,7 +511,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -498,7 +520,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -507,7 +529,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -516,7 +538,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -525,7 +547,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -534,7 +556,7 @@ typedef npy_double __pyx_t_5numpy_double_t; */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* "sklearn/neighbors/ball_tree.pyx":203 +/* "sklearn/neighbors/ball_tree.pyx":205 * # type used for data * DTYPE = np.float64 * ctypedef np.float64_t DTYPE_t # <<<<<<<<<<<<<< @@ -543,7 +565,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t; -/* "sklearn/neighbors/ball_tree.pyx":208 +/* "sklearn/neighbors/ball_tree.pyx":210 * # warning: there will be problems if this is switched to an unsigned type! * ITYPE = np.int32 * ctypedef np.int32_t ITYPE_t # <<<<<<<<<<<<<< @@ -551,7 +573,6 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t; * # infinity */ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -572,10 +593,11 @@ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree; -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -584,7 +606,7 @@ struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -593,7 +615,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -602,7 +624,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -614,7 +636,7 @@ struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo; struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item; struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack; -/* "sklearn/neighbors/ball_tree.pyx":326 +/* "sklearn/neighbors/ball_tree.pyx":328 * # array for efficiency. This is a hybrid of the "Array of Structures" * # and "Structure of Arrays" styles. * cdef struct NodeInfo: # <<<<<<<<<<<<<< @@ -628,7 +650,7 @@ struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo { __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t radius; }; -/* "sklearn/neighbors/ball_tree.pyx":336 +/* "sklearn/neighbors/ball_tree.pyx":338 * # stack struct * # This is used to keep track of the recursion stack in Node_query * cdef struct stack_item: # <<<<<<<<<<<<<< @@ -640,7 +662,7 @@ struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item { __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t dist_p_LB; }; -/* "sklearn/neighbors/ball_tree.pyx":341 +/* "sklearn/neighbors/ball_tree.pyx":343 * * * cdef struct stack: # <<<<<<<<<<<<<< @@ -653,7 +675,7 @@ struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack { int size; }; -/* "sklearn/neighbors/ball_tree.pyx":398 +/* "sklearn/neighbors/ball_tree.pyx":400 * # BallTree class * # * cdef class BallTree(object): # <<<<<<<<<<<<<< @@ -684,12 +706,9 @@ struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree { __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t (*query_radius_distances_)(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack *); }; static struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_vtabptr_7sklearn_9neighbors_9ball_tree_BallTree; - - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -702,8 +721,21 @@ static struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_vt static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -714,7 +746,7 @@ static struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_vt #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -725,6 +757,8 @@ static struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_vt #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ @@ -736,21 +770,20 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, - const char* function_name, int kw_allowed); /*proto*/ +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ #define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; @@ -758,84 +791,101 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j Py_DECREF(j); return r; } - - #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - - #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { /* inlined PySequence_GetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } + return m->sq_item(o, i); + } } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); } - return r; +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); + static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *); static CYTHON_INLINE long __Pyx_pow_long(long, long); /* proto */ @@ -856,7 +906,6 @@ 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 #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -982,15 +1031,38 @@ static int __Pyx_check_binary_version(void); static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -999,6 +1071,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -1009,16 +1086,7 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ - -/* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ @@ -1045,7 +1113,6 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t); /*proto*/ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_dswap(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t); /*proto*/ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t); /*proto*/ -static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_calc_dist_LB(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t); /*proto*/ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_calc_dist_p_LB(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t); /*proto*/ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_largest(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t); /*proto*/ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_idx_largest(__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t); /*proto*/ @@ -1063,6 +1130,18 @@ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_newObj(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */ +static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree___cinit__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__init__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self, PyObject *__pyx_v_X, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_leaf_size, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_v_p); /* proto */ +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4__reduce__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6__getstate__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_8__setstate__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_10query(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_k, PyObject *__pyx_v_return_distance); /* proto */ +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12query_radius(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_r, PyObject *__pyx_v_return_distance, PyObject *__pyx_v_count_only, PyObject *__pyx_v_sort_results); /* proto */ +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4data___get__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_flag___get__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "new_size smaller than current"; static char __pyx_k_3[] = "popping empty stack"; static char __pyx_k_11[] = "X is an empty array"; @@ -1083,11 +1162,12 @@ static char __pyx_k_48[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_49[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_52[] = "Format string allocated too short."; static char __pyx_k_54[] = "\n=========\nBall Tree\n=========\nA ball tree is a data object which speeds up nearest neighbor\nsearches in high dimensions (see scikit-learn neighbors module\ndocumentation for an overview of neighbor trees). There are many\ntypes of ball trees. This package provides a basic implementation\nin cython.\n\nImplementation Notes\n--------------------\n\nA ball tree can be thought of as a collection of nodes. Each node\nstores a centroid, a radius, and the pointers to two child nodes.\n\n* centroid : the centroid of a node is the mean of all the locations\n of points within the node\n* radius : the radius of a node is the distance from the centroid\n to the furthest point in the node.\n* subnodes : each node has a maximum of 2 child nodes. The data within\n the parent node is divided between the two child nodes.\n\nIn a typical tree implementation, nodes may be classes or structures which\nare dynamically allocated as needed. This offers flexibility in the number\nof nodes, and leads to very straightforward and readable code. It also means\nthat the tree can be dynamically augmented or pruned with new data, in an\nin-line fashion. This approach generally leads to recursive code: upon\nconstruction, the head node constructs its child nodes, the child nodes\nconstruct their child nodes, and so-on.\n\nThe current package uses a different approach: all node data is stored in\na set of numpy arrays which are pre-allocated. The main advantage of this\napproach is that the whole object can be quickly and easily saved to disk\nand reconstructed from disk. This also allows for an iterative interface\nwhich gives more control over the heap, and leads to speed. There are a\nfew disadvantages, however: once the tree is built, augmenting or pruning it\nis not as straightforward. Also, the size of the tree must be known from the\nstart, so there is not as much flexibility in building it.\n\nBallTree Pseudo-code\n~~~~~~~~~~~~~~~~~~~~\nBecause understanding a ball ""tree is simpler with recursive code, here is some\npseudo-code to show the structure of the main functionality\n\n # Ball Tree pseudo code\n\n class Node:\n #class data:\n centroid\n radius\n child1, child2\n\n #class methods:\n def construct(data):\n centroid = compute_centroid(data)\n radius = compute_radius(centroid, data)\n\n # Divide the data into two approximately equal sets.\n # This is often done by splitting along a single dimension.\n data1, data2 = divide(data)\n\n if number_of_points(data1) > 0:\n child1.construct(data1)\n\n if number_of_points(data2) > 0:\n child2.construct(data2)\n\n def query(pt, neighbors_heap):\n # compute the minimum distance from pt to any point in this node\n d = distance(point, centroid)\n if d < radius:\n min_distance = 0\n else:\n min_distance = d - radius\n\n if min_distance > max_distance_in(neighbors_heap):\n # all these points are too far away. cut off the search here\n return\n elif node_size > 1:\n child1.query(pt, neighbors_heap)\n child2.query(pt, neighbors_heap)\n\n\n object BallTree:\n #class data:\n data\n root_node\n\n #class methods\n def construct(data, num_leaves):\n root_node.construct(data)\n\n def query(point, num_neighbors):\n neighbors_heap = empty_heap_of_size(num_neighbors)\n root_node.query(point, neighbors_heap)\n\nThis certainly is not a complete description, but should give the basic idea\nof the form of the algorithm. The implementation below is much faster than\nanything mirroring the pseudo-code above, but for that reason is much more\nopaque. Here's the basic idea:\n\nBallTree Storage\n~~~~~~~~~~~~~~~~""\nThe BallTree information is stored using a combination of\n\"Array of Structures\" and \"Structure of Arrays\" to maximize speed.\nGiven input data of size ``(n_samples, n_features)``, BallTree computes the\nexpected number of nodes ``n_nodes`` (see below), and allocates the\nfollowing arrays:\n\n* ``data`` : a float array of shape ``(n_samples, n_features)``\n This is simply the input data. If the input matrix is well-formed\n (contiguous, c-ordered, correct data type) then no copy is needed\n* ``idx_array`` : an integer array of size ``n_samples``\n This can be thought of as an array of pointers to the data in ``data``.\n Rather than shuffling around the data itself, we shuffle around pointers\n to the rows in data.\n* ``node_centroid_arr`` : a float array of shape ``(n_nodes, n_features)``\n This stores the centroid of the data in each node.\n* ``node_info_arr`` : a size-``n_nodes`` array of ``NodeInfo`` structures.\n This stores information associated with each node. Each ``NodeInfo``\n instance has the following attributes:\n - ``idx_start``\n - ``idx_end`` : ``idx_start`` and ``idx_end`` reference the part of\n ``idx_array`` which point to the data associated with the node.\n The data in node with index ``i_node`` is given by\n ``data[idx_array[idx_start:idx_end]]``\n - ``is_leaf`` : a boolean value which tells whether this node is a leaf:\n that is, whether or not it has children.\n - ``radius`` : a floating-point value which gives the distance from\n the node centroid to the furthest point in the node.\n\nOne feature here is that there are no stored pointers from parent nodes to\nchild nodes and vice-versa. These pointers are implemented implicitly:\nFor a node with index ``i``, the two children are found at indices\n``2 * i + 1`` and ``2 * i + 2``, while the parent is found at index\n``floor((i - 1) / 2)``. The root node has no parent.\n\nWith this data structure in place, the functionality ""of the above BallTree\npseudo-code can be implemented in a much more efficient manner.\nMost of the data passing done in this code uses raw data pointers.\nUsing numpy arrays would be preferable for safety, but the\noverhead of array slicing and sub-array construction leads to execution\ntime which is several orders of magnitude slower than the current\nimplementation.\n\nPriority Queue vs Max-heap\n~~~~~~~~~~~~~~~~~~~~~~~~~~\nWhen querying for more than one neighbor, the code must maintain a list of\nthe current k nearest points. The BallTree code implements this in two ways.\n\n- A priority queue: this is just a sorted list. When an item is added,\n it is inserted in the appropriate location. The cost of the search plus\n insert averages O[k].\n- A max-heap: this is a binary tree structure arranged such that each node is\n greater than its children. The cost of adding an item is O[log(k)].\n At the end of the iterations, the results must be sorted: a quicksort is\n used, which averages O[k log(k)]. Quicksort has worst-case O[k^2]\n performance, but because the input is already structured in a max-heap,\n the worst case will not be realized. Thus the sort is a one-time operation\n with cost O[k log(k)].\n\nEach insert is performed an average of log(N) times per query, where N is\nthe number of training points. Because of this, for a single query, the\npriority-queue approach costs O[k log(N)], and the max-heap approach costs\nO[log(k)log(N)] + O[k log(k)]. Tests show that for sufficiently large k,\nthe max-heap approach out-performs the priority queue approach by a factor\nof a few. In light of these tests, the code uses a priority queue for\nk < 5, and a max-heap otherwise.\n\nMemory Allocation\n~~~~~~~~~~~~~~~~~\nIt is desirable to construct a tree in as balanced a way as possible.\nGiven a training set with n_samples and a user-supplied leaf_size, if\nthe points in each node are divided as evenly as possible between the\ntwo children, the maximu""m depth needed so that leaf nodes satisfy\n``leaf_size <= n_points <= 2 * leaf_size`` is given by\n``n_levels = 1 + max(0, floor(log2((n_samples - 1) / leaf_size)))``\n(with the exception of the special case where ``n_samples < leaf_size``)\nFor a given number of levels, the number of points in a tree is given by\n``n_nodes = 2 ** n_levels - 1``. Both of these results can be shown\nby induction. Using them, the correct amount of memory can be pre-allocated\nfor a given ``n_samples`` and ``leaf_size``.\n"; -static char __pyx_k_55[] = "sklearn.neighbors.ball_tree"; -static char __pyx_k_56[] = "BallTree.query (line 565)"; -static char __pyx_k_57[] = "\n query(X, k=1, return_distance=True)\n\n query the Ball Tree for the k nearest neighbors\n\n Parameters\n ----------\n X : array-like, last dimension self.dim\n An array of points to query\n k : integer (default = 1)\n The number of nearest neighbors to return\n return_distance : boolean (default = True)\n if True, return a tuple (d,i)\n if False, return array i\n\n Returns\n -------\n i : if return_distance == False\n (d,i) : if return_distance == True\n\n d : array of doubles - shape: x.shape[:-1] + (k,)\n each entry gives the list of distances to the\n neighbors of the corresponding point\n (note that distances are not sorted)\n\n i : array of integers - shape: x.shape[:-1] + (k,)\n each entry gives the list of indices of\n neighbors of the corresponding point\n (note that neighbors are not sorted)\n\n Examples\n --------\n Query for k-nearest neighbors\n\n >>> import numpy as np\n >>> np.random.seed(0)\n >>> X = np.random.random((10,3)) # 10 points in 3 dimensions\n >>> ball_tree = BallTree(X, leaf_size=2) # doctest: +SKIP\n >>> dist, ind = ball_tree.query(X[0], k=3) # doctest: +SKIP\n >>> print ind # indices of 3 closest neighbors\n [0 3 1]\n >>> print dist # distances to 3 closest neighbors\n [ 0. 0.19662693 0.29473397]\n "; -static char __pyx_k_58[] = "BallTree.query_radius (line 672)"; -static char __pyx_k_59[] = "\n query_radius(self, X, r, count_only = False):\n\n query the Ball Tree for neighbors within a ball of size r\n\n Parameters\n ----------\n X : array-like, last dimension self.dim\n An array of points to query\n r : distance within which neighbors are returned\n r can be a single value, or an array of values of shape\n x.shape[:-1] if different radii are desired for each point.\n return_distance : boolean (default = False)\n if True, return distances to neighbors of each point\n if False, return only neighbors\n Note that unlike BallTree.query(), setting return_distance=True\n adds to the computation time. Not all distances need to be\n calculated explicitly for return_distance=False. Results are\n not sorted by default: see ``sort_results`` keyword.\n count_only : boolean (default = False)\n if True, return only the count of points within distance r\n if False, return the indices of all points within distance r\n If return_distance==True, setting count_only=True will\n result in an error.\n sort_results : boolean (default = False)\n if True, the distances and indices will be sorted before being\n returned. If False, the results will not be sorted. If\n return_distance == False, setting sort_results = True will\n result in an error.\n\n Returns\n -------\n count : if count_only == True\n ind : if count_only == False and return_distance == False\n (ind, dist) : if count_only == False and return_distance == True\n\n count : array of integers, shape = X.shape[:-1]\n each entry gives the number of neighbors within\n a distance r of the corresponding point.\n\n ind : array of objects, shape = X.shape[:-1]\n each element is a"" numpy integer array listing the indices of\n neighbors of the corresponding point. Note that unlike\n the results of BallTree.query(), the returned neighbors\n are not sorted by distance\n\n dist : array of objects, shape = X.shape[:-1]\n each element is a numpy double array\n listing the distances corresponding to indices in i.\n\n Examples\n --------\n Query for neighbors in a given radius\n\n >>> import numpy as np\n >>> np.random.seed(0)\n >>> X = np.random.random((10,3)) # 10 points in 3 dimensions\n >>> ball_tree = BallTree(X, leaf_size=2) # doctest: +SKIP\n >>> print ball_tree.query_radius(X[0], r=0.3, count_only=True)\n 3\n >>> ind = ball_tree.query_radius(X[0], r=0.3) # doctest: +SKIP\n >>> print ind # indices of neighbors within distance 0.3\n [3 0 1]\n "; +static char __pyx_k_57[] = "/scratch/apps/src/scikit-learn/sklearn/neighbors/ball_tree.pyx"; +static char __pyx_k_58[] = "sklearn.neighbors.ball_tree"; +static char __pyx_k_59[] = "BallTree.query (line 567)"; +static char __pyx_k_60[] = "\n query(X, k=1, return_distance=True)\n\n query the Ball Tree for the k nearest neighbors\n\n Parameters\n ----------\n X : array-like, last dimension self.dim\n An array of points to query\n k : integer (default = 1)\n The number of nearest neighbors to return\n return_distance : boolean (default = True)\n if True, return a tuple (d,i)\n if False, return array i\n\n Returns\n -------\n i : if return_distance == False\n (d,i) : if return_distance == True\n\n d : array of doubles - shape: x.shape[:-1] + (k,)\n each entry gives the list of distances to the\n neighbors of the corresponding point\n (note that distances are not sorted)\n\n i : array of integers - shape: x.shape[:-1] + (k,)\n each entry gives the list of indices of\n neighbors of the corresponding point\n (note that neighbors are not sorted)\n\n Examples\n --------\n Query for k-nearest neighbors\n\n >>> import numpy as np\n >>> np.random.seed(0)\n >>> X = np.random.random((10,3)) # 10 points in 3 dimensions\n >>> ball_tree = BallTree(X, leaf_size=2) # doctest: +SKIP\n >>> dist, ind = ball_tree.query(X[0], k=3) # doctest: +SKIP\n >>> print ind # indices of 3 closest neighbors\n [0 3 1]\n >>> print dist # distances to 3 closest neighbors\n [ 0. 0.19662693 0.29473397]\n "; +static char __pyx_k_61[] = "BallTree.query_radius (line 674)"; +static char __pyx_k_62[] = "\n query_radius(self, X, r, count_only = False):\n\n query the Ball Tree for neighbors within a ball of size r\n\n Parameters\n ----------\n X : array-like, last dimension self.dim\n An array of points to query\n r : distance within which neighbors are returned\n r can be a single value, or an array of values of shape\n x.shape[:-1] if different radii are desired for each point.\n return_distance : boolean (default = False)\n if True, return distances to neighbors of each point\n if False, return only neighbors\n Note that unlike BallTree.query(), setting return_distance=True\n adds to the computation time. Not all distances need to be\n calculated explicitly for return_distance=False. Results are\n not sorted by default: see ``sort_results`` keyword.\n count_only : boolean (default = False)\n if True, return only the count of points within distance r\n if False, return the indices of all points within distance r\n If return_distance==True, setting count_only=True will\n result in an error.\n sort_results : boolean (default = False)\n if True, the distances and indices will be sorted before being\n returned. If False, the results will not be sorted. If\n return_distance == False, setting sort_results = True will\n result in an error.\n\n Returns\n -------\n count : if count_only == True\n ind : if count_only == False and return_distance == False\n (ind, dist) : if count_only == False and return_distance == True\n\n count : array of integers, shape = X.shape[:-1]\n each entry gives the number of neighbors within\n a distance r of the corresponding point.\n\n ind : array of objects, shape = X.shape[:-1]\n each element is a"" numpy integer array listing the indices of\n neighbors of the corresponding point. Note that unlike\n the results of BallTree.query(), the returned neighbors\n are not sorted by distance\n\n dist : array of objects, shape = X.shape[:-1]\n each element is a numpy double array\n listing the distances corresponding to indices in i.\n\n Examples\n --------\n Query for neighbors in a given radius\n\n >>> import numpy as np\n >>> np.random.seed(0)\n >>> X = np.random.random((10,3)) # 10 points in 3 dimensions\n >>> ball_tree = BallTree(X, leaf_size=2) # doctest: +SKIP\n >>> print ball_tree.query_radius(X[0], r=0.3, count_only=True)\n 3\n >>> ind = ball_tree.query_radius(X[0], r=0.3) # doctest: +SKIP\n >>> print ind # indices of neighbors within distance 0.3\n [3 0 1]\n "; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; static char __pyx_k__H[] = "H"; @@ -1113,6 +1193,7 @@ 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__obj[] = "obj"; static char __pyx_k__copy[] = "copy"; static char __pyx_k__fill[] = "fill"; static char __pyx_k__log2[] = "log2"; @@ -1168,11 +1249,12 @@ static PyObject *__pyx_kp_u_46; static PyObject *__pyx_kp_u_48; static PyObject *__pyx_kp_u_49; static PyObject *__pyx_kp_u_52; -static PyObject *__pyx_n_s_55; -static PyObject *__pyx_kp_u_56; -static PyObject *__pyx_kp_u_57; -static PyObject *__pyx_kp_u_58; +static PyObject *__pyx_kp_s_57; +static PyObject *__pyx_n_s_58; static PyObject *__pyx_kp_u_59; +static PyObject *__pyx_kp_u_60; +static PyObject *__pyx_kp_u_61; +static PyObject *__pyx_kp_u_62; static PyObject *__pyx_n_s__C; static PyObject *__pyx_n_s__DTYPE; static PyObject *__pyx_n_s__ITYPE; @@ -1204,6 +1286,7 @@ static PyObject *__pyx_n_s__log2; static PyObject *__pyx_n_s__newObj; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__obj; static PyObject *__pyx_n_s__object; static PyObject *__pyx_n_s__ones; static PyObject *__pyx_n_s__order; @@ -1257,8 +1340,10 @@ static PyObject *__pyx_k_tuple_47; static PyObject *__pyx_k_tuple_50; static PyObject *__pyx_k_tuple_51; static PyObject *__pyx_k_tuple_53; +static PyObject *__pyx_k_tuple_55; +static PyObject *__pyx_k_codeobj_56; -/* "sklearn/neighbors/ball_tree.pyx":218 +/* "sklearn/neighbors/ball_tree.pyx":220 * # * @cython.profile(False) * cdef inline DTYPE_t dmax(DTYPE_t x, DTYPE_t y): # <<<<<<<<<<<<<< @@ -1270,9 +1355,9 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("dmax"); + __Pyx_RefNannySetupContext("dmax", 0); - /* "sklearn/neighbors/ball_tree.pyx":219 + /* "sklearn/neighbors/ball_tree.pyx":221 * @cython.profile(False) * cdef inline DTYPE_t dmax(DTYPE_t x, DTYPE_t y): * if x >= y: # <<<<<<<<<<<<<< @@ -1282,7 +1367,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl __pyx_t_1 = (__pyx_v_x >= __pyx_v_y); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":220 + /* "sklearn/neighbors/ball_tree.pyx":222 * cdef inline DTYPE_t dmax(DTYPE_t x, DTYPE_t y): * if x >= y: * return x # <<<<<<<<<<<<<< @@ -1295,7 +1380,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":222 + /* "sklearn/neighbors/ball_tree.pyx":224 * return x * else: * return y # <<<<<<<<<<<<<< @@ -1313,7 +1398,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":226 +/* "sklearn/neighbors/ball_tree.pyx":228 * * @cython.profile(False) * cdef inline DTYPE_t dmin(DTYPE_t x, DTYPE_t y): # <<<<<<<<<<<<<< @@ -1325,9 +1410,9 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("dmin"); + __Pyx_RefNannySetupContext("dmin", 0); - /* "sklearn/neighbors/ball_tree.pyx":227 + /* "sklearn/neighbors/ball_tree.pyx":229 * @cython.profile(False) * cdef inline DTYPE_t dmin(DTYPE_t x, DTYPE_t y): * if x <= y: # <<<<<<<<<<<<<< @@ -1337,7 +1422,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl __pyx_t_1 = (__pyx_v_x <= __pyx_v_y); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":228 + /* "sklearn/neighbors/ball_tree.pyx":230 * cdef inline DTYPE_t dmin(DTYPE_t x, DTYPE_t y): * if x <= y: * return x # <<<<<<<<<<<<<< @@ -1350,7 +1435,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":230 + /* "sklearn/neighbors/ball_tree.pyx":232 * return x * else: * return y # <<<<<<<<<<<<<< @@ -1368,7 +1453,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":234 +/* "sklearn/neighbors/ball_tree.pyx":236 * * @cython.profile(False) * cdef inline DTYPE_t dabs(DTYPE_t x): # <<<<<<<<<<<<<< @@ -1380,9 +1465,9 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("dabs"); + __Pyx_RefNannySetupContext("dabs", 0); - /* "sklearn/neighbors/ball_tree.pyx":235 + /* "sklearn/neighbors/ball_tree.pyx":237 * @cython.profile(False) * cdef inline DTYPE_t dabs(DTYPE_t x): * if x >= 0: # <<<<<<<<<<<<<< @@ -1392,7 +1477,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl __pyx_t_1 = (__pyx_v_x >= 0.0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":236 + /* "sklearn/neighbors/ball_tree.pyx":238 * cdef inline DTYPE_t dabs(DTYPE_t x): * if x >= 0: * return x # <<<<<<<<<<<<<< @@ -1405,7 +1490,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":238 + /* "sklearn/neighbors/ball_tree.pyx":240 * return x * else: * return -x # <<<<<<<<<<<<<< @@ -1423,7 +1508,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":251 +/* "sklearn/neighbors/ball_tree.pyx":253 * # which convert between these forms. * @cython.cdivision(True) * cdef DTYPE_t dist(DTYPE_t *x1, DTYPE_t *x2, ITYPE_t n, DTYPE_t p): # <<<<<<<<<<<<<< @@ -1439,9 +1524,9 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __Pyx_RefNannyDeclarations int __pyx_t_1; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; - __Pyx_RefNannySetupContext("dist"); + __Pyx_RefNannySetupContext("dist", 0); - /* "sklearn/neighbors/ball_tree.pyx":254 + /* "sklearn/neighbors/ball_tree.pyx":256 * cdef ITYPE_t i * cdef DTYPE_t r, d * r = 0 # <<<<<<<<<<<<<< @@ -1450,7 +1535,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_r = 0.0; - /* "sklearn/neighbors/ball_tree.pyx":255 + /* "sklearn/neighbors/ball_tree.pyx":257 * cdef DTYPE_t r, d * r = 0 * if p == 2: # <<<<<<<<<<<<<< @@ -1460,7 +1545,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == 2.0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":256 + /* "sklearn/neighbors/ball_tree.pyx":258 * r = 0 * if p == 2: * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -1470,7 +1555,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":257 + /* "sklearn/neighbors/ball_tree.pyx":259 * if p == 2: * for i from 0 <= i < n: * d = x1[i] - x2[i] # <<<<<<<<<<<<<< @@ -1479,7 +1564,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_d = ((__pyx_v_x1[__pyx_v_i]) - (__pyx_v_x2[__pyx_v_i])); - /* "sklearn/neighbors/ball_tree.pyx":258 + /* "sklearn/neighbors/ball_tree.pyx":260 * for i from 0 <= i < n: * d = x1[i] - x2[i] * r += d * d # <<<<<<<<<<<<<< @@ -1489,7 +1574,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_v_r = (__pyx_v_r + (__pyx_v_d * __pyx_v_d)); } - /* "sklearn/neighbors/ball_tree.pyx":259 + /* "sklearn/neighbors/ball_tree.pyx":261 * d = x1[i] - x2[i] * r += d * d * r = r ** 0.5 # <<<<<<<<<<<<<< @@ -1500,7 +1585,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L3; } - /* "sklearn/neighbors/ball_tree.pyx":260 + /* "sklearn/neighbors/ball_tree.pyx":262 * r += d * d * r = r ** 0.5 * elif p == infinity: # <<<<<<<<<<<<<< @@ -1510,7 +1595,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == __pyx_v_7sklearn_9neighbors_9ball_tree_infinity); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":261 + /* "sklearn/neighbors/ball_tree.pyx":263 * r = r ** 0.5 * elif p == infinity: * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -1520,7 +1605,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":262 + /* "sklearn/neighbors/ball_tree.pyx":264 * elif p == infinity: * for i from 0 <= i < n: * r = dmax(r, dabs(x1[i] - x2[i])) # <<<<<<<<<<<<<< @@ -1532,7 +1617,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L3; } - /* "sklearn/neighbors/ball_tree.pyx":263 + /* "sklearn/neighbors/ball_tree.pyx":265 * for i from 0 <= i < n: * r = dmax(r, dabs(x1[i] - x2[i])) * elif p == 1: # <<<<<<<<<<<<<< @@ -1542,7 +1627,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == 1.0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":264 + /* "sklearn/neighbors/ball_tree.pyx":266 * r = dmax(r, dabs(x1[i] - x2[i])) * elif p == 1: * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -1552,7 +1637,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":265 + /* "sklearn/neighbors/ball_tree.pyx":267 * elif p == 1: * for i from 0 <= i < n: * r += dabs(x1[i] - x2[i]) # <<<<<<<<<<<<<< @@ -1565,7 +1650,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":267 + /* "sklearn/neighbors/ball_tree.pyx":269 * r += dabs(x1[i] - x2[i]) * else: * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -1575,7 +1660,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":268 + /* "sklearn/neighbors/ball_tree.pyx":270 * else: * for i from 0 <= i < n: * d = dabs(x1[i] - x2[i]) # <<<<<<<<<<<<<< @@ -1584,7 +1669,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_d = __pyx_f_7sklearn_9neighbors_9ball_tree_dabs(((__pyx_v_x1[__pyx_v_i]) - (__pyx_v_x2[__pyx_v_i]))); - /* "sklearn/neighbors/ball_tree.pyx":269 + /* "sklearn/neighbors/ball_tree.pyx":271 * for i from 0 <= i < n: * d = dabs(x1[i] - x2[i]) * r += d ** p # <<<<<<<<<<<<<< @@ -1594,7 +1679,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_v_r = (__pyx_v_r + pow(__pyx_v_d, __pyx_v_p)); } - /* "sklearn/neighbors/ball_tree.pyx":270 + /* "sklearn/neighbors/ball_tree.pyx":272 * d = dabs(x1[i] - x2[i]) * r += d ** p * r = r ** (1. / p) # <<<<<<<<<<<<<< @@ -1605,7 +1690,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor } __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":271 + /* "sklearn/neighbors/ball_tree.pyx":273 * r += d ** p * r = r ** (1. / p) * return r # <<<<<<<<<<<<<< @@ -1621,7 +1706,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":275 +/* "sklearn/neighbors/ball_tree.pyx":277 * * @cython.cdivision(True) * cdef DTYPE_t dist_p(DTYPE_t *x1, DTYPE_t *x2, ITYPE_t n, DTYPE_t p): # <<<<<<<<<<<<<< @@ -1637,9 +1722,9 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __Pyx_RefNannyDeclarations int __pyx_t_1; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; - __Pyx_RefNannySetupContext("dist_p"); + __Pyx_RefNannySetupContext("dist_p", 0); - /* "sklearn/neighbors/ball_tree.pyx":278 + /* "sklearn/neighbors/ball_tree.pyx":280 * cdef ITYPE_t i * cdef DTYPE_t r, d * r = 0 # <<<<<<<<<<<<<< @@ -1648,7 +1733,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_r = 0.0; - /* "sklearn/neighbors/ball_tree.pyx":279 + /* "sklearn/neighbors/ball_tree.pyx":281 * cdef DTYPE_t r, d * r = 0 * if p == 2: # <<<<<<<<<<<<<< @@ -1658,7 +1743,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == 2.0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":280 + /* "sklearn/neighbors/ball_tree.pyx":282 * r = 0 * if p == 2: * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -1668,7 +1753,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":281 + /* "sklearn/neighbors/ball_tree.pyx":283 * if p == 2: * for i from 0 <= i < n: * d = x1[i] - x2[i] # <<<<<<<<<<<<<< @@ -1677,7 +1762,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_d = ((__pyx_v_x1[__pyx_v_i]) - (__pyx_v_x2[__pyx_v_i])); - /* "sklearn/neighbors/ball_tree.pyx":282 + /* "sklearn/neighbors/ball_tree.pyx":284 * for i from 0 <= i < n: * d = x1[i] - x2[i] * r += d * d # <<<<<<<<<<<<<< @@ -1689,7 +1774,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L3; } - /* "sklearn/neighbors/ball_tree.pyx":283 + /* "sklearn/neighbors/ball_tree.pyx":285 * d = x1[i] - x2[i] * r += d * d * elif p == infinity: # <<<<<<<<<<<<<< @@ -1699,7 +1784,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == __pyx_v_7sklearn_9neighbors_9ball_tree_infinity); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":284 + /* "sklearn/neighbors/ball_tree.pyx":286 * r += d * d * elif p == infinity: * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -1709,7 +1794,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":285 + /* "sklearn/neighbors/ball_tree.pyx":287 * elif p == infinity: * for i from 0 <= i < n: * r = dmax(r, dabs(x1[i] - x2[i])) # <<<<<<<<<<<<<< @@ -1721,7 +1806,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L3; } - /* "sklearn/neighbors/ball_tree.pyx":286 + /* "sklearn/neighbors/ball_tree.pyx":288 * for i from 0 <= i < n: * r = dmax(r, dabs(x1[i] - x2[i])) * elif p == 1: # <<<<<<<<<<<<<< @@ -1731,7 +1816,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == 1.0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":287 + /* "sklearn/neighbors/ball_tree.pyx":289 * r = dmax(r, dabs(x1[i] - x2[i])) * elif p == 1: * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -1741,7 +1826,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":288 + /* "sklearn/neighbors/ball_tree.pyx":290 * elif p == 1: * for i from 0 <= i < n: * r += dabs(x1[i] - x2[i]) # <<<<<<<<<<<<<< @@ -1754,7 +1839,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":290 + /* "sklearn/neighbors/ball_tree.pyx":292 * r += dabs(x1[i] - x2[i]) * else: * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -1764,7 +1849,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":291 + /* "sklearn/neighbors/ball_tree.pyx":293 * else: * for i from 0 <= i < n: * d = dabs(x1[i] - x2[i]) # <<<<<<<<<<<<<< @@ -1773,7 +1858,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_d = __pyx_f_7sklearn_9neighbors_9ball_tree_dabs(((__pyx_v_x1[__pyx_v_i]) - (__pyx_v_x2[__pyx_v_i]))); - /* "sklearn/neighbors/ball_tree.pyx":292 + /* "sklearn/neighbors/ball_tree.pyx":294 * for i from 0 <= i < n: * d = dabs(x1[i] - x2[i]) * r += d ** p # <<<<<<<<<<<<<< @@ -1785,7 +1870,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor } __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":293 + /* "sklearn/neighbors/ball_tree.pyx":295 * d = dabs(x1[i] - x2[i]) * r += d ** p * return r # <<<<<<<<<<<<<< @@ -1801,7 +1886,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":297 +/* "sklearn/neighbors/ball_tree.pyx":299 * * @cython.cdivision(True) * cdef DTYPE_t dist_from_dist_p(DTYPE_t r, DTYPE_t p): # <<<<<<<<<<<<<< @@ -1813,9 +1898,9 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("dist_from_dist_p"); + __Pyx_RefNannySetupContext("dist_from_dist_p", 0); - /* "sklearn/neighbors/ball_tree.pyx":298 + /* "sklearn/neighbors/ball_tree.pyx":300 * @cython.cdivision(True) * cdef DTYPE_t dist_from_dist_p(DTYPE_t r, DTYPE_t p): * if p == 2: # <<<<<<<<<<<<<< @@ -1825,7 +1910,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == 2.0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":299 + /* "sklearn/neighbors/ball_tree.pyx":301 * cdef DTYPE_t dist_from_dist_p(DTYPE_t r, DTYPE_t p): * if p == 2: * return r ** 0.5 # <<<<<<<<<<<<<< @@ -1837,7 +1922,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L3; } - /* "sklearn/neighbors/ball_tree.pyx":300 + /* "sklearn/neighbors/ball_tree.pyx":302 * if p == 2: * return r ** 0.5 * elif p == infinity: # <<<<<<<<<<<<<< @@ -1847,7 +1932,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == __pyx_v_7sklearn_9neighbors_9ball_tree_infinity); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":301 + /* "sklearn/neighbors/ball_tree.pyx":303 * return r ** 0.5 * elif p == infinity: * return r # <<<<<<<<<<<<<< @@ -1859,7 +1944,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L3; } - /* "sklearn/neighbors/ball_tree.pyx":302 + /* "sklearn/neighbors/ball_tree.pyx":304 * elif p == infinity: * return r * elif p == 1: # <<<<<<<<<<<<<< @@ -1869,7 +1954,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == 1.0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":303 + /* "sklearn/neighbors/ball_tree.pyx":305 * return r * elif p == 1: * return r # <<<<<<<<<<<<<< @@ -1882,7 +1967,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":305 + /* "sklearn/neighbors/ball_tree.pyx":307 * return r * else: * return r ** (1. / p) # <<<<<<<<<<<<<< @@ -1900,7 +1985,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":309 +/* "sklearn/neighbors/ball_tree.pyx":311 * * @cython.cdivision(True) * cdef DTYPE_t dist_p_from_dist(DTYPE_t r, DTYPE_t p): # <<<<<<<<<<<<<< @@ -1912,9 +1997,9 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("dist_p_from_dist"); + __Pyx_RefNannySetupContext("dist_p_from_dist", 0); - /* "sklearn/neighbors/ball_tree.pyx":310 + /* "sklearn/neighbors/ball_tree.pyx":312 * @cython.cdivision(True) * cdef DTYPE_t dist_p_from_dist(DTYPE_t r, DTYPE_t p): * if p == 2: # <<<<<<<<<<<<<< @@ -1924,7 +2009,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == 2.0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":311 + /* "sklearn/neighbors/ball_tree.pyx":313 * cdef DTYPE_t dist_p_from_dist(DTYPE_t r, DTYPE_t p): * if p == 2: * return r ** 2 # <<<<<<<<<<<<<< @@ -1936,7 +2021,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L3; } - /* "sklearn/neighbors/ball_tree.pyx":312 + /* "sklearn/neighbors/ball_tree.pyx":314 * if p == 2: * return r ** 2 * elif p == infinity: # <<<<<<<<<<<<<< @@ -1946,7 +2031,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == __pyx_v_7sklearn_9neighbors_9ball_tree_infinity); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":313 + /* "sklearn/neighbors/ball_tree.pyx":315 * return r ** 2 * elif p == infinity: * return r # <<<<<<<<<<<<<< @@ -1958,7 +2043,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L3; } - /* "sklearn/neighbors/ball_tree.pyx":314 + /* "sklearn/neighbors/ball_tree.pyx":316 * elif p == infinity: * return r * elif p == 1: # <<<<<<<<<<<<<< @@ -1968,7 +2053,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_p == 1.0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":315 + /* "sklearn/neighbors/ball_tree.pyx":317 * return r * elif p == 1: * return r # <<<<<<<<<<<<<< @@ -1981,7 +2066,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":317 + /* "sklearn/neighbors/ball_tree.pyx":319 * return r * else: * return r ** p # <<<<<<<<<<<<<< @@ -1999,7 +2084,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":348 +/* "sklearn/neighbors/ball_tree.pyx":350 * * @cython.profile(False) * cdef inline void stack_create(stack* self, int size): # <<<<<<<<<<<<<< @@ -2009,9 +2094,9 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbor static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_create(struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack *__pyx_v_self, int __pyx_v_size) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("stack_create"); + __Pyx_RefNannySetupContext("stack_create", 0); - /* "sklearn/neighbors/ball_tree.pyx":349 + /* "sklearn/neighbors/ball_tree.pyx":351 * @cython.profile(False) * cdef inline void stack_create(stack* self, int size): * self.size = size # <<<<<<<<<<<<<< @@ -2020,7 +2105,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_create(st */ __pyx_v_self->size = __pyx_v_size; - /* "sklearn/neighbors/ball_tree.pyx":350 + /* "sklearn/neighbors/ball_tree.pyx":352 * cdef inline void stack_create(stack* self, int size): * self.size = size * self.heap = stdlib.malloc(sizeof(stack_item) * size) # <<<<<<<<<<<<<< @@ -2029,7 +2114,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_create(st */ __pyx_v_self->heap = ((struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item *)malloc(((sizeof(struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item)) * __pyx_v_size))); - /* "sklearn/neighbors/ball_tree.pyx":351 + /* "sklearn/neighbors/ball_tree.pyx":353 * self.size = size * self.heap = stdlib.malloc(sizeof(stack_item) * size) * self.n = 0 # <<<<<<<<<<<<<< @@ -2041,7 +2126,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_create(st __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":355 +/* "sklearn/neighbors/ball_tree.pyx":357 * * @cython.profile(False) * cdef inline void stack_destroy(stack* self): # <<<<<<<<<<<<<< @@ -2051,9 +2136,9 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_create(st static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_destroy(struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack *__pyx_v_self) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("stack_destroy"); + __Pyx_RefNannySetupContext("stack_destroy", 0); - /* "sklearn/neighbors/ball_tree.pyx":356 + /* "sklearn/neighbors/ball_tree.pyx":358 * @cython.profile(False) * cdef inline void stack_destroy(stack* self): * stdlib.free(self.heap) # <<<<<<<<<<<<<< @@ -2065,7 +2150,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_destroy(s __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":360 +/* "sklearn/neighbors/ball_tree.pyx":362 * * @cython.profile(False) * cdef inline void stack_resize(stack* self, int new_size): # <<<<<<<<<<<<<< @@ -2080,9 +2165,9 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_resize(st int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("stack_resize"); + __Pyx_RefNannySetupContext("stack_resize", 0); - /* "sklearn/neighbors/ball_tree.pyx":362 + /* "sklearn/neighbors/ball_tree.pyx":364 * cdef inline void stack_resize(stack* self, int new_size): * #print "resize", self.n, new_size * if new_size < self.n: # <<<<<<<<<<<<<< @@ -2092,23 +2177,23 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_resize(st __pyx_t_1 = (__pyx_v_new_size < __pyx_v_self->n); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":363 + /* "sklearn/neighbors/ball_tree.pyx":365 * #print "resize", self.n, new_size * if new_size < self.n: * raise ValueError("new_size smaller than current") # <<<<<<<<<<<<<< * * self.size = new_size */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __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[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":365 + /* "sklearn/neighbors/ball_tree.pyx":367 * raise ValueError("new_size smaller than current") * * self.size = new_size # <<<<<<<<<<<<<< @@ -2117,7 +2202,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_resize(st */ __pyx_v_self->size = __pyx_v_new_size; - /* "sklearn/neighbors/ball_tree.pyx":366 + /* "sklearn/neighbors/ball_tree.pyx":368 * * self.size = new_size * self.heap = stdlib.realloc( self.heap, # <<<<<<<<<<<<<< @@ -2134,7 +2219,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_resize(st __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":371 +/* "sklearn/neighbors/ball_tree.pyx":373 * * @cython.profile(False) * cdef inline void stack_push(stack* self, stack_item item): # <<<<<<<<<<<<<< @@ -2145,9 +2230,9 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_resize(st static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack *__pyx_v_self, struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item __pyx_v_item) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("stack_push"); + __Pyx_RefNannySetupContext("stack_push", 0); - /* "sklearn/neighbors/ball_tree.pyx":372 + /* "sklearn/neighbors/ball_tree.pyx":374 * @cython.profile(False) * cdef inline void stack_push(stack* self, stack_item item): * if self.n >= self.size: # <<<<<<<<<<<<<< @@ -2157,7 +2242,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(stru __pyx_t_1 = (__pyx_v_self->n >= __pyx_v_self->size); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":373 + /* "sklearn/neighbors/ball_tree.pyx":375 * cdef inline void stack_push(stack* self, stack_item item): * if self.n >= self.size: * stack_resize(self, 2 * self.size + 1) # <<<<<<<<<<<<<< @@ -2169,7 +2254,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(stru } __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":375 + /* "sklearn/neighbors/ball_tree.pyx":377 * stack_resize(self, 2 * self.size + 1) * * self.heap[self.n] = item # <<<<<<<<<<<<<< @@ -2178,7 +2263,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(stru */ (__pyx_v_self->heap[__pyx_v_self->n]) = __pyx_v_item; - /* "sklearn/neighbors/ball_tree.pyx":376 + /* "sklearn/neighbors/ball_tree.pyx":378 * * self.heap[self.n] = item * self.n += 1 # <<<<<<<<<<<<<< @@ -2190,7 +2275,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(stru __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":380 +/* "sklearn/neighbors/ball_tree.pyx":382 * * @cython.profile(False) * cdef inline stack_item stack_pop(stack* self): # <<<<<<<<<<<<<< @@ -2206,9 +2291,9 @@ static CYTHON_INLINE struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item __ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("stack_pop"); + __Pyx_RefNannySetupContext("stack_pop", 0); - /* "sklearn/neighbors/ball_tree.pyx":381 + /* "sklearn/neighbors/ball_tree.pyx":383 * @cython.profile(False) * cdef inline stack_item stack_pop(stack* self): * if self.n == 0: # <<<<<<<<<<<<<< @@ -2218,23 +2303,23 @@ static CYTHON_INLINE struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item __ __pyx_t_1 = (__pyx_v_self->n == 0); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":382 + /* "sklearn/neighbors/ball_tree.pyx":384 * cdef inline stack_item stack_pop(stack* self): * if self.n == 0: * raise ValueError("popping empty stack") # <<<<<<<<<<<<<< * * self.n -= 1 */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __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[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":384 + /* "sklearn/neighbors/ball_tree.pyx":386 * raise ValueError("popping empty stack") * * self.n -= 1 # <<<<<<<<<<<<<< @@ -2243,7 +2328,7 @@ static CYTHON_INLINE struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item __ */ __pyx_v_self->n = (__pyx_v_self->n - 1); - /* "sklearn/neighbors/ball_tree.pyx":385 + /* "sklearn/neighbors/ball_tree.pyx":387 * * self.n -= 1 * return self.heap[self.n] # <<<<<<<<<<<<<< @@ -2262,7 +2347,19 @@ static CYTHON_INLINE struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item __ return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":391 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_1newObj(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/ +static PyMethodDef __pyx_mdef_7sklearn_9neighbors_9ball_tree_1newObj = {__Pyx_NAMESTR("newObj"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_9ball_tree_1newObj, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_1newObj(PyObject *__pyx_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("newObj (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_9neighbors_9ball_tree_newObj(__pyx_self, ((PyObject *)__pyx_v_obj)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/neighbors/ball_tree.pyx":393 * # newObj function * # this is a helper function for pickling * def newObj(obj): # <<<<<<<<<<<<<< @@ -2270,9 +2367,7 @@ static CYTHON_INLINE struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item __ * */ -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_newObj(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/ -static PyMethodDef __pyx_mdef_7sklearn_9neighbors_9ball_tree_newObj = {__Pyx_NAMESTR("newObj"), (PyCFunction)__pyx_pf_7sklearn_9neighbors_9ball_tree_newObj, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_newObj(PyObject *__pyx_self, PyObject *__pyx_v_obj) { +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_newObj(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2281,10 +2376,9 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_newObj(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("newObj"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("newObj", 0); - /* "sklearn/neighbors/ball_tree.pyx":392 + /* "sklearn/neighbors/ball_tree.pyx":394 * # this is a helper function for pickling * def newObj(obj): * return obj.__new__(obj) # <<<<<<<<<<<<<< @@ -2292,14 +2386,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_newObj(PyObject *__pyx_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_obj, __pyx_n_s____new__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_obj, __pyx_n_s____new__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __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 = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_obj); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_obj); __Pyx_GIVEREF(__pyx_v_obj); - __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 = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __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_2)); __pyx_t_2 = 0; @@ -2321,7 +2415,21 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_newObj(PyObject *__pyx_ return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":488 +/* Python wrapper */ +static int __pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree___cinit__(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/neighbors/ball_tree.pyx":490 * cdef readonly int warning_flag * * def __cinit__(self): # <<<<<<<<<<<<<< @@ -2329,8 +2437,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_newObj(PyObject *__pyx_ * initialize all arrays to empty. This will prevent memory errors */ -static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree___cinit__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2339,122 +2446,119 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree___cinit__(PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __Pyx_RefNannySetupContext("__cinit__", 0); - /* "sklearn/neighbors/ball_tree.pyx":493 + /* "sklearn/neighbors/ball_tree.pyx":495 * in rare cases where __init__ is not called * """ * self.data = np.empty((0,0), dtype=DTYPE) # <<<<<<<<<<<<<< * self.idx_array = np.empty(0, dtype=ITYPE) * self.node_centroid_arr = np.empty((0,0), dtype=DTYPE) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_k_tuple_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __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; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data = ((PyArrayObject *)__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); + __pyx_v_self->data = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/neighbors/ball_tree.pyx":494 + /* "sklearn/neighbors/ball_tree.pyx":496 * """ * self.data = np.empty((0,0), dtype=DTYPE) * self.idx_array = np.empty(0, dtype=ITYPE) # <<<<<<<<<<<<<< * self.node_centroid_arr = np.empty((0,0), dtype=DTYPE) * self.node_info_arr = np.empty(0, dtype='c') */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __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 = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_k_tuple_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __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; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array = ((PyArrayObject *)__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->idx_array); + __Pyx_DECREF(((PyObject *)__pyx_v_self->idx_array)); + __pyx_v_self->idx_array = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/neighbors/ball_tree.pyx":495 + /* "sklearn/neighbors/ball_tree.pyx":497 * self.data = np.empty((0,0), dtype=DTYPE) * self.idx_array = np.empty(0, dtype=ITYPE) * self.node_centroid_arr = np.empty((0,0), dtype=DTYPE) # <<<<<<<<<<<<<< * self.node_info_arr = np.empty(0, dtype='c') * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_k_tuple_9), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_9), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__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 = 495; __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 = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr = ((PyArrayObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->node_centroid_arr); + __Pyx_DECREF(((PyObject *)__pyx_v_self->node_centroid_arr)); + __pyx_v_self->node_centroid_arr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":496 + /* "sklearn/neighbors/ball_tree.pyx":498 * self.idx_array = np.empty(0, dtype=ITYPE) * self.node_centroid_arr = np.empty((0,0), dtype=DTYPE) * self.node_info_arr = np.empty(0, dtype='c') # <<<<<<<<<<<<<< * * def __init__(self, X, ITYPE_t leaf_size=20, DTYPE_t p=2): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__c)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_k_tuple_10), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__c)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_10), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __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; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr = ((PyArrayObject *)__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->node_info_arr); + __Pyx_DECREF(((PyObject *)__pyx_v_self->node_info_arr)); + __pyx_v_self->node_info_arr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __pyx_r = 0; @@ -2470,42 +2574,22 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree___cinit__(PyObject return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":498 - * self.node_info_arr = np.empty(0, dtype='c') - * - * def __init__(self, X, ITYPE_t leaf_size=20, DTYPE_t p=2): # <<<<<<<<<<<<<< - * self.data = np.asarray(X, dtype=DTYPE, order='C') - * self.warning_flag = True - */ - -static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_leaf_size; __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_v_p; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_n_samples; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_n_features; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - long __pyx_t_6; - long __pyx_t_7; - long __pyx_t_8; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_9; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__leaf_size,&__pyx_n_s__p,0}; - __Pyx_RefNannySetupContext("__init__"); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__leaf_size,&__pyx_n_s__p,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -2513,10 +2597,9 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -2530,7 +2613,7 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2543,129 +2626,159 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject } __pyx_v_X = values[0]; if (values[1]) { - __pyx_v_leaf_size = __Pyx_PyInt_from_py_npy_int32(values[1]); if (unlikely((__pyx_v_leaf_size == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_leaf_size = __Pyx_PyInt_from_py_npy_int32(values[1]); if (unlikely((__pyx_v_leaf_size == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_leaf_size = ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t)20); } if (values[2]) { - __pyx_v_p = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_p == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_p == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { + + /* "sklearn/neighbors/ball_tree.pyx":500 + * self.node_info_arr = np.empty(0, dtype='c') + * + * def __init__(self, X, ITYPE_t leaf_size=20, DTYPE_t p=2): # <<<<<<<<<<<<<< + * self.data = np.asarray(X, dtype=DTYPE, order='C') + * self.warning_flag = True + */ __pyx_v_p = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t)2.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.neighbors.ball_tree.BallTree.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__init__(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self), __pyx_v_X, __pyx_v_leaf_size, __pyx_v_p); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "sklearn/neighbors/ball_tree.pyx":499 - * - * def __init__(self, X, ITYPE_t leaf_size=20, DTYPE_t p=2): - * self.data = np.asarray(X, dtype=DTYPE, order='C') # <<<<<<<<<<<<<< - * self.warning_flag = True - * - */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); +static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__init__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self, PyObject *__pyx_v_X, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_leaf_size, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_v_p) { + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_n_samples; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_n_features; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + long __pyx_t_6; + long __pyx_t_7; + long __pyx_t_8; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/neighbors/ball_tree.pyx":501 + * + * def __init__(self, X, ITYPE_t leaf_size=20, DTYPE_t p=2): + * self.data = np.asarray(X, dtype=DTYPE, order='C') # <<<<<<<<<<<<<< + * self.warning_flag = True + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __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 = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_X); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_X); __Pyx_GIVEREF(__pyx_v_X); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_4); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data = ((PyArrayObject *)__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); + __pyx_v_self->data = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":500 + /* "sklearn/neighbors/ball_tree.pyx":502 * def __init__(self, X, ITYPE_t leaf_size=20, DTYPE_t p=2): * self.data = np.asarray(X, dtype=DTYPE, order='C') * self.warning_flag = True # <<<<<<<<<<<<<< * * if X.size == 0: */ - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->warning_flag = 1; + __pyx_v_self->warning_flag = 1; - /* "sklearn/neighbors/ball_tree.pyx":502 + /* "sklearn/neighbors/ball_tree.pyx":504 * self.warning_flag = True * * if X.size == 0: # <<<<<<<<<<<<<< * raise ValueError("X is an empty array") * */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__size); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { - /* "sklearn/neighbors/ball_tree.pyx":503 + /* "sklearn/neighbors/ball_tree.pyx":505 * * if X.size == 0: * raise ValueError("X is an empty array") # <<<<<<<<<<<<<< * * if self.data.ndim != 2: */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __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[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":505 + /* "sklearn/neighbors/ball_tree.pyx":507 * raise ValueError("X is an empty array") * * if self.data.ndim != 2: # <<<<<<<<<<<<<< * raise ValueError("X should have two dimensions") * */ - __pyx_t_5 = (((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data->nd != 2); + __pyx_t_5 = (__pyx_v_self->data->nd != 2); if (__pyx_t_5) { - /* "sklearn/neighbors/ball_tree.pyx":506 + /* "sklearn/neighbors/ball_tree.pyx":508 * * if self.data.ndim != 2: * raise ValueError("X should have two dimensions") # <<<<<<<<<<<<<< * * if p < 1: */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __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[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; - /* "sklearn/neighbors/ball_tree.pyx":508 + /* "sklearn/neighbors/ball_tree.pyx":510 * raise ValueError("X should have two dimensions") * * if p < 1: # <<<<<<<<<<<<<< @@ -2675,32 +2788,32 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject __pyx_t_5 = (__pyx_v_p < 1.0); if (__pyx_t_5) { - /* "sklearn/neighbors/ball_tree.pyx":509 + /* "sklearn/neighbors/ball_tree.pyx":511 * * if p < 1: * raise ValueError("p must be greater than or equal to 1") # <<<<<<<<<<<<<< * self.p = p * */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __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[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L8:; + __pyx_L5:; - /* "sklearn/neighbors/ball_tree.pyx":510 + /* "sklearn/neighbors/ball_tree.pyx":512 * if p < 1: * raise ValueError("p must be greater than or equal to 1") * self.p = p # <<<<<<<<<<<<<< * * if leaf_size < 1: */ - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->p = __pyx_v_p; + __pyx_v_self->p = __pyx_v_p; - /* "sklearn/neighbors/ball_tree.pyx":512 + /* "sklearn/neighbors/ball_tree.pyx":514 * self.p = p * * if leaf_size < 1: # <<<<<<<<<<<<<< @@ -2710,193 +2823,193 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject __pyx_t_5 = (__pyx_v_leaf_size < 1); if (__pyx_t_5) { - /* "sklearn/neighbors/ball_tree.pyx":513 + /* "sklearn/neighbors/ball_tree.pyx":515 * * if leaf_size < 1: * raise ValueError("leaf_size must be greater than or equal to 1") # <<<<<<<<<<<<<< * self.leaf_size = leaf_size * */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __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[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L9; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L9:; + __pyx_L6:; - /* "sklearn/neighbors/ball_tree.pyx":514 + /* "sklearn/neighbors/ball_tree.pyx":516 * if leaf_size < 1: * raise ValueError("leaf_size must be greater than or equal to 1") * self.leaf_size = leaf_size # <<<<<<<<<<<<<< * * cdef ITYPE_t n_samples = self.data.shape[0] */ - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->leaf_size = __pyx_v_leaf_size; + __pyx_v_self->leaf_size = __pyx_v_leaf_size; - /* "sklearn/neighbors/ball_tree.pyx":516 + /* "sklearn/neighbors/ball_tree.pyx":518 * self.leaf_size = leaf_size * * cdef ITYPE_t n_samples = self.data.shape[0] # <<<<<<<<<<<<<< * cdef ITYPE_t n_features = self.data.shape[1] * */ - __pyx_v_n_samples = (((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data->dimensions[0]); + __pyx_v_n_samples = (__pyx_v_self->data->dimensions[0]); - /* "sklearn/neighbors/ball_tree.pyx":517 + /* "sklearn/neighbors/ball_tree.pyx":519 * * cdef ITYPE_t n_samples = self.data.shape[0] * cdef ITYPE_t n_features = self.data.shape[1] # <<<<<<<<<<<<<< * * # determine number of levels in the ball tree, and from this */ - __pyx_v_n_features = (((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data->dimensions[1]); + __pyx_v_n_features = (__pyx_v_self->data->dimensions[1]); - /* "sklearn/neighbors/ball_tree.pyx":521 + /* "sklearn/neighbors/ball_tree.pyx":523 * # determine number of levels in the ball tree, and from this * # the number of nodes in the ball tree * self.n_levels = np.log2(max(1, (n_samples - 1)/self.leaf_size)) + 1 # <<<<<<<<<<<<<< * self.n_nodes = (2 ** self.n_levels) - 1 * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__log2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__log2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = (__pyx_v_n_samples - 1); - if (unlikely(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->leaf_size == 0)) { + if (unlikely(__pyx_v_self->leaf_size == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - else if (sizeof(long) == sizeof(long) && unlikely(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->leaf_size == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_6))) { + else if (sizeof(long) == sizeof(long) && unlikely(__pyx_v_self->leaf_size == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_6))) { PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_7 = __Pyx_div_long(__pyx_t_6, ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->leaf_size); + __pyx_t_7 = __Pyx_div_long(__pyx_t_6, __pyx_v_self->leaf_size); __pyx_t_6 = 1; if ((__pyx_t_7 > __pyx_t_6)) { __pyx_t_8 = __pyx_t_7; } else { __pyx_t_8 = __pyx_t_6; } - __pyx_t_3 = PyInt_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __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 = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_9 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_9 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_levels = __pyx_t_9; + __pyx_v_self->n_levels = __pyx_t_9; - /* "sklearn/neighbors/ball_tree.pyx":522 + /* "sklearn/neighbors/ball_tree.pyx":524 * # the number of nodes in the ball tree * self.n_levels = np.log2(max(1, (n_samples - 1)/self.leaf_size)) + 1 * self.n_nodes = (2 ** self.n_levels) - 1 # <<<<<<<<<<<<<< * * self.idx_array = np.arange(n_samples, dtype=ITYPE) */ - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_nodes = (__Pyx_pow_long(2, ((long)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_levels)) - 1); + __pyx_v_self->n_nodes = (__Pyx_pow_long(2, ((long)__pyx_v_self->n_levels)) - 1); - /* "sklearn/neighbors/ball_tree.pyx":524 + /* "sklearn/neighbors/ball_tree.pyx":526 * self.n_nodes = (2 ** self.n_levels) - 1 * * self.idx_array = np.arange(n_samples, dtype=ITYPE) # <<<<<<<<<<<<<< * * self.node_centroid_arr = np.empty((self.n_nodes, n_features), */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __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_npy_int32(__pyx_v_n_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_n_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __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); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __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_4)); __pyx_t_4 = 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 = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array = ((PyArrayObject *)__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->idx_array); + __Pyx_DECREF(((PyObject *)__pyx_v_self->idx_array)); + __pyx_v_self->idx_array = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/neighbors/ball_tree.pyx":526 + /* "sklearn/neighbors/ball_tree.pyx":528 * self.idx_array = np.arange(n_samples, dtype=ITYPE) * * self.node_centroid_arr = np.empty((self.n_nodes, n_features), # <<<<<<<<<<<<<< * dtype=DTYPE, order='C') * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_nodes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_self->n_nodes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_n_features); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_n_features); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __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[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __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); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __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)); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - /* "sklearn/neighbors/ball_tree.pyx":527 + /* "sklearn/neighbors/ball_tree.pyx":529 * * self.node_centroid_arr = np.empty((self.n_nodes, n_features), * dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * * self.node_info_arr = np.empty(self.n_nodes * sizeof(NodeInfo), */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __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 = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __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 = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __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_4)); __pyx_t_4 = 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 = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/neighbors/ball_tree.pyx":526 + /* "sklearn/neighbors/ball_tree.pyx":528 * self.idx_array = np.arange(n_samples, dtype=ITYPE) * * self.node_centroid_arr = np.empty((self.n_nodes, n_features), # <<<<<<<<<<<<<< @@ -2904,54 +3017,54 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject * */ __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr = ((PyArrayObject *)__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->node_centroid_arr); + __Pyx_DECREF(((PyObject *)__pyx_v_self->node_centroid_arr)); + __pyx_v_self->node_centroid_arr = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/neighbors/ball_tree.pyx":529 + /* "sklearn/neighbors/ball_tree.pyx":531 * dtype=DTYPE, order='C') * * self.node_info_arr = np.empty(self.n_nodes * sizeof(NodeInfo), # <<<<<<<<<<<<<< * dtype='c', order='C') * self.build_tree_() */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_FromSize_t((((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_nodes * (sizeof(struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_FromSize_t((__pyx_v_self->n_nodes * (sizeof(struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__c)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__c)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__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 = 529; __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 = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr = ((PyArrayObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->node_info_arr); + __Pyx_DECREF(((PyObject *)__pyx_v_self->node_info_arr)); + __pyx_v_self->node_info_arr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":531 + /* "sklearn/neighbors/ball_tree.pyx":533 * self.node_info_arr = np.empty(self.n_nodes * sizeof(NodeInfo), * dtype='c', order='C') * self.build_tree_() # <<<<<<<<<<<<<< * * def __reduce__(self): */ - ((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->__pyx_vtab)->build_tree_(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)); + ((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self->__pyx_vtab)->build_tree_(__pyx_v_self); __pyx_r = 0; goto __pyx_L0; @@ -2967,7 +3080,19 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":533 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_4__reduce__[] = "\n reduce method used for pickling\n "; +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_5__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_9neighbors_9ball_tree_8BallTree_4__reduce__(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/neighbors/ball_tree.pyx":535 * self.build_tree_() * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -2975,9 +3100,7 @@ static int __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__(PyObject * reduce method used for pickling */ -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_2__reduce__[] = "\n reduce method used for pickling\n "; -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4__reduce__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2987,9 +3110,9 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__reduce__(P int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__reduce__"); + __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/neighbors/ball_tree.pyx":537 + /* "sklearn/neighbors/ball_tree.pyx":539 * reduce method used for pickling * """ * return (newObj, (BallTree,), self.__getstate__()) # <<<<<<<<<<<<<< @@ -2997,20 +3120,20 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__reduce__(P * def __getstate__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__newObj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__newObj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __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 = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_9ball_tree_BallTree))); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_9ball_tree_BallTree))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_9neighbors_9ball_tree_BallTree))); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____getstate__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __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(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __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); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_2)); @@ -3039,7 +3162,19 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__reduce__(P return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":539 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_7__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_6__getstate__[] = "\n get state for pickling\n "; +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_7__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6__getstate__(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/neighbors/ball_tree.pyx":541 * return (newObj, (BallTree,), self.__getstate__()) * * def __getstate__(self): # <<<<<<<<<<<<<< @@ -3047,9 +3182,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__reduce__(P * get state for pickling */ -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_3__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_3__getstate__[] = "\n get state for pickling\n "; -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_3__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6__getstate__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3060,9 +3193,9 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_3__getstate__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getstate__"); + __Pyx_RefNannySetupContext("__getstate__", 0); - /* "sklearn/neighbors/ball_tree.pyx":543 + /* "sklearn/neighbors/ball_tree.pyx":545 * get state for pickling * """ * return (self.data, # <<<<<<<<<<<<<< @@ -3071,59 +3204,59 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_3__getstate__ */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/neighbors/ball_tree.pyx":547 + /* "sklearn/neighbors/ball_tree.pyx":549 * self.node_centroid_arr, * self.node_info_arr, * self.p, # <<<<<<<<<<<<<< * self.leaf_size, * self.n_levels, */ - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/neighbors/ball_tree.pyx":548 + /* "sklearn/neighbors/ball_tree.pyx":550 * self.node_info_arr, * self.p, * self.leaf_size, # <<<<<<<<<<<<<< * self.n_levels, * self.n_nodes) */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->leaf_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_self->leaf_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/neighbors/ball_tree.pyx":549 + /* "sklearn/neighbors/ball_tree.pyx":551 * self.p, * self.leaf_size, * self.n_levels, # <<<<<<<<<<<<<< * self.n_nodes) * */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_levels); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_self->n_levels); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - /* "sklearn/neighbors/ball_tree.pyx":550 + /* "sklearn/neighbors/ball_tree.pyx":552 * self.leaf_size, * self.n_levels, * self.n_nodes) # <<<<<<<<<<<<<< * * def __setstate__(self, state): */ - __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_nodes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_self->n_nodes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array)); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr)); - PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr)); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr)); - PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr)); - __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr)); + __pyx_t_5 = PyTuple_New(8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_self->data)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self->data)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->data)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->idx_array)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_self->idx_array)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->idx_array)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->node_centroid_arr)); + PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_v_self->node_centroid_arr)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->node_centroid_arr)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->node_info_arr)); + PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_self->node_info_arr)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->node_info_arr)); PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_t_2); @@ -3156,7 +3289,19 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_3__getstate__ return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":552 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_9__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_8__setstate__[] = "\n set state for pickling\n "; +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_9__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_8__setstate__(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/neighbors/ball_tree.pyx":554 * self.n_nodes) * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -3164,9 +3309,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_3__getstate__ * set state for pickling */ -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_4__setstate__[] = "\n set state for pickling\n "; -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_8__setstate__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3175,123 +3318,123 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4__setstate__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__setstate__"); + __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/neighbors/ball_tree.pyx":556 + /* "sklearn/neighbors/ball_tree.pyx":558 * set state for pickling * """ * self.data = state[0] # <<<<<<<<<<<<<< * self.idx_array = state[1] * self.node_centroid_arr = state[2] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __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 = 556; __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 = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data = ((PyArrayObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->data); + __Pyx_DECREF(((PyObject *)__pyx_v_self->data)); + __pyx_v_self->data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":557 + /* "sklearn/neighbors/ball_tree.pyx":559 * """ * self.data = state[0] * self.idx_array = state[1] # <<<<<<<<<<<<<< * self.node_centroid_arr = state[2] * self.node_info_arr = state[3] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __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 = 557; __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 = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->idx_array = ((PyArrayObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->idx_array); + __Pyx_DECREF(((PyObject *)__pyx_v_self->idx_array)); + __pyx_v_self->idx_array = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":558 + /* "sklearn/neighbors/ball_tree.pyx":560 * self.data = state[0] * self.idx_array = state[1] * self.node_centroid_arr = state[2] # <<<<<<<<<<<<<< * self.node_info_arr = state[3] * self.p = state[4] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __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 = 558; __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 = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_centroid_arr = ((PyArrayObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->node_centroid_arr); + __Pyx_DECREF(((PyObject *)__pyx_v_self->node_centroid_arr)); + __pyx_v_self->node_centroid_arr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":559 + /* "sklearn/neighbors/ball_tree.pyx":561 * self.idx_array = state[1] * self.node_centroid_arr = state[2] * self.node_info_arr = state[3] # <<<<<<<<<<<<<< * self.p = state[4] * self.leaf_size = state[5] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __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 = 559; __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 = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr)); - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->node_info_arr = ((PyArrayObject *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->node_info_arr); + __Pyx_DECREF(((PyObject *)__pyx_v_self->node_info_arr)); + __pyx_v_self->node_info_arr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":560 + /* "sklearn/neighbors/ball_tree.pyx":562 * self.node_centroid_arr = state[2] * self.node_info_arr = state[3] * self.p = state[4] # <<<<<<<<<<<<<< * self.leaf_size = state[5] * self.n_levels = state[6] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->p = __pyx_t_2; + __pyx_v_self->p = __pyx_t_2; - /* "sklearn/neighbors/ball_tree.pyx":561 + /* "sklearn/neighbors/ball_tree.pyx":563 * self.node_info_arr = state[3] * self.p = state[4] * self.leaf_size = state[5] # <<<<<<<<<<<<<< * self.n_levels = state[6] * self.n_nodes = state[7] */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 5, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->leaf_size = __pyx_t_3; + __pyx_v_self->leaf_size = __pyx_t_3; - /* "sklearn/neighbors/ball_tree.pyx":562 + /* "sklearn/neighbors/ball_tree.pyx":564 * self.p = state[4] * self.leaf_size = state[5] * self.n_levels = state[6] # <<<<<<<<<<<<<< * self.n_nodes = state[7] * */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 6, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_levels = __pyx_t_3; + __pyx_v_self->n_levels = __pyx_t_3; - /* "sklearn/neighbors/ball_tree.pyx":563 + /* "sklearn/neighbors/ball_tree.pyx":565 * self.leaf_size = state[5] * self.n_levels = state[6] * self.n_nodes = state[7] # <<<<<<<<<<<<<< * * def query(self, X, k=1, return_distance=True): */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 7, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_state, 7, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_nodes = __pyx_t_3; + __pyx_v_self->n_nodes = __pyx_t_3; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -3305,53 +3448,25 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4__setstate__ return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":565 - * self.n_nodes = state[7] - * - * def query(self, X, k=1, return_distance=True): # <<<<<<<<<<<<<< - * """ - * query(X, k=1, return_distance=True) - */ - -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_5query[] = "\n query(X, k=1, return_distance=True)\n\n query the Ball Tree for the k nearest neighbors\n\n Parameters\n ----------\n X : array-like, last dimension self.dim\n An array of points to query\n k : integer (default = 1)\n The number of nearest neighbors to return\n return_distance : boolean (default = True)\n if True, return a tuple (d,i)\n if False, return array i\n\n Returns\n -------\n i : if return_distance == False\n (d,i) : if return_distance == True\n\n d : array of doubles - shape: x.shape[:-1] + (k,)\n each entry gives the list of distances to the\n neighbors of the corresponding point\n (note that distances are not sorted)\n\n i : array of integers - shape: x.shape[:-1] + (k,)\n each entry gives the list of indices of\n neighbors of the corresponding point\n (note that neighbors are not sorted)\n\n Examples\n --------\n Query for k-nearest neighbors\n\n >>> import numpy as np\n >>> np.random.seed(0)\n >>> X = np.random.random((10,3)) # 10 points in 3 dimensions\n >>> ball_tree = BallTree(X, leaf_size=2) # doctest: +SKIP\n >>> dist, ind = ball_tree.query(X[0], k=3) # doctest: +SKIP\n >>> print ind # indices of 3 closest neighbors\n [0 3 1]\n >>> print dist # distances to 3 closest neighbors\n [ 0. 0.19662693 0.29473397]\n "; -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_11query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_10query[] = "\n query(X, k=1, return_distance=True)\n\n query the Ball Tree for the k nearest neighbors\n\n Parameters\n ----------\n X : array-like, last dimension self.dim\n An array of points to query\n k : integer (default = 1)\n The number of nearest neighbors to return\n return_distance : boolean (default = True)\n if True, return a tuple (d,i)\n if False, return array i\n\n Returns\n -------\n i : if return_distance == False\n (d,i) : if return_distance == True\n\n d : array of doubles - shape: x.shape[:-1] + (k,)\n each entry gives the list of distances to the\n neighbors of the corresponding point\n (note that distances are not sorted)\n\n i : array of integers - shape: x.shape[:-1] + (k,)\n each entry gives the list of indices of\n neighbors of the corresponding point\n (note that neighbors are not sorted)\n\n Examples\n --------\n Query for k-nearest neighbors\n\n >>> import numpy as np\n >>> np.random.seed(0)\n >>> X = np.random.random((10,3)) # 10 points in 3 dimensions\n >>> ball_tree = BallTree(X, leaf_size=2) # doctest: +SKIP\n >>> dist, ind = ball_tree.query(X[0], k=3) # doctest: +SKIP\n >>> print ind # indices of 3 closest neighbors\n [0 3 1]\n >>> print dist # distances to 3 closest neighbors\n [ 0. 0.19662693 0.29473397]\n "; +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_11query(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyObject *__pyx_v_k = 0; PyObject *__pyx_v_return_distance = 0; - PyObject *__pyx_v_orig_shape = NULL; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_use_max_heap; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_i; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_n_neighbors; - PyArrayObject *__pyx_v_distances = 0; - PyArrayObject *__pyx_v_idx_array = 0; - PyArrayObject *__pyx_v_Xi = 0; - __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_dist_ptr; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *__pyx_v_idx_ptr; - struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack __pyx_v_node_stack; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - PyObject *__pyx_t_9 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__k,&__pyx_n_s__return_distance,0}; - __Pyx_RefNannySetupContext("query"); + __Pyx_RefNannySetupContext("query (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__k,&__pyx_n_s__return_distance,0}; PyObject* values[3] = {0,0,0}; values[1] = ((PyObject *)__pyx_int_1); values[2] = __pyx_k_19; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -3359,10 +3474,9 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -3376,7 +3490,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "query") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "query") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3393,45 +3507,84 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("query", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("query", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.neighbors.ball_tree.BallTree.query", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_10query(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self), __pyx_v_X, __pyx_v_k, __pyx_v_return_distance); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/neighbors/ball_tree.pyx":567 + * self.n_nodes = state[7] + * + * def query(self, X, k=1, return_distance=True): # <<<<<<<<<<<<<< + * """ + * query(X, k=1, return_distance=True) + */ + +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_10query(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_k, PyObject *__pyx_v_return_distance) { + PyObject *__pyx_v_orig_shape = NULL; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_use_max_heap; + CYTHON_UNUSED __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_i; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_n_neighbors; + PyArrayObject *__pyx_v_distances = 0; + PyArrayObject *__pyx_v_idx_array = 0; + PyArrayObject *__pyx_v_Xi = 0; + __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_dist_ptr; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *__pyx_v_idx_ptr; + struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack __pyx_v_node_stack; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("query", 0); __Pyx_INCREF(__pyx_v_X); - /* "sklearn/neighbors/ball_tree.pyx":610 + /* "sklearn/neighbors/ball_tree.pyx":612 * [ 0. 0.19662693 0.29473397] * """ * self.warning_flag = False # <<<<<<<<<<<<<< * * X = array2d(X, dtype=DTYPE, order='C') */ - ((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->warning_flag = 0; + __pyx_v_self->warning_flag = 0; - /* "sklearn/neighbors/ball_tree.pyx":612 + /* "sklearn/neighbors/ball_tree.pyx":614 * self.warning_flag = False * * X = array2d(X, dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * * if X.shape[-1] != self.data.shape[1]: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__array2d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__array2d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __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 = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_X); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_X); __Pyx_GIVEREF(__pyx_v_X); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __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_2)); __pyx_t_2 = 0; @@ -3440,116 +3593,114 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje __pyx_v_X = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":614 + /* "sklearn/neighbors/ball_tree.pyx":616 * X = array2d(X, dtype=DTYPE, order='C') * * if X.shape[-1] != self.data.shape[1]: # <<<<<<<<<<<<<< * raise ValueError("query data dimension must match BallTree " * "data dimension") */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data->dimensions[1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_self->data->dimensions[1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_5) { - /* "sklearn/neighbors/ball_tree.pyx":615 + /* "sklearn/neighbors/ball_tree.pyx":617 * * if X.shape[-1] != self.data.shape[1]: * raise ValueError("query data dimension must match BallTree " # <<<<<<<<<<<<<< * "data dimension") * */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __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[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":618 + /* "sklearn/neighbors/ball_tree.pyx":620 * "data dimension") * * if k > self.data.shape[0]: # <<<<<<<<<<<<<< * raise ValueError("k must be less than or equal " * "to the number of training points") */ - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_self->data->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_k, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_k, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { - /* "sklearn/neighbors/ball_tree.pyx":619 + /* "sklearn/neighbors/ball_tree.pyx":621 * * if k > self.data.shape[0]: * raise ValueError("k must be less than or equal " # <<<<<<<<<<<<<< * "to the number of training points") * */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __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[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; - /* "sklearn/neighbors/ball_tree.pyx":623 + /* "sklearn/neighbors/ball_tree.pyx":625 * * # flatten X for iteration * orig_shape = X.shape # <<<<<<<<<<<<<< * X = X.reshape((-1, X.shape[-1])) * */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_v_orig_shape = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":624 + /* "sklearn/neighbors/ball_tree.pyx":626 * # flatten X for iteration * orig_shape = X.shape * X = X.reshape((-1, X.shape[-1])) # <<<<<<<<<<<<<< * * # for k less than 5, a priority queue is slightly faster */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __Pyx_GIVEREF(__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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __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)); __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 = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 626; __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; @@ -3557,183 +3708,182 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje __pyx_v_X = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/neighbors/ball_tree.pyx":628 + /* "sklearn/neighbors/ball_tree.pyx":630 * # for k less than 5, a priority queue is slightly faster * # for more neighbors, a max-heap implementation is faster * cdef ITYPE_t use_max_heap = (k >= 5) # <<<<<<<<<<<<<< * * cdef ITYPE_t i */ - __pyx_t_2 = PyObject_RichCompare(__pyx_v_k, __pyx_int_5, Py_GE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_k, __pyx_int_5, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_2); if (unlikely((__pyx_t_6 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_use_max_heap = __pyx_t_6; - /* "sklearn/neighbors/ball_tree.pyx":631 + /* "sklearn/neighbors/ball_tree.pyx":633 * * cdef ITYPE_t i * cdef ITYPE_t n_neighbors = k # <<<<<<<<<<<<<< * cdef np.ndarray distances = np.empty((X.shape[0], n_neighbors), * dtype=DTYPE) */ - __pyx_t_6 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_k); if (unlikely((__pyx_t_6 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_k); if (unlikely((__pyx_t_6 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n_neighbors = __pyx_t_6; - /* "sklearn/neighbors/ball_tree.pyx":632 + /* "sklearn/neighbors/ball_tree.pyx":634 * cdef ITYPE_t i * cdef ITYPE_t n_neighbors = k * cdef np.ndarray distances = np.empty((X.shape[0], n_neighbors), # <<<<<<<<<<<<<< * dtype=DTYPE) * cdef np.ndarray idx_array = np.empty((X.shape[0], n_neighbors), */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_n_neighbors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_n_neighbors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - /* "sklearn/neighbors/ball_tree.pyx":633 + /* "sklearn/neighbors/ball_tree.pyx":635 * cdef ITYPE_t n_neighbors = k * cdef np.ndarray distances = np.empty((X.shape[0], n_neighbors), * dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray idx_array = np.empty((X.shape[0], n_neighbors), * dtype=ITYPE) */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __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 = 634; __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; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_distances = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":634 + /* "sklearn/neighbors/ball_tree.pyx":636 * cdef np.ndarray distances = np.empty((X.shape[0], n_neighbors), * dtype=DTYPE) * cdef np.ndarray idx_array = np.empty((X.shape[0], n_neighbors), # <<<<<<<<<<<<<< * dtype=ITYPE) * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_n_neighbors); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(__pyx_v_n_neighbors); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __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[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __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)); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - /* "sklearn/neighbors/ball_tree.pyx":635 + /* "sklearn/neighbors/ball_tree.pyx":637 * dtype=DTYPE) * cdef np.ndarray idx_array = np.empty((X.shape[0], n_neighbors), * dtype=ITYPE) # <<<<<<<<<<<<<< * * # initialize arrays. This is only needed for correct behavior of */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __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 = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __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_4)); __pyx_t_4 = 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 = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_idx_array = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/neighbors/ball_tree.pyx":639 + /* "sklearn/neighbors/ball_tree.pyx":641 * # initialize arrays. This is only needed for correct behavior of * # the warning flag. * distances.fill(-9999) # <<<<<<<<<<<<<< * idx_array.fill(-9999) * */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__fill); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__fill); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/neighbors/ball_tree.pyx":640 + /* "sklearn/neighbors/ball_tree.pyx":642 * # the warning flag. * distances.fill(-9999) * idx_array.fill(-9999) # <<<<<<<<<<<<<< * * cdef np.ndarray Xi */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__fill); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__fill); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/neighbors/ball_tree.pyx":644 + /* "sklearn/neighbors/ball_tree.pyx":646 * cdef np.ndarray Xi * * distances[:] = np.inf # <<<<<<<<<<<<<< * * cdef DTYPE_t* dist_ptr = distances.data */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_v_distances)) { __Pyx_RaiseUnboundLocalError("distances"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_distances), 0, PY_SSIZE_T_MAX, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PySequence_SetSlice(((PyObject *)__pyx_v_distances), 0, PY_SSIZE_T_MAX, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/neighbors/ball_tree.pyx":646 + /* "sklearn/neighbors/ball_tree.pyx":648 * distances[:] = np.inf * * cdef DTYPE_t* dist_ptr = distances.data # <<<<<<<<<<<<<< @@ -3742,7 +3892,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje */ __pyx_v_dist_ptr = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_distances->data); - /* "sklearn/neighbors/ball_tree.pyx":647 + /* "sklearn/neighbors/ball_tree.pyx":649 * * cdef DTYPE_t* dist_ptr = distances.data * cdef ITYPE_t* idx_ptr = idx_array.data # <<<<<<<<<<<<<< @@ -3751,16 +3901,16 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje */ __pyx_v_idx_ptr = ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_idx_array->data); - /* "sklearn/neighbors/ball_tree.pyx":650 + /* "sklearn/neighbors/ball_tree.pyx":652 * * cdef stack node_stack * stack_create(&node_stack, self.n_levels + 1) # <<<<<<<<<<<<<< * * for i, Xi in enumerate(X): */ - __pyx_f_7sklearn_9neighbors_9ball_tree_stack_create((&__pyx_v_node_stack), (((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_levels + 1)); + __pyx_f_7sklearn_9neighbors_9ball_tree_stack_create((&__pyx_v_node_stack), (__pyx_v_self->n_levels + 1)); - /* "sklearn/neighbors/ball_tree.pyx":652 + /* "sklearn/neighbors/ball_tree.pyx":654 * stack_create(&node_stack, self.n_levels + 1) * * for i, Xi in enumerate(X): # <<<<<<<<<<<<<< @@ -3772,45 +3922,53 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje __pyx_t_3 = __pyx_v_X; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_X); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_X); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_3)) { + if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; - } else if (PyTuple_CheckExact(__pyx_t_3)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_2 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_2); } - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_Xi)); __pyx_v_Xi = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; __pyx_v_i = __pyx_t_6; __pyx_t_6 = (__pyx_t_6 + 1); - /* "sklearn/neighbors/ball_tree.pyx":654 + /* "sklearn/neighbors/ball_tree.pyx":656 * for i, Xi in enumerate(X): * self.query_one_(Xi.data, n_neighbors, * dist_ptr, idx_ptr, &node_stack, use_max_heap) # <<<<<<<<<<<<<< * * # if max-heap is used, results must be sorted */ - ((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->__pyx_vtab)->query_one_(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self), ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_Xi->data), __pyx_v_n_neighbors, __pyx_v_dist_ptr, __pyx_v_idx_ptr, (&__pyx_v_node_stack), __pyx_v_use_max_heap); + ((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self->__pyx_vtab)->query_one_(__pyx_v_self, ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_Xi->data), __pyx_v_n_neighbors, __pyx_v_dist_ptr, __pyx_v_idx_ptr, (&__pyx_v_node_stack), __pyx_v_use_max_heap); - /* "sklearn/neighbors/ball_tree.pyx":657 + /* "sklearn/neighbors/ball_tree.pyx":659 * * # if max-heap is used, results must be sorted * if use_max_heap: # <<<<<<<<<<<<<< @@ -3819,7 +3977,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje */ if (__pyx_v_use_max_heap) { - /* "sklearn/neighbors/ball_tree.pyx":658 + /* "sklearn/neighbors/ball_tree.pyx":660 * # if max-heap is used, results must be sorted * if use_max_heap: * sort_dist_idx(dist_ptr, idx_ptr, n_neighbors) # <<<<<<<<<<<<<< @@ -3827,11 +3985,11 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje * dist_ptr += n_neighbors */ __pyx_f_7sklearn_9neighbors_9ball_tree_sort_dist_idx(__pyx_v_dist_ptr, __pyx_v_idx_ptr, __pyx_v_n_neighbors); - goto __pyx_L10; + goto __pyx_L7; } - __pyx_L10:; + __pyx_L7:; - /* "sklearn/neighbors/ball_tree.pyx":660 + /* "sklearn/neighbors/ball_tree.pyx":662 * sort_dist_idx(dist_ptr, idx_ptr, n_neighbors) * * dist_ptr += n_neighbors # <<<<<<<<<<<<<< @@ -3840,7 +3998,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje */ __pyx_v_dist_ptr = (__pyx_v_dist_ptr + __pyx_v_n_neighbors); - /* "sklearn/neighbors/ball_tree.pyx":661 + /* "sklearn/neighbors/ball_tree.pyx":663 * * dist_ptr += n_neighbors * idx_ptr += n_neighbors # <<<<<<<<<<<<<< @@ -3851,7 +4009,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/neighbors/ball_tree.pyx":663 + /* "sklearn/neighbors/ball_tree.pyx":665 * idx_ptr += n_neighbors * * stack_destroy(&node_stack) # <<<<<<<<<<<<<< @@ -3860,17 +4018,17 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_destroy((&__pyx_v_node_stack)); - /* "sklearn/neighbors/ball_tree.pyx":666 + /* "sklearn/neighbors/ball_tree.pyx":668 * * # deflatten results * if return_distance: # <<<<<<<<<<<<<< * return (distances.reshape((orig_shape[:-1]) + (k,)), * idx_array.reshape((orig_shape[:-1]) + (k,))) */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { - /* "sklearn/neighbors/ball_tree.pyx":667 + /* "sklearn/neighbors/ball_tree.pyx":669 * # deflatten results * if return_distance: * return (distances.reshape((orig_shape[:-1]) + (k,)), # <<<<<<<<<<<<<< @@ -3878,60 +4036,60 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje * else: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_k); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); - __pyx_t_1 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __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); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":668 + /* "sklearn/neighbors/ball_tree.pyx":670 * if return_distance: * return (distances.reshape((orig_shape[:-1]) + (k,)), * idx_array.reshape((orig_shape[:-1]) + (k,))) # <<<<<<<<<<<<<< * else: * return idx_array.reshape((orig_shape[:-1]) + (k,)) */ - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_k); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); - __pyx_t_9 = PyNumber_Add(__pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyNumber_Add(__pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __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); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9); @@ -3941,11 +4099,11 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje __pyx_r = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; - goto __pyx_L11; + goto __pyx_L8; } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":670 + /* "sklearn/neighbors/ball_tree.pyx":672 * idx_array.reshape((orig_shape[:-1]) + (k,))) * else: * return idx_array.reshape((orig_shape[:-1]) + (k,)) # <<<<<<<<<<<<<< @@ -3953,25 +4111,25 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje * def query_radius(self, X, r, return_distance=False, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_k); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); - __pyx_t_4 = PyNumber_Add(__pyx_t_9, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_9, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -3979,7 +4137,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje __pyx_t_4 = 0; goto __pyx_L0; } - __pyx_L11:; + __pyx_L8:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -4002,59 +4160,28 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query(PyObje return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":672 - * return idx_array.reshape((orig_shape[:-1]) + (k,)) - * - * def query_radius(self, X, r, return_distance=False, # <<<<<<<<<<<<<< - * count_only=False, sort_results=False): - * """ - */ - -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius[] = "\n query_radius(self, X, r, count_only = False):\n\n query the Ball Tree for neighbors within a ball of size r\n\n Parameters\n ----------\n X : array-like, last dimension self.dim\n An array of points to query\n r : distance within which neighbors are returned\n r can be a single value, or an array of values of shape\n x.shape[:-1] if different radii are desired for each point.\n return_distance : boolean (default = False)\n if True, return distances to neighbors of each point\n if False, return only neighbors\n Note that unlike BallTree.query(), setting return_distance=True\n adds to the computation time. Not all distances need to be\n calculated explicitly for return_distance=False. Results are\n not sorted by default: see ``sort_results`` keyword.\n count_only : boolean (default = False)\n if True, return only the count of points within distance r\n if False, return the indices of all points within distance r\n If return_distance==True, setting count_only=True will\n result in an error.\n sort_results : boolean (default = False)\n if True, the distances and indices will be sorted before being\n returned. If False, the results will not be sorted. If\n return_distance == False, setting sort_results = True will\n result in an error.\n\n Returns\n -------\n count : if count_only == True\n ind : if count_only == False and return_distance == False\n (ind, dist) : if count_only == False and return_distance == True\n\n count : array of integers, shape = X.shape[:-1]\n each entry gives the number of neighbors within\n a distance r of the corresponding point.\n\n ind : array of objects, shape = X.shape[:-1]\n each element is a"" numpy integer array listing the indices of\n neighbors of the corresponding point. Note that unlike\n the results of BallTree.query(), the returned neighbors\n are not sorted by distance\n\n dist : array of objects, shape = X.shape[:-1]\n each element is a numpy double array\n listing the distances corresponding to indices in i.\n\n Examples\n --------\n Query for neighbors in a given radius\n\n >>> import numpy as np\n >>> np.random.seed(0)\n >>> X = np.random.random((10,3)) # 10 points in 3 dimensions\n >>> ball_tree = BallTree(X, leaf_size=2) # doctest: +SKIP\n >>> print ball_tree.query_radius(X[0], r=0.3, count_only=True)\n 3\n >>> ind = ball_tree.query_radius(X[0], r=0.3) # doctest: +SKIP\n >>> print ind # indices of neighbors within distance 0.3\n [3 0 1]\n "; -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_13query_radius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_12query_radius[] = "\n query_radius(self, X, r, count_only = False):\n\n query the Ball Tree for neighbors within a ball of size r\n\n Parameters\n ----------\n X : array-like, last dimension self.dim\n An array of points to query\n r : distance within which neighbors are returned\n r can be a single value, or an array of values of shape\n x.shape[:-1] if different radii are desired for each point.\n return_distance : boolean (default = False)\n if True, return distances to neighbors of each point\n if False, return only neighbors\n Note that unlike BallTree.query(), setting return_distance=True\n adds to the computation time. Not all distances need to be\n calculated explicitly for return_distance=False. Results are\n not sorted by default: see ``sort_results`` keyword.\n count_only : boolean (default = False)\n if True, return only the count of points within distance r\n if False, return the indices of all points within distance r\n If return_distance==True, setting count_only=True will\n result in an error.\n sort_results : boolean (default = False)\n if True, the distances and indices will be sorted before being\n returned. If False, the results will not be sorted. If\n return_distance == False, setting sort_results = True will\n result in an error.\n\n Returns\n -------\n count : if count_only == True\n ind : if count_only == False and return_distance == False\n (ind, dist) : if count_only == False and return_distance == True\n\n count : array of integers, shape = X.shape[:-1]\n each entry gives the number of neighbors within\n a distance r of the corresponding point.\n\n ind : array of objects, shape = X.shape[:-1]\n each element is a"" numpy integer array listing the indices of\n neighbors of the corresponding point. Note that unlike\n the results of BallTree.query(), the returned neighbors\n are not sorted by distance\n\n dist : array of objects, shape = X.shape[:-1]\n each element is a numpy double array\n listing the distances corresponding to indices in i.\n\n Examples\n --------\n Query for neighbors in a given radius\n\n >>> import numpy as np\n >>> np.random.seed(0)\n >>> X = np.random.random((10,3)) # 10 points in 3 dimensions\n >>> ball_tree = BallTree(X, leaf_size=2) # doctest: +SKIP\n >>> print ball_tree.query_radius(X[0], r=0.3, count_only=True)\n 3\n >>> ind = ball_tree.query_radius(X[0], r=0.3) # doctest: +SKIP\n >>> print ind # indices of neighbors within distance 0.3\n [3 0 1]\n "; +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_13query_radius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyObject *__pyx_v_r = 0; PyObject *__pyx_v_return_distance = 0; PyObject *__pyx_v_count_only = 0; PyObject *__pyx_v_sort_results = 0; - PyArrayObject *__pyx_v_idx_array = 0; - PyArrayObject *__pyx_v_idx_array_i = 0; - PyArrayObject *__pyx_v_distances = 0; - PyArrayObject *__pyx_v_distances_i = 0; - PyArrayObject *__pyx_v_pt = 0; - PyArrayObject *__pyx_v_count = 0; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_count_i; - PyObject *__pyx_v_orig_shape = NULL; - struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack __pyx_v_node_stack; - PyObject *__pyx_v_pt_idx = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - Py_ssize_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_t_12; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__r,&__pyx_n_s__return_distance,&__pyx_n_s__count_only,&__pyx_n_s__sort_results,0}; - __Pyx_RefNannySetupContext("query_radius"); + __Pyx_RefNannySetupContext("query_radius (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__r,&__pyx_n_s__return_distance,&__pyx_n_s__count_only,&__pyx_n_s__sort_results,0}; PyObject* values[5] = {0,0,0,0,0}; values[2] = __pyx_k_26; values[3] = __pyx_k_27; values[4] = __pyx_k_28; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -4064,16 +4191,14 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__r); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__r)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("query_radius", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("query_radius", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -4092,7 +4217,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "query_radius") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "query_radius") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4113,57 +4238,99 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("query_radius", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("query_radius", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.neighbors.ball_tree.BallTree.query_radius", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12query_radius(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self), __pyx_v_X, __pyx_v_r, __pyx_v_return_distance, __pyx_v_count_only, __pyx_v_sort_results); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/neighbors/ball_tree.pyx":674 + * return idx_array.reshape((orig_shape[:-1]) + (k,)) + * + * def query_radius(self, X, r, return_distance=False, # <<<<<<<<<<<<<< + * count_only=False, sort_results=False): + * """ + */ + +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12query_radius(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_r, PyObject *__pyx_v_return_distance, PyObject *__pyx_v_count_only, PyObject *__pyx_v_sort_results) { + PyArrayObject *__pyx_v_idx_array = 0; + PyArrayObject *__pyx_v_idx_array_i = 0; + PyArrayObject *__pyx_v_distances = 0; + PyArrayObject *__pyx_v_distances_i = 0; + PyArrayObject *__pyx_v_pt = 0; + PyArrayObject *__pyx_v_count = 0; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_count_i; + PyObject *__pyx_v_orig_shape = NULL; + struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack __pyx_v_node_stack; + PyObject *__pyx_v_pt_idx = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("query_radius", 0); __Pyx_INCREF(__pyx_v_X); __Pyx_INCREF(__pyx_v_r); - /* "sklearn/neighbors/ball_tree.pyx":738 + /* "sklearn/neighbors/ball_tree.pyx":740 * [3 0 1] * """ * if count_only and return_distance: # <<<<<<<<<<<<<< * raise ValueError("count_only and return_distance " * "cannot both be true") */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_count_only); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_count_only); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":739 + /* "sklearn/neighbors/ball_tree.pyx":741 * """ * if count_only and return_distance: * raise ValueError("count_only and return_distance " # <<<<<<<<<<<<<< * "cannot both be true") * */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __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[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":742 + /* "sklearn/neighbors/ball_tree.pyx":744 * "cannot both be true") * * if sort_results and not return_distance: # <<<<<<<<<<<<<< * raise ValueError("return_distance must be True if sort_distances " * "is True") */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_sort_results); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_sort_results); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (!__pyx_t_1); __pyx_t_1 = __pyx_t_2; } else { @@ -4171,44 +4338,44 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius } if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":743 + /* "sklearn/neighbors/ball_tree.pyx":745 * * if sort_results and not return_distance: * raise ValueError("return_distance must be True if sort_distances " # <<<<<<<<<<<<<< * "is True") * */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __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[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; - /* "sklearn/neighbors/ball_tree.pyx":751 + /* "sklearn/neighbors/ball_tree.pyx":753 * * # prepare X for query * X = array2d(X, dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * if X.shape[-1] != self.data.shape[1]: * raise ValueError("query data dimension must match BallTree " */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__array2d); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__array2d); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __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[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_X); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_X); __Pyx_GIVEREF(__pyx_v_X); - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __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 = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 753; __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; @@ -4217,69 +4384,68 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius __pyx_v_X = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/neighbors/ball_tree.pyx":752 + /* "sklearn/neighbors/ball_tree.pyx":754 * # prepare X for query * X = array2d(X, dtype=DTYPE, order='C') * if X.shape[-1] != self.data.shape[1]: # <<<<<<<<<<<<<< * raise ValueError("query data dimension must match BallTree " * "data dimension") */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_7, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data->dimensions[1])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_self->data->dimensions[1])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_NE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __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_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":753 + /* "sklearn/neighbors/ball_tree.pyx":755 * X = array2d(X, dtype=DTYPE, order='C') * if X.shape[-1] != self.data.shape[1]: * raise ValueError("query data dimension must match BallTree " # <<<<<<<<<<<<<< * "data dimension") * */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __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_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L8:; + __pyx_L5:; - /* "sklearn/neighbors/ball_tree.pyx":757 + /* "sklearn/neighbors/ball_tree.pyx":759 * * # prepare r for query * r = np.asarray(r, dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * r = np.atleast_1d(r) * if r.shape == (1,): */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__asarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__asarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __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 = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_r); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_r); __Pyx_GIVEREF(__pyx_v_r); - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -4288,24 +4454,24 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius __pyx_v_r = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":758 + /* "sklearn/neighbors/ball_tree.pyx":760 * # prepare r for query * r = np.asarray(r, dtype=DTYPE, order='C') * r = np.atleast_1d(r) # <<<<<<<<<<<<<< * if r.shape == (1,): * r = r[0] * np.ones(X.shape[:-1], dtype=np.double) */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__atleast_1d); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__atleast_1d); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_r); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_r); __Pyx_GIVEREF(__pyx_v_r); - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -4313,151 +4479,149 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius __pyx_v_r = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/neighbors/ball_tree.pyx":759 + /* "sklearn/neighbors/ball_tree.pyx":761 * r = np.asarray(r, dtype=DTYPE, order='C') * r = np.atleast_1d(r) * if r.shape == (1,): # <<<<<<<<<<<<<< * r = r[0] * np.ones(X.shape[:-1], dtype=np.double) * else: */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_k_tuple_34), Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_k_tuple_34), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":760 + /* "sklearn/neighbors/ball_tree.pyx":762 * r = np.atleast_1d(r) * if r.shape == (1,): * r = r[0] * np.ones(X.shape[:-1], dtype=np.double) # <<<<<<<<<<<<<< * else: * if r.shape != X.shape[:-1]: */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_r, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_r, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ones); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ones); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_t_5, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_t_5, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __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 = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 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 = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__double); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__double); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_v_r); __pyx_v_r = __pyx_t_7; __pyx_t_7 = 0; - goto __pyx_L9; + goto __pyx_L6; } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":762 + /* "sklearn/neighbors/ball_tree.pyx":764 * r = r[0] * np.ones(X.shape[:-1], dtype=np.double) * else: * if r.shape != X.shape[:-1]: # <<<<<<<<<<<<<< * raise ValueError("r must be broadcastable to X.shape") * */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_t_9, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_t_9, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_RichCompare(__pyx_t_7, __pyx_t_4, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_9 = PyObject_RichCompare(__pyx_t_7, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __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[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":763 + /* "sklearn/neighbors/ball_tree.pyx":765 * else: * if r.shape != X.shape[:-1]: * raise ValueError("r must be broadcastable to X.shape") # <<<<<<<<<<<<<< * * # flatten X and r for iteration */ - __pyx_t_9 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L10:; + __pyx_L7:; } - __pyx_L9:; + __pyx_L6:; - /* "sklearn/neighbors/ball_tree.pyx":766 + /* "sklearn/neighbors/ball_tree.pyx":768 * * # flatten X and r for iteration * orig_shape = X.shape # <<<<<<<<<<<<<< * X = X.reshape((-1, X.shape[-1])) * r = r.reshape(-1) */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_v_orig_shape = __pyx_t_9; __pyx_t_9 = 0; - /* "sklearn/neighbors/ball_tree.pyx":767 + /* "sklearn/neighbors/ball_tree.pyx":769 * # flatten X and r for iteration * orig_shape = X.shape * X = X.reshape((-1, X.shape[-1])) # <<<<<<<<<<<<<< * r = r.reshape(-1) * */ - __pyx_t_9 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__reshape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__reshape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_4, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; @@ -4465,77 +4629,77 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius __pyx_v_X = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":768 + /* "sklearn/neighbors/ball_tree.pyx":770 * orig_shape = X.shape * X = X.reshape((-1, X.shape[-1])) * r = r.reshape(-1) # <<<<<<<<<<<<<< * * cdef stack node_stack */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_r, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_r); __pyx_v_r = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/neighbors/ball_tree.pyx":771 + /* "sklearn/neighbors/ball_tree.pyx":773 * * cdef stack node_stack * stack_create(&node_stack, self.n_levels + 1) # <<<<<<<<<<<<<< * * if count_only: */ - __pyx_f_7sklearn_9neighbors_9ball_tree_stack_create((&__pyx_v_node_stack), (((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->n_levels + 1)); + __pyx_f_7sklearn_9neighbors_9ball_tree_stack_create((&__pyx_v_node_stack), (__pyx_v_self->n_levels + 1)); - /* "sklearn/neighbors/ball_tree.pyx":773 + /* "sklearn/neighbors/ball_tree.pyx":775 * stack_create(&node_stack, self.n_levels + 1) * * if count_only: # <<<<<<<<<<<<<< * count = np.zeros(X.shape[0], ITYPE) * for pt_idx, pt in enumerate(X): */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_count_only); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_count_only); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":774 + /* "sklearn/neighbors/ball_tree.pyx":776 * * if count_only: * count = np.zeros(X.shape[0], ITYPE) # <<<<<<<<<<<<<< * for pt_idx, pt in enumerate(X): * count[pt_idx] = self.query_radius_count_(pt.data, */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_7, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_7, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_9 = 0; __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __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; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_count = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/neighbors/ball_tree.pyx":775 + /* "sklearn/neighbors/ball_tree.pyx":777 * if count_only: * count = np.zeros(X.shape[0], ITYPE) * for pt_idx, pt in enumerate(X): # <<<<<<<<<<<<<< @@ -4548,158 +4712,166 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius __pyx_t_5 = __pyx_v_X; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_X); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_X); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_5)) { + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_5)) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; - } else if (PyTuple_CheckExact(__pyx_t_5)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_5)) { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_11(__pyx_t_5); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_4); } - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_pt)); __pyx_v_pt = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_t_7); __Pyx_XDECREF(__pyx_v_pt_idx); __pyx_v_pt_idx = __pyx_t_7; - __pyx_t_4 = PyNumber_Add(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":777 + /* "sklearn/neighbors/ball_tree.pyx":779 * for pt_idx, pt in enumerate(X): * count[pt_idx] = self.query_radius_count_(pt.data, * r[pt_idx], # <<<<<<<<<<<<<< * &node_stack) * elif not return_distance: */ - __pyx_t_4 = PyObject_GetItem(__pyx_v_r, __pyx_v_pt_idx); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_r, __pyx_v_pt_idx); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_12 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_12 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":778 + /* "sklearn/neighbors/ball_tree.pyx":780 * count[pt_idx] = self.query_radius_count_(pt.data, * r[pt_idx], * &node_stack) # <<<<<<<<<<<<<< * elif not return_distance: * idx_array = np.empty(X.shape[0], dtype='object') */ - __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->__pyx_vtab)->query_radius_count_(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self), ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_pt->data), __pyx_t_12, (&__pyx_v_node_stack))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self->__pyx_vtab)->query_radius_count_(__pyx_v_self, ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_pt->data), __pyx_t_12, (&__pyx_v_node_stack))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - /* "sklearn/neighbors/ball_tree.pyx":776 + /* "sklearn/neighbors/ball_tree.pyx":778 * count = np.zeros(X.shape[0], ITYPE) * for pt_idx, pt in enumerate(X): * count[pt_idx] = self.query_radius_count_(pt.data, # <<<<<<<<<<<<<< * r[pt_idx], * &node_stack) */ - if (PyObject_SetItem(((PyObject *)__pyx_v_count), __pyx_v_pt_idx, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_count), __pyx_v_pt_idx, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L11; + goto __pyx_L8; } - /* "sklearn/neighbors/ball_tree.pyx":779 + /* "sklearn/neighbors/ball_tree.pyx":781 * r[pt_idx], * &node_stack) * elif not return_distance: # <<<<<<<<<<<<<< * idx_array = np.empty(X.shape[0], dtype='object') * idx_array_i = np.empty(self.data.shape[0], dtype=ITYPE) */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = (!__pyx_t_1); if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":780 + /* "sklearn/neighbors/ball_tree.pyx":782 * &node_stack) * elif not return_distance: * idx_array = np.empty(X.shape[0], dtype='object') # <<<<<<<<<<<<<< * idx_array_i = np.empty(self.data.shape[0], dtype=ITYPE) * for pt_idx, pt in enumerate(X): */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_7, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_7, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__object)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__object)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_idx_array = ((PyArrayObject *)__pyx_t_9); __pyx_t_9 = 0; - /* "sklearn/neighbors/ball_tree.pyx":781 + /* "sklearn/neighbors/ball_tree.pyx":783 * elif not return_distance: * idx_array = np.empty(X.shape[0], dtype='object') * idx_array_i = np.empty(self.data.shape[0], dtype=ITYPE) # <<<<<<<<<<<<<< * for pt_idx, pt in enumerate(X): * count_i = self.query_radius_idx_only_( */ - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_to_py_Py_intptr_t((((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data->dimensions[0])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_self->data->dimensions[0])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __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[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __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 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __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_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 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 = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_idx_array_i = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/neighbors/ball_tree.pyx":782 + /* "sklearn/neighbors/ball_tree.pyx":784 * idx_array = np.empty(X.shape[0], dtype='object') * idx_array_i = np.empty(self.data.shape[0], dtype=ITYPE) * for pt_idx, pt in enumerate(X): # <<<<<<<<<<<<<< @@ -4712,223 +4884,231 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius __pyx_t_9 = __pyx_v_X; __Pyx_INCREF(__pyx_t_9); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_X); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_X); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_11 = Py_TYPE(__pyx_t_9)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_9)) { + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_9)) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_9)) break; - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; - } else if (PyTuple_CheckExact(__pyx_t_9)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_9)) { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_9)) break; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_7); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_7 = __pyx_t_11(__pyx_t_9); if (unlikely(!__pyx_t_7)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_7); } - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_pt)); __pyx_v_pt = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_5); __Pyx_XDECREF(__pyx_v_pt_idx); __pyx_v_pt_idx = __pyx_t_5; - __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/neighbors/ball_tree.pyx":785 + /* "sklearn/neighbors/ball_tree.pyx":787 * count_i = self.query_radius_idx_only_( * pt.data, * r[pt_idx], # <<<<<<<<<<<<<< * idx_array_i.data, * &node_stack) */ - __pyx_t_7 = PyObject_GetItem(__pyx_v_r, __pyx_v_pt_idx); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetItem(__pyx_v_r, __pyx_v_pt_idx); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_12 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_12 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/neighbors/ball_tree.pyx":787 + /* "sklearn/neighbors/ball_tree.pyx":789 * r[pt_idx], * idx_array_i.data, * &node_stack) # <<<<<<<<<<<<<< * idx_array[pt_idx] = idx_array_i[:count_i].copy() * */ - __pyx_v_count_i = ((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->__pyx_vtab)->query_radius_idx_only_(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self), ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_pt->data), __pyx_t_12, ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_idx_array_i->data), (&__pyx_v_node_stack)); + __pyx_v_count_i = ((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self->__pyx_vtab)->query_radius_idx_only_(__pyx_v_self, ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_pt->data), __pyx_t_12, ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_idx_array_i->data), (&__pyx_v_node_stack)); - /* "sklearn/neighbors/ball_tree.pyx":788 + /* "sklearn/neighbors/ball_tree.pyx":790 * idx_array_i.data, * &node_stack) * idx_array[pt_idx] = idx_array_i[:count_i].copy() # <<<<<<<<<<<<<< * * else: */ - __pyx_t_7 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_idx_array_i), 0, __pyx_v_count_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_idx_array_i), 0, __pyx_v_count_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_idx_array), __pyx_v_pt_idx, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_idx_array), __pyx_v_pt_idx, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - goto __pyx_L11; + goto __pyx_L8; } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":791 + /* "sklearn/neighbors/ball_tree.pyx":793 * * else: * idx_array = np.empty(X.shape[0], dtype='object') # <<<<<<<<<<<<<< * distances = np.empty(X.shape[0], dtype='object') * idx_array_i = np.empty(self.data.shape[0], dtype=ITYPE) */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__object)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_9, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__object)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_idx_array = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":792 + /* "sklearn/neighbors/ball_tree.pyx":794 * else: * idx_array = np.empty(X.shape[0], dtype='object') * distances = np.empty(X.shape[0], dtype='object') # <<<<<<<<<<<<<< * idx_array_i = np.empty(self.data.shape[0], dtype=ITYPE) * distances_i = np.empty(self.data.shape[0], dtype=DTYPE) */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__object)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__object)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __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_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_distances = ((PyArrayObject *)__pyx_t_9); __pyx_t_9 = 0; - /* "sklearn/neighbors/ball_tree.pyx":793 + /* "sklearn/neighbors/ball_tree.pyx":795 * idx_array = np.empty(X.shape[0], dtype='object') * distances = np.empty(X.shape[0], dtype='object') * idx_array_i = np.empty(self.data.shape[0], dtype=ITYPE) # <<<<<<<<<<<<<< * distances_i = np.empty(self.data.shape[0], dtype=DTYPE) * for pt_idx, pt in enumerate(X): */ - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyInt_to_py_Py_intptr_t((((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data->dimensions[0])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_self->data->dimensions[0])); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __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_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_idx_array_i = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/neighbors/ball_tree.pyx":794 + /* "sklearn/neighbors/ball_tree.pyx":796 * distances = np.empty(X.shape[0], dtype='object') * idx_array_i = np.empty(self.data.shape[0], dtype=ITYPE) * distances_i = np.empty(self.data.shape[0], dtype=DTYPE) # <<<<<<<<<<<<<< * for pt_idx, pt in enumerate(X): * count_i = self.query_radius_distances_( */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_self->data->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_9, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_distances_i = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/neighbors/ball_tree.pyx":795 + /* "sklearn/neighbors/ball_tree.pyx":797 * idx_array_i = np.empty(self.data.shape[0], dtype=ITYPE) * distances_i = np.empty(self.data.shape[0], dtype=DTYPE) * for pt_idx, pt in enumerate(X): # <<<<<<<<<<<<<< @@ -4941,73 +5121,81 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius __pyx_t_7 = __pyx_v_X; __Pyx_INCREF(__pyx_t_7); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_X); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_X); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_11 = Py_TYPE(__pyx_t_7)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_7)) { + if (!__pyx_t_11 && PyList_CheckExact(__pyx_t_7)) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_7)) break; - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; - } else if (PyTuple_CheckExact(__pyx_t_7)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_7, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_11 && PyTuple_CheckExact(__pyx_t_7)) { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_7)) break; - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_7, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_4 = __pyx_t_11(__pyx_t_7); if (unlikely(!__pyx_t_4)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_4); } - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_pt)); __pyx_v_pt = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_t_5); __Pyx_XDECREF(__pyx_v_pt_idx); __pyx_v_pt_idx = __pyx_t_5; - __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":798 + /* "sklearn/neighbors/ball_tree.pyx":800 * count_i = self.query_radius_distances_( * pt.data, * r[pt_idx], # <<<<<<<<<<<<<< * idx_array_i.data, * distances_i.data, */ - __pyx_t_4 = PyObject_GetItem(__pyx_v_r, __pyx_v_pt_idx); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetItem(__pyx_v_r, __pyx_v_pt_idx); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_12 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_12 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":801 + /* "sklearn/neighbors/ball_tree.pyx":803 * idx_array_i.data, * distances_i.data, * &node_stack) # <<<<<<<<<<<<<< * if sort_results: * sort_dist_idx(distances_i.data, */ - __pyx_v_count_i = ((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->__pyx_vtab)->query_radius_distances_(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self), ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_pt->data), __pyx_t_12, ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_idx_array_i->data), ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_distances_i->data), (&__pyx_v_node_stack)); + __pyx_v_count_i = ((struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self->__pyx_vtab)->query_radius_distances_(__pyx_v_self, ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_pt->data), __pyx_t_12, ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_idx_array_i->data), ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_distances_i->data), (&__pyx_v_node_stack)); - /* "sklearn/neighbors/ball_tree.pyx":802 + /* "sklearn/neighbors/ball_tree.pyx":804 * distances_i.data, * &node_stack) * if sort_results: # <<<<<<<<<<<<<< * sort_dist_idx(distances_i.data, * idx_array_i.data, */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_sort_results); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_sort_results); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":805 + /* "sklearn/neighbors/ball_tree.pyx":807 * sort_dist_idx(distances_i.data, * idx_array_i.data, * count_i) # <<<<<<<<<<<<<< @@ -5015,52 +5203,52 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius * idx_array[pt_idx] = idx_array_i[:count_i].copy() */ __pyx_f_7sklearn_9neighbors_9ball_tree_sort_dist_idx(((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_distances_i->data), ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_idx_array_i->data), __pyx_v_count_i); - goto __pyx_L18; + goto __pyx_L15; } - __pyx_L18:; + __pyx_L15:; - /* "sklearn/neighbors/ball_tree.pyx":807 + /* "sklearn/neighbors/ball_tree.pyx":809 * count_i) * * idx_array[pt_idx] = idx_array_i[:count_i].copy() # <<<<<<<<<<<<<< * distances[pt_idx] = distances_i[:count_i].copy() * */ - __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_idx_array_i), 0, __pyx_v_count_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_idx_array_i), 0, __pyx_v_count_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__copy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__copy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_idx_array), __pyx_v_pt_idx, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_idx_array), __pyx_v_pt_idx, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/neighbors/ball_tree.pyx":808 + /* "sklearn/neighbors/ball_tree.pyx":810 * * idx_array[pt_idx] = idx_array_i[:count_i].copy() * distances[pt_idx] = distances_i[:count_i].copy() # <<<<<<<<<<<<<< * * stack_destroy(&node_stack) */ - __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_distances_i), 0, __pyx_v_count_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_distances_i), 0, __pyx_v_count_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__copy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__copy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_distances), __pyx_v_pt_idx, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_distances), __pyx_v_pt_idx, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_L11:; + __pyx_L8:; - /* "sklearn/neighbors/ball_tree.pyx":810 + /* "sklearn/neighbors/ball_tree.pyx":812 * distances[pt_idx] = distances_i[:count_i].copy() * * stack_destroy(&node_stack) # <<<<<<<<<<<<<< @@ -5069,17 +5257,17 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_destroy((&__pyx_v_node_stack)); - /* "sklearn/neighbors/ball_tree.pyx":813 + /* "sklearn/neighbors/ball_tree.pyx":815 * * # deflatten results * if count_only: # <<<<<<<<<<<<<< * return count.reshape(orig_shape[:-1]) * elif return_distance: */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_count_only); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_count_only); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":814 + /* "sklearn/neighbors/ball_tree.pyx":816 * # deflatten results * if count_only: * return count.reshape(orig_shape[:-1]) # <<<<<<<<<<<<<< @@ -5087,36 +5275,37 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius * return (idx_array.reshape(orig_shape[:-1]), */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_count)) { __Pyx_RaiseUnboundLocalError("count"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_count), __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_count)) { __Pyx_RaiseUnboundLocalError("count"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_count), __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __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_4)); __pyx_t_4 = 0; __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; - goto __pyx_L19; + goto __pyx_L16; } - /* "sklearn/neighbors/ball_tree.pyx":815 + /* "sklearn/neighbors/ball_tree.pyx":817 * if count_only: * return count.reshape(orig_shape[:-1]) * elif return_distance: # <<<<<<<<<<<<<< * return (idx_array.reshape(orig_shape[:-1]), * distances.reshape(orig_shape[:-1])) */ - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_return_distance); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":816 + /* "sklearn/neighbors/ball_tree.pyx":818 * return count.reshape(orig_shape[:-1]) * elif return_distance: * return (idx_array.reshape(orig_shape[:-1]), # <<<<<<<<<<<<<< @@ -5124,42 +5313,44 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius * else: */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_idx_array)) { __Pyx_RaiseUnboundLocalError("idx_array"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__reshape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_idx_array)) { __Pyx_RaiseUnboundLocalError("idx_array"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__reshape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __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[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (unlikely(!__pyx_v_distances)) { __Pyx_RaiseUnboundLocalError("distances"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/neighbors/ball_tree.pyx":817 + /* "sklearn/neighbors/ball_tree.pyx":819 * elif return_distance: * return (idx_array.reshape(orig_shape[:-1]), * distances.reshape(orig_shape[:-1])) # <<<<<<<<<<<<<< * else: * return idx_array.reshape(orig_shape[:-1]) */ + if (unlikely(!__pyx_v_distances)) { __Pyx_RaiseUnboundLocalError("distances"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_distances), __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __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_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7); @@ -5169,11 +5360,11 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius __pyx_r = ((PyObject *)__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L0; - goto __pyx_L19; + goto __pyx_L16; } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":819 + /* "sklearn/neighbors/ball_tree.pyx":821 * distances.reshape(orig_shape[:-1])) * else: * return idx_array.reshape(orig_shape[:-1]) # <<<<<<<<<<<<<< @@ -5181,16 +5372,17 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius * @cython.cdivision(True) */ __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_idx_array)) { __Pyx_RaiseUnboundLocalError("idx_array"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__reshape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_idx_array)) { __Pyx_RaiseUnboundLocalError("idx_array"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_idx_array), __pyx_n_s__reshape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PySequence_GetSlice(__pyx_v_orig_shape, 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -5198,7 +5390,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius __pyx_t_7 = 0; goto __pyx_L0; } - __pyx_L19:; + __pyx_L16:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -5227,7 +5419,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":822 +/* "sklearn/neighbors/ball_tree.pyx":824 * * @cython.cdivision(True) * cdef void build_tree_(BallTree self): # <<<<<<<<<<<<<< @@ -5255,16 +5447,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo *__pyx_v_parent_info; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_i_max; __Pyx_RefNannyDeclarations - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_4; + __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_t_1; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("build_tree_"); + __Pyx_RefNannySetupContext("build_tree_", 0); - /* "sklearn/neighbors/ball_tree.pyx":823 + /* "sklearn/neighbors/ball_tree.pyx":825 * @cython.cdivision(True) * cdef void build_tree_(BallTree self): * cdef DTYPE_t* data = self.data.data # <<<<<<<<<<<<<< @@ -5273,7 +5466,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_data = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->data->data); - /* "sklearn/neighbors/ball_tree.pyx":824 + /* "sklearn/neighbors/ball_tree.pyx":826 * cdef void build_tree_(BallTree self): * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data # <<<<<<<<<<<<<< @@ -5282,7 +5475,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_idx_array = ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_self->idx_array->data); - /* "sklearn/neighbors/ball_tree.pyx":825 + /* "sklearn/neighbors/ball_tree.pyx":827 * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data # <<<<<<<<<<<<<< @@ -5291,7 +5484,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_centroid_arr = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->node_centroid_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":826 + /* "sklearn/neighbors/ball_tree.pyx":828 * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data * cdef NodeInfo* node_info_arr = self.node_info_arr.data # <<<<<<<<<<<<<< @@ -5300,16 +5493,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info_arr = ((struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo *)__pyx_v_self->node_info_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":828 + /* "sklearn/neighbors/ball_tree.pyx":830 * cdef NodeInfo* node_info_arr = self.node_info_arr.data * * cdef DTYPE_t p = self.p # <<<<<<<<<<<<<< * cdef ITYPE_t n_samples = self.data.shape[0] * cdef ITYPE_t n_features = self.data.shape[1] */ - __pyx_v_p = __pyx_v_self->p; + __pyx_t_1 = __pyx_v_self->p; + __pyx_v_p = __pyx_t_1; - /* "sklearn/neighbors/ball_tree.pyx":829 + /* "sklearn/neighbors/ball_tree.pyx":831 * * cdef DTYPE_t p = self.p * cdef ITYPE_t n_samples = self.data.shape[0] # <<<<<<<<<<<<<< @@ -5318,7 +5512,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_n_samples = (__pyx_v_self->data->dimensions[0]); - /* "sklearn/neighbors/ball_tree.pyx":830 + /* "sklearn/neighbors/ball_tree.pyx":832 * cdef DTYPE_t p = self.p * cdef ITYPE_t n_samples = self.data.shape[0] * cdef ITYPE_t n_features = self.data.shape[1] # <<<<<<<<<<<<<< @@ -5327,7 +5521,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_n_features = (__pyx_v_self->data->dimensions[1]); - /* "sklearn/neighbors/ball_tree.pyx":836 + /* "sklearn/neighbors/ball_tree.pyx":838 * cdef ITYPE_t i, i_node, i_parent * * cdef DTYPE_t* centroid = node_centroid_arr # <<<<<<<<<<<<<< @@ -5336,7 +5530,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_centroid = __pyx_v_node_centroid_arr; - /* "sklearn/neighbors/ball_tree.pyx":837 + /* "sklearn/neighbors/ball_tree.pyx":839 * * cdef DTYPE_t* centroid = node_centroid_arr * cdef NodeInfo* node_info = node_info_arr # <<<<<<<<<<<<<< @@ -5345,7 +5539,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info = __pyx_v_node_info_arr; - /* "sklearn/neighbors/ball_tree.pyx":843 + /* "sklearn/neighbors/ball_tree.pyx":845 * #------------------------------------------------------------ * # take care of the root node * node_info.idx_start = 0 # <<<<<<<<<<<<<< @@ -5354,7 +5548,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info->idx_start = 0; - /* "sklearn/neighbors/ball_tree.pyx":844 + /* "sklearn/neighbors/ball_tree.pyx":846 * # take care of the root node * node_info.idx_start = 0 * node_info.idx_end = n_samples # <<<<<<<<<<<<<< @@ -5363,7 +5557,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info->idx_end = __pyx_v_n_samples; - /* "sklearn/neighbors/ball_tree.pyx":845 + /* "sklearn/neighbors/ball_tree.pyx":847 * node_info.idx_start = 0 * node_info.idx_end = n_samples * n_points = n_samples # <<<<<<<<<<<<<< @@ -5372,7 +5566,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_n_points = __pyx_v_n_samples; - /* "sklearn/neighbors/ball_tree.pyx":849 + /* "sklearn/neighbors/ball_tree.pyx":851 * # determine Node centroid * compute_centroid(centroid, data, idx_array, * n_features, n_samples) # <<<<<<<<<<<<<< @@ -5381,7 +5575,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_v_centroid, __pyx_v_data, __pyx_v_idx_array, __pyx_v_n_features, __pyx_v_n_samples); - /* "sklearn/neighbors/ball_tree.pyx":852 + /* "sklearn/neighbors/ball_tree.pyx":854 * * # determine Node radius * radius = 0 # <<<<<<<<<<<<<< @@ -5390,17 +5584,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_radius = 0.0; - /* "sklearn/neighbors/ball_tree.pyx":853 + /* "sklearn/neighbors/ball_tree.pyx":855 * # determine Node radius * radius = 0 * for i from node_info.idx_start <= i < node_info.idx_end: # <<<<<<<<<<<<<< * radius = dmax(radius, * dist_p(centroid, data + n_features * idx_array[i], */ - __pyx_t_1 = __pyx_v_node_info->idx_end; - for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { + __pyx_t_2 = __pyx_v_node_info->idx_end; + for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":856 + /* "sklearn/neighbors/ball_tree.pyx":858 * radius = dmax(radius, * dist_p(centroid, data + n_features * idx_array[i], * n_features, p)) # <<<<<<<<<<<<<< @@ -5410,7 +5604,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct __pyx_v_radius = __pyx_f_7sklearn_9neighbors_9ball_tree_dmax(__pyx_v_radius, __pyx_f_7sklearn_9neighbors_9ball_tree_dist_p(__pyx_v_centroid, (__pyx_v_data + (__pyx_v_n_features * (__pyx_v_idx_array[__pyx_v_i]))), __pyx_v_n_features, __pyx_v_p)); } - /* "sklearn/neighbors/ball_tree.pyx":857 + /* "sklearn/neighbors/ball_tree.pyx":859 * dist_p(centroid, data + n_features * idx_array[i], * n_features, p)) * node_info.radius = dist_from_dist_p(radius, p) # <<<<<<<<<<<<<< @@ -5419,17 +5613,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info->radius = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_from_dist_p(__pyx_v_radius, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":860 + /* "sklearn/neighbors/ball_tree.pyx":862 * * # check if this is a leaf * if self.n_nodes == 1: # <<<<<<<<<<<<<< * node_info.is_leaf = 1 * */ - __pyx_t_2 = (__pyx_v_self->n_nodes == 1); - if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_self->n_nodes == 1); + if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":861 + /* "sklearn/neighbors/ball_tree.pyx":863 * # check if this is a leaf * if self.n_nodes == 1: * node_info.is_leaf = 1 # <<<<<<<<<<<<<< @@ -5441,7 +5635,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":864 + /* "sklearn/neighbors/ball_tree.pyx":866 * * else: * node_info.is_leaf = 0 # <<<<<<<<<<<<<< @@ -5450,7 +5644,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info->is_leaf = 0; - /* "sklearn/neighbors/ball_tree.pyx":868 + /* "sklearn/neighbors/ball_tree.pyx":870 * # find dimension with largest spread * i_max = find_split_dim(data, idx_array + node_info.idx_start, * n_features, n_points) # <<<<<<<<<<<<<< @@ -5459,7 +5653,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_i_max = __pyx_f_7sklearn_9neighbors_9ball_tree_find_split_dim(__pyx_v_data, (__pyx_v_idx_array + __pyx_v_node_info->idx_start), __pyx_v_n_features, __pyx_v_n_points); - /* "sklearn/neighbors/ball_tree.pyx":876 + /* "sklearn/neighbors/ball_tree.pyx":878 * n_points / 2, * n_features, * n_points) # <<<<<<<<<<<<<< @@ -5470,17 +5664,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct } __pyx_L5:; - /* "sklearn/neighbors/ball_tree.pyx":880 + /* "sklearn/neighbors/ball_tree.pyx":882 * #------------------------------------------------------------ * # cycle through all child nodes * for i_node from 1 <= i_node < self.n_nodes: # <<<<<<<<<<<<<< * i_parent = (i_node - 1) / 2 * parent_info = node_info_arr + i_parent */ - __pyx_t_1 = __pyx_v_self->n_nodes; - for (__pyx_v_i_node = 1; __pyx_v_i_node < __pyx_t_1; __pyx_v_i_node++) { + __pyx_t_2 = __pyx_v_self->n_nodes; + for (__pyx_v_i_node = 1; __pyx_v_i_node < __pyx_t_2; __pyx_v_i_node++) { - /* "sklearn/neighbors/ball_tree.pyx":881 + /* "sklearn/neighbors/ball_tree.pyx":883 * # cycle through all child nodes * for i_node from 1 <= i_node < self.n_nodes: * i_parent = (i_node - 1) / 2 # <<<<<<<<<<<<<< @@ -5489,7 +5683,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_i_parent = ((__pyx_v_i_node - 1) / 2); - /* "sklearn/neighbors/ball_tree.pyx":882 + /* "sklearn/neighbors/ball_tree.pyx":884 * for i_node from 1 <= i_node < self.n_nodes: * i_parent = (i_node - 1) / 2 * parent_info = node_info_arr + i_parent # <<<<<<<<<<<<<< @@ -5498,7 +5692,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_parent_info = (__pyx_v_node_info_arr + __pyx_v_i_parent); - /* "sklearn/neighbors/ball_tree.pyx":884 + /* "sklearn/neighbors/ball_tree.pyx":886 * parent_info = node_info_arr + i_parent * * node_info = node_info_arr + i_node # <<<<<<<<<<<<<< @@ -5507,7 +5701,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info = (__pyx_v_node_info_arr + __pyx_v_i_node); - /* "sklearn/neighbors/ball_tree.pyx":886 + /* "sklearn/neighbors/ball_tree.pyx":888 * node_info = node_info_arr + i_node * * if parent_info.is_leaf: # <<<<<<<<<<<<<< @@ -5516,33 +5710,33 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ if (__pyx_v_parent_info->is_leaf) { - /* "sklearn/neighbors/ball_tree.pyx":887 + /* "sklearn/neighbors/ball_tree.pyx":889 * * if parent_info.is_leaf: * raise ValueError("Fatal: parent is a leaf. Memory " # <<<<<<<<<<<<<< * "allocation is flawed") * */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __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[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __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[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; - /* "sklearn/neighbors/ball_tree.pyx":890 + /* "sklearn/neighbors/ball_tree.pyx":892 * "allocation is flawed") * * if i_node < self.n_nodes / 2: # <<<<<<<<<<<<<< * node_info.is_leaf = 0 * else: */ - __pyx_t_2 = (__pyx_v_i_node < (__pyx_v_self->n_nodes / 2)); - if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_i_node < (__pyx_v_self->n_nodes / 2)); + if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":891 + /* "sklearn/neighbors/ball_tree.pyx":893 * * if i_node < self.n_nodes / 2: * node_info.is_leaf = 0 # <<<<<<<<<<<<<< @@ -5554,7 +5748,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":893 + /* "sklearn/neighbors/ball_tree.pyx":895 * node_info.is_leaf = 0 * else: * node_info.is_leaf = 1 # <<<<<<<<<<<<<< @@ -5565,7 +5759,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct } __pyx_L9:; - /* "sklearn/neighbors/ball_tree.pyx":895 + /* "sklearn/neighbors/ball_tree.pyx":897 * node_info.is_leaf = 1 * * centroid = node_centroid_arr + i_node * n_features # <<<<<<<<<<<<<< @@ -5574,35 +5768,37 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_centroid = (__pyx_v_node_centroid_arr + (__pyx_v_i_node * __pyx_v_n_features)); - /* "sklearn/neighbors/ball_tree.pyx":898 + /* "sklearn/neighbors/ball_tree.pyx":900 * * # find indices for this node * idx_start = parent_info.idx_start # <<<<<<<<<<<<<< * idx_end = parent_info.idx_end * */ - __pyx_v_idx_start = __pyx_v_parent_info->idx_start; + __pyx_t_5 = __pyx_v_parent_info->idx_start; + __pyx_v_idx_start = __pyx_t_5; - /* "sklearn/neighbors/ball_tree.pyx":899 + /* "sklearn/neighbors/ball_tree.pyx":901 * # find indices for this node * idx_start = parent_info.idx_start * idx_end = parent_info.idx_end # <<<<<<<<<<<<<< * * if i_node % 2 == 1: */ - __pyx_v_idx_end = __pyx_v_parent_info->idx_end; + __pyx_t_5 = __pyx_v_parent_info->idx_end; + __pyx_v_idx_end = __pyx_t_5; - /* "sklearn/neighbors/ball_tree.pyx":901 + /* "sklearn/neighbors/ball_tree.pyx":903 * idx_end = parent_info.idx_end * * if i_node % 2 == 1: # <<<<<<<<<<<<<< * idx_start = (idx_start + idx_end) / 2 * else: */ - __pyx_t_2 = ((__pyx_v_i_node % 2) == 1); - if (__pyx_t_2) { + __pyx_t_3 = ((__pyx_v_i_node % 2) == 1); + if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":902 + /* "sklearn/neighbors/ball_tree.pyx":904 * * if i_node % 2 == 1: * idx_start = (idx_start + idx_end) / 2 # <<<<<<<<<<<<<< @@ -5614,7 +5810,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":904 + /* "sklearn/neighbors/ball_tree.pyx":906 * idx_start = (idx_start + idx_end) / 2 * else: * idx_end = (idx_start + idx_end) / 2 # <<<<<<<<<<<<<< @@ -5625,7 +5821,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct } __pyx_L10:; - /* "sklearn/neighbors/ball_tree.pyx":906 + /* "sklearn/neighbors/ball_tree.pyx":908 * idx_end = (idx_start + idx_end) / 2 * * node_info.idx_start = idx_start # <<<<<<<<<<<<<< @@ -5634,7 +5830,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info->idx_start = __pyx_v_idx_start; - /* "sklearn/neighbors/ball_tree.pyx":907 + /* "sklearn/neighbors/ball_tree.pyx":909 * * node_info.idx_start = idx_start * node_info.idx_end = idx_end # <<<<<<<<<<<<<< @@ -5643,7 +5839,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info->idx_end = __pyx_v_idx_end; - /* "sklearn/neighbors/ball_tree.pyx":909 + /* "sklearn/neighbors/ball_tree.pyx":911 * node_info.idx_end = idx_end * * n_points = idx_end - idx_start # <<<<<<<<<<<<<< @@ -5652,7 +5848,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_n_points = (__pyx_v_idx_end - __pyx_v_idx_start); - /* "sklearn/neighbors/ball_tree.pyx":914 + /* "sklearn/neighbors/ball_tree.pyx":916 * raise ValueError("zero-sized node") * * elif n_points == 1: # <<<<<<<<<<<<<< @@ -5661,7 +5857,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ switch (__pyx_v_n_points) { - /* "sklearn/neighbors/ball_tree.pyx":911 + /* "sklearn/neighbors/ball_tree.pyx":913 * n_points = idx_end - idx_start * * if n_points == 0: # <<<<<<<<<<<<<< @@ -5670,21 +5866,21 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ case 0: - /* "sklearn/neighbors/ball_tree.pyx":912 + /* "sklearn/neighbors/ball_tree.pyx":914 * * if n_points == 0: * raise ValueError("zero-sized node") # <<<<<<<<<<<<<< * * elif n_points == 1: */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __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[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __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[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; - /* "sklearn/neighbors/ball_tree.pyx":914 + /* "sklearn/neighbors/ball_tree.pyx":916 * raise ValueError("zero-sized node") * * elif n_points == 1: # <<<<<<<<<<<<<< @@ -5693,7 +5889,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ case 1: - /* "sklearn/neighbors/ball_tree.pyx":918 + /* "sklearn/neighbors/ball_tree.pyx":920 * copy_array(centroid, * data + idx_array[idx_start] * n_features, * n_features) # <<<<<<<<<<<<<< @@ -5702,7 +5898,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_f_7sklearn_9neighbors_9ball_tree_copy_array(__pyx_v_centroid, (__pyx_v_data + ((__pyx_v_idx_array[__pyx_v_idx_start]) * __pyx_v_n_features)), __pyx_v_n_features); - /* "sklearn/neighbors/ball_tree.pyx":921 + /* "sklearn/neighbors/ball_tree.pyx":923 * * #store radius in array * node_info.radius = 0 # <<<<<<<<<<<<<< @@ -5711,7 +5907,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info->radius = 0.0; - /* "sklearn/neighbors/ball_tree.pyx":924 + /* "sklearn/neighbors/ball_tree.pyx":926 * * #is a leaf * node_info.is_leaf = 1 # <<<<<<<<<<<<<< @@ -5722,7 +5918,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct break; default: - /* "sklearn/neighbors/ball_tree.pyx":929 + /* "sklearn/neighbors/ball_tree.pyx":931 * # determine Node centroid * compute_centroid(centroid, data, idx_array + idx_start, * n_features, n_points) # <<<<<<<<<<<<<< @@ -5731,7 +5927,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_v_centroid, __pyx_v_data, (__pyx_v_idx_array + __pyx_v_idx_start), __pyx_v_n_features, __pyx_v_n_points); - /* "sklearn/neighbors/ball_tree.pyx":932 + /* "sklearn/neighbors/ball_tree.pyx":934 * * # determine Node radius * radius = 0 # <<<<<<<<<<<<<< @@ -5740,17 +5936,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_radius = 0.0; - /* "sklearn/neighbors/ball_tree.pyx":933 + /* "sklearn/neighbors/ball_tree.pyx":935 * # determine Node radius * radius = 0 * for i from idx_start <= i < idx_end: # <<<<<<<<<<<<<< * radius = dmax(radius, * dist_p(centroid, */ - __pyx_t_4 = __pyx_v_idx_end; - for (__pyx_v_i = __pyx_v_idx_start; __pyx_v_i < __pyx_t_4; __pyx_v_i++) { + __pyx_t_5 = __pyx_v_idx_end; + for (__pyx_v_i = __pyx_v_idx_start; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":937 + /* "sklearn/neighbors/ball_tree.pyx":939 * dist_p(centroid, * data + n_features * idx_array[i], * n_features, p)) # <<<<<<<<<<<<<< @@ -5760,7 +5956,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct __pyx_v_radius = __pyx_f_7sklearn_9neighbors_9ball_tree_dmax(__pyx_v_radius, __pyx_f_7sklearn_9neighbors_9ball_tree_dist_p(__pyx_v_centroid, (__pyx_v_data + (__pyx_v_n_features * (__pyx_v_idx_array[__pyx_v_i]))), __pyx_v_n_features, __pyx_v_p)); } - /* "sklearn/neighbors/ball_tree.pyx":938 + /* "sklearn/neighbors/ball_tree.pyx":940 * data + n_features * idx_array[i], * n_features, p)) * node_info.radius = dist_from_dist_p(radius, p) # <<<<<<<<<<<<<< @@ -5769,17 +5965,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_node_info->radius = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_from_dist_p(__pyx_v_radius, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":940 + /* "sklearn/neighbors/ball_tree.pyx":942 * node_info.radius = dist_from_dist_p(radius, p) * * if not node_info.is_leaf: # <<<<<<<<<<<<<< * # find dimension with largest spread * i_max = find_split_dim(data, idx_array + idx_start, */ - __pyx_t_2 = (!__pyx_v_node_info->is_leaf); - if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_node_info->is_leaf); + if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":943 + /* "sklearn/neighbors/ball_tree.pyx":945 * # find dimension with largest spread * i_max = find_split_dim(data, idx_array + idx_start, * n_features, n_points) # <<<<<<<<<<<<<< @@ -5788,7 +5984,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct */ __pyx_v_i_max = __pyx_f_7sklearn_9neighbors_9ball_tree_find_split_dim(__pyx_v_data, (__pyx_v_idx_array + __pyx_v_idx_start), __pyx_v_n_features, __pyx_v_n_points); - /* "sklearn/neighbors/ball_tree.pyx":951 + /* "sklearn/neighbors/ball_tree.pyx":953 * n_points / 2, * n_features, * n_points) # <<<<<<<<<<<<<< @@ -5805,13 +6001,13 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_build_tree_(struct goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("sklearn.neighbors.ball_tree.BallTree.build_tree_", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":953 +/* "sklearn/neighbors/ball_tree.pyx":955 * n_points) * * cdef void query_one_(BallTree self, # <<<<<<<<<<<<<< @@ -5842,11 +6038,12 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t (*__pyx_v_heapqueue_idx_largest)(__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t); void (*__pyx_v_heapqueue_insert)(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t); __Pyx_RefNannyDeclarations - int __pyx_t_1; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; - __Pyx_RefNannySetupContext("query_one_"); + __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_t_1; + int __pyx_t_2; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_3; + __Pyx_RefNannySetupContext("query_one_", 0); - /* "sklearn/neighbors/ball_tree.pyx":960 + /* "sklearn/neighbors/ball_tree.pyx":962 * stack* node_stack, * ITYPE_t use_max_heap): * cdef DTYPE_t* data = self.data.data # <<<<<<<<<<<<<< @@ -5855,7 +6052,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_data = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->data->data); - /* "sklearn/neighbors/ball_tree.pyx":961 + /* "sklearn/neighbors/ball_tree.pyx":963 * ITYPE_t use_max_heap): * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data # <<<<<<<<<<<<<< @@ -5864,7 +6061,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_idx_array = ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_self->idx_array->data); - /* "sklearn/neighbors/ball_tree.pyx":962 + /* "sklearn/neighbors/ball_tree.pyx":964 * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data # <<<<<<<<<<<<<< @@ -5873,7 +6070,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_node_centroid_arr = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->node_centroid_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":963 + /* "sklearn/neighbors/ball_tree.pyx":965 * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data * cdef NodeInfo* node_info_arr = self.node_info_arr.data # <<<<<<<<<<<<<< @@ -5882,7 +6079,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_node_info_arr = ((struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo *)__pyx_v_self->node_info_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":964 + /* "sklearn/neighbors/ball_tree.pyx":966 * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data * cdef NodeInfo* node_info_arr = self.node_info_arr.data * cdef NodeInfo* node_info = node_info_arr # <<<<<<<<<<<<<< @@ -5891,16 +6088,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_node_info = __pyx_v_node_info_arr; - /* "sklearn/neighbors/ball_tree.pyx":966 + /* "sklearn/neighbors/ball_tree.pyx":968 * cdef NodeInfo* node_info = node_info_arr * * cdef DTYPE_t p = self.p # <<<<<<<<<<<<<< * cdef ITYPE_t n_features = self.data.shape[1] * */ - __pyx_v_p = __pyx_v_self->p; + __pyx_t_1 = __pyx_v_self->p; + __pyx_v_p = __pyx_t_1; - /* "sklearn/neighbors/ball_tree.pyx":967 + /* "sklearn/neighbors/ball_tree.pyx":969 * * cdef DTYPE_t p = self.p * cdef ITYPE_t n_features = self.data.shape[1] # <<<<<<<<<<<<<< @@ -5909,7 +6107,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_n_features = (__pyx_v_self->data->dimensions[1]); - /* "sklearn/neighbors/ball_tree.pyx":977 + /* "sklearn/neighbors/ball_tree.pyx":979 * # the end of the tree traversal, this index is in the last position, * # then the warning flag will be set. * cdef ITYPE_t check_index = -1 # <<<<<<<<<<<<<< @@ -5918,7 +6116,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_check_index = -1; - /* "sklearn/neighbors/ball_tree.pyx":979 + /* "sklearn/neighbors/ball_tree.pyx":981 * cdef ITYPE_t check_index = -1 * * item.i_node = 0 # <<<<<<<<<<<<<< @@ -5927,7 +6125,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.i_node = 0; - /* "sklearn/neighbors/ball_tree.pyx":980 + /* "sklearn/neighbors/ball_tree.pyx":982 * * item.i_node = 0 * item.dist_p_LB = calc_dist_p_LB(pt, node_centroid_arr, # <<<<<<<<<<<<<< @@ -5936,7 +6134,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.dist_p_LB = __pyx_f_7sklearn_9neighbors_9ball_tree_calc_dist_p_LB(__pyx_v_pt, __pyx_v_node_centroid_arr, __pyx_v_node_info->radius, __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":983 + /* "sklearn/neighbors/ball_tree.pyx":985 * node_info.radius, * n_features, p) * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -5945,7 +6143,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(__pyx_v_node_stack, __pyx_v_item); - /* "sklearn/neighbors/ball_tree.pyx":992 + /* "sklearn/neighbors/ball_tree.pyx":994 * ITYPE_t*, ITYPE_t) * * if use_max_heap: # <<<<<<<<<<<<<< @@ -5954,7 +6152,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ if (__pyx_v_use_max_heap) { - /* "sklearn/neighbors/ball_tree.pyx":993 + /* "sklearn/neighbors/ball_tree.pyx":995 * * if use_max_heap: * heapqueue_largest = &max_heap_largest # <<<<<<<<<<<<<< @@ -5963,7 +6161,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_heapqueue_largest = (&__pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_largest); - /* "sklearn/neighbors/ball_tree.pyx":994 + /* "sklearn/neighbors/ball_tree.pyx":996 * if use_max_heap: * heapqueue_largest = &max_heap_largest * heapqueue_idx_largest = &max_heap_idx_largest # <<<<<<<<<<<<<< @@ -5972,7 +6170,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_heapqueue_idx_largest = (&__pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_idx_largest); - /* "sklearn/neighbors/ball_tree.pyx":995 + /* "sklearn/neighbors/ball_tree.pyx":997 * heapqueue_largest = &max_heap_largest * heapqueue_idx_largest = &max_heap_idx_largest * heapqueue_insert = &max_heap_insert # <<<<<<<<<<<<<< @@ -5984,7 +6182,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":997 + /* "sklearn/neighbors/ball_tree.pyx":999 * heapqueue_insert = &max_heap_insert * else: * heapqueue_largest = &pqueue_largest # <<<<<<<<<<<<<< @@ -5993,7 +6191,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_heapqueue_largest = (&__pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_largest); - /* "sklearn/neighbors/ball_tree.pyx":998 + /* "sklearn/neighbors/ball_tree.pyx":1000 * else: * heapqueue_largest = &pqueue_largest * heapqueue_idx_largest = &pqueue_idx_largest # <<<<<<<<<<<<<< @@ -6002,7 +6200,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_heapqueue_idx_largest = (&__pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_idx_largest); - /* "sklearn/neighbors/ball_tree.pyx":999 + /* "sklearn/neighbors/ball_tree.pyx":1001 * heapqueue_largest = &pqueue_largest * heapqueue_idx_largest = &pqueue_idx_largest * heapqueue_insert = &pqueue_insert # <<<<<<<<<<<<<< @@ -6013,7 +6211,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ } __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":1001 + /* "sklearn/neighbors/ball_tree.pyx":1003 * heapqueue_insert = &pqueue_insert * * while(node_stack.n > 0): # <<<<<<<<<<<<<< @@ -6021,10 +6219,10 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ * i_node = item.i_node */ while (1) { - __pyx_t_1 = (__pyx_v_node_stack->n > 0); - if (!__pyx_t_1) break; + __pyx_t_2 = (__pyx_v_node_stack->n > 0); + if (!__pyx_t_2) break; - /* "sklearn/neighbors/ball_tree.pyx":1002 + /* "sklearn/neighbors/ball_tree.pyx":1004 * * while(node_stack.n > 0): * item = stack_pop(node_stack) # <<<<<<<<<<<<<< @@ -6033,25 +6231,27 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item = __pyx_f_7sklearn_9neighbors_9ball_tree_stack_pop(__pyx_v_node_stack); - /* "sklearn/neighbors/ball_tree.pyx":1003 + /* "sklearn/neighbors/ball_tree.pyx":1005 * while(node_stack.n > 0): * item = stack_pop(node_stack) * i_node = item.i_node # <<<<<<<<<<<<<< * dist_p_LB = item.dist_p_LB * */ - __pyx_v_i_node = __pyx_v_item.i_node; + __pyx_t_3 = __pyx_v_item.i_node; + __pyx_v_i_node = __pyx_t_3; - /* "sklearn/neighbors/ball_tree.pyx":1004 + /* "sklearn/neighbors/ball_tree.pyx":1006 * item = stack_pop(node_stack) * i_node = item.i_node * dist_p_LB = item.dist_p_LB # <<<<<<<<<<<<<< * * node_info = node_info_arr + i_node */ - __pyx_v_dist_p_LB = __pyx_v_item.dist_p_LB; + __pyx_t_1 = __pyx_v_item.dist_p_LB; + __pyx_v_dist_p_LB = __pyx_t_1; - /* "sklearn/neighbors/ball_tree.pyx":1006 + /* "sklearn/neighbors/ball_tree.pyx":1008 * dist_p_LB = item.dist_p_LB * * node_info = node_info_arr + i_node # <<<<<<<<<<<<<< @@ -6060,17 +6260,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_node_info = (__pyx_v_node_info_arr + __pyx_v_i_node); - /* "sklearn/neighbors/ball_tree.pyx":1011 + /* "sklearn/neighbors/ball_tree.pyx":1013 * # Case 0: query point is exactly on the boundary. Set * # warning flag * if dist_p_LB == heapqueue_largest(near_set_dist, k): # <<<<<<<<<<<<<< * # store index of point with same distance: * # we'll check it later */ - __pyx_t_1 = (__pyx_v_dist_p_LB == __pyx_v_heapqueue_largest(__pyx_v_near_set_dist, __pyx_v_k)); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dist_p_LB == __pyx_v_heapqueue_largest(__pyx_v_near_set_dist, __pyx_v_k)); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1014 + /* "sklearn/neighbors/ball_tree.pyx":1016 * # store index of point with same distance: * # we'll check it later * check_index = heapqueue_idx_largest(near_set_indx, k) # <<<<<<<<<<<<<< @@ -6079,7 +6279,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_check_index = __pyx_v_heapqueue_idx_largest(__pyx_v_near_set_indx, __pyx_v_k); - /* "sklearn/neighbors/ball_tree.pyx":1015 + /* "sklearn/neighbors/ball_tree.pyx":1017 * # we'll check it later * check_index = heapqueue_idx_largest(near_set_indx, k) * continue # <<<<<<<<<<<<<< @@ -6090,17 +6290,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ goto __pyx_L6; } - /* "sklearn/neighbors/ball_tree.pyx":1019 + /* "sklearn/neighbors/ball_tree.pyx":1021 * #------------------------------------------------------------ * # Case 1: query point is outside node radius * elif dist_p_LB > heapqueue_largest(near_set_dist, k): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_1 = (__pyx_v_dist_p_LB > __pyx_v_heapqueue_largest(__pyx_v_near_set_dist, __pyx_v_k)); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dist_p_LB > __pyx_v_heapqueue_largest(__pyx_v_near_set_dist, __pyx_v_k)); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1020 + /* "sklearn/neighbors/ball_tree.pyx":1022 * # Case 1: query point is outside node radius * elif dist_p_LB > heapqueue_largest(near_set_dist, k): * continue # <<<<<<<<<<<<<< @@ -6111,7 +6311,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ goto __pyx_L6; } - /* "sklearn/neighbors/ball_tree.pyx":1024 + /* "sklearn/neighbors/ball_tree.pyx":1026 * #------------------------------------------------------------ * # Case 2: this is a leaf node. Update set of nearby points * elif node_info.is_leaf: # <<<<<<<<<<<<<< @@ -6120,17 +6320,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ if (__pyx_v_node_info->is_leaf) { - /* "sklearn/neighbors/ball_tree.pyx":1025 + /* "sklearn/neighbors/ball_tree.pyx":1027 * # Case 2: this is a leaf node. Update set of nearby points * elif node_info.is_leaf: * for i from node_info.idx_start <= i < node_info.idx_end: # <<<<<<<<<<<<<< * dist_pt = dist_p(pt, * data + n_features * idx_array[i], */ - __pyx_t_2 = __pyx_v_node_info->idx_end; - for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + __pyx_t_3 = __pyx_v_node_info->idx_end; + for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1028 + /* "sklearn/neighbors/ball_tree.pyx":1030 * dist_pt = dist_p(pt, * data + n_features * idx_array[i], * n_features, p) # <<<<<<<<<<<<<< @@ -6139,7 +6339,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_dist_pt = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_p(__pyx_v_pt, (__pyx_v_data + (__pyx_v_n_features * (__pyx_v_idx_array[__pyx_v_i]))), __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1030 + /* "sklearn/neighbors/ball_tree.pyx":1032 * n_features, p) * * dmax = heapqueue_largest(near_set_dist, k) # <<<<<<<<<<<<<< @@ -6148,17 +6348,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_dmax = __pyx_v_heapqueue_largest(__pyx_v_near_set_dist, __pyx_v_k); - /* "sklearn/neighbors/ball_tree.pyx":1032 + /* "sklearn/neighbors/ball_tree.pyx":1034 * dmax = heapqueue_largest(near_set_dist, k) * * if dist_pt == dmax: # <<<<<<<<<<<<<< * check_index = heapqueue_idx_largest(near_set_indx, k) * */ - __pyx_t_1 = (__pyx_v_dist_pt == __pyx_v_dmax); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dist_pt == __pyx_v_dmax); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1033 + /* "sklearn/neighbors/ball_tree.pyx":1035 * * if dist_pt == dmax: * check_index = heapqueue_idx_largest(near_set_indx, k) # <<<<<<<<<<<<<< @@ -6169,17 +6369,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ goto __pyx_L9; } - /* "sklearn/neighbors/ball_tree.pyx":1035 + /* "sklearn/neighbors/ball_tree.pyx":1037 * check_index = heapqueue_idx_largest(near_set_indx, k) * * elif dist_pt < dmax: # <<<<<<<<<<<<<< * heapqueue_insert(dist_pt, idx_array[i], * near_set_dist, near_set_indx, k) */ - __pyx_t_1 = (__pyx_v_dist_pt < __pyx_v_dmax); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dist_pt < __pyx_v_dmax); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1037 + /* "sklearn/neighbors/ball_tree.pyx":1039 * elif dist_pt < dmax: * heapqueue_insert(dist_pt, idx_array[i], * near_set_dist, near_set_indx, k) # <<<<<<<<<<<<<< @@ -6188,17 +6388,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_heapqueue_insert(__pyx_v_dist_pt, (__pyx_v_idx_array[__pyx_v_i]), __pyx_v_near_set_dist, __pyx_v_near_set_indx, __pyx_v_k); - /* "sklearn/neighbors/ball_tree.pyx":1038 + /* "sklearn/neighbors/ball_tree.pyx":1040 * heapqueue_insert(dist_pt, idx_array[i], * near_set_dist, near_set_indx, k) * if dmax == heapqueue_largest(near_set_dist, k): # <<<<<<<<<<<<<< * check_index = heapqueue_idx_largest(near_set_indx, * k) */ - __pyx_t_1 = (__pyx_v_dmax == __pyx_v_heapqueue_largest(__pyx_v_near_set_dist, __pyx_v_k)); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dmax == __pyx_v_heapqueue_largest(__pyx_v_near_set_dist, __pyx_v_k)); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1040 + /* "sklearn/neighbors/ball_tree.pyx":1042 * if dmax == heapqueue_largest(near_set_dist, k): * check_index = heapqueue_idx_largest(near_set_indx, * k) # <<<<<<<<<<<<<< @@ -6217,7 +6417,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1046 + /* "sklearn/neighbors/ball_tree.pyx":1048 * # starting with the one whose centroid is closest * else: * i1 = 2 * i_node + 1 # <<<<<<<<<<<<<< @@ -6226,7 +6426,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_i1 = ((2 * __pyx_v_i_node) + 1); - /* "sklearn/neighbors/ball_tree.pyx":1047 + /* "sklearn/neighbors/ball_tree.pyx":1049 * else: * i1 = 2 * i_node + 1 * i2 = i1 + 1 # <<<<<<<<<<<<<< @@ -6235,7 +6435,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_i2 = (__pyx_v_i1 + 1); - /* "sklearn/neighbors/ball_tree.pyx":1051 + /* "sklearn/neighbors/ball_tree.pyx":1053 * + i1 * n_features), * node_info_arr[i1].radius, * n_features, p) # <<<<<<<<<<<<<< @@ -6244,7 +6444,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_dist_p_LB_1 = __pyx_f_7sklearn_9neighbors_9ball_tree_calc_dist_p_LB(__pyx_v_pt, (__pyx_v_node_centroid_arr + (__pyx_v_i1 * __pyx_v_n_features)), (__pyx_v_node_info_arr[__pyx_v_i1]).radius, __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1055 + /* "sklearn/neighbors/ball_tree.pyx":1057 * + i2 * n_features), * node_info_arr[i2].radius, * n_features, p) # <<<<<<<<<<<<<< @@ -6253,17 +6453,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_dist_p_LB_2 = __pyx_f_7sklearn_9neighbors_9ball_tree_calc_dist_p_LB(__pyx_v_pt, (__pyx_v_node_centroid_arr + (__pyx_v_i2 * __pyx_v_n_features)), (__pyx_v_node_info_arr[__pyx_v_i2]).radius, __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1058 + /* "sklearn/neighbors/ball_tree.pyx":1060 * * # append children to stack: last-in-first-out * if dist_p_LB_2 <= dist_p_LB_1: # <<<<<<<<<<<<<< * item.i_node = i1 * item.dist_p_LB = dist_p_LB_1 */ - __pyx_t_1 = (__pyx_v_dist_p_LB_2 <= __pyx_v_dist_p_LB_1); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dist_p_LB_2 <= __pyx_v_dist_p_LB_1); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1059 + /* "sklearn/neighbors/ball_tree.pyx":1061 * # append children to stack: last-in-first-out * if dist_p_LB_2 <= dist_p_LB_1: * item.i_node = i1 # <<<<<<<<<<<<<< @@ -6272,7 +6472,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.i_node = __pyx_v_i1; - /* "sklearn/neighbors/ball_tree.pyx":1060 + /* "sklearn/neighbors/ball_tree.pyx":1062 * if dist_p_LB_2 <= dist_p_LB_1: * item.i_node = i1 * item.dist_p_LB = dist_p_LB_1 # <<<<<<<<<<<<<< @@ -6281,7 +6481,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.dist_p_LB = __pyx_v_dist_p_LB_1; - /* "sklearn/neighbors/ball_tree.pyx":1061 + /* "sklearn/neighbors/ball_tree.pyx":1063 * item.i_node = i1 * item.dist_p_LB = dist_p_LB_1 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -6290,7 +6490,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(__pyx_v_node_stack, __pyx_v_item); - /* "sklearn/neighbors/ball_tree.pyx":1063 + /* "sklearn/neighbors/ball_tree.pyx":1065 * stack_push(node_stack, item) * * item.i_node = i2 # <<<<<<<<<<<<<< @@ -6299,7 +6499,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.i_node = __pyx_v_i2; - /* "sklearn/neighbors/ball_tree.pyx":1064 + /* "sklearn/neighbors/ball_tree.pyx":1066 * * item.i_node = i2 * item.dist_p_LB = dist_p_LB_2 # <<<<<<<<<<<<<< @@ -6308,7 +6508,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.dist_p_LB = __pyx_v_dist_p_LB_2; - /* "sklearn/neighbors/ball_tree.pyx":1065 + /* "sklearn/neighbors/ball_tree.pyx":1067 * item.i_node = i2 * item.dist_p_LB = dist_p_LB_2 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -6320,7 +6520,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1068 + /* "sklearn/neighbors/ball_tree.pyx":1070 * * else: * item.i_node = i2 # <<<<<<<<<<<<<< @@ -6329,7 +6529,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.i_node = __pyx_v_i2; - /* "sklearn/neighbors/ball_tree.pyx":1069 + /* "sklearn/neighbors/ball_tree.pyx":1071 * else: * item.i_node = i2 * item.dist_p_LB = dist_p_LB_2 # <<<<<<<<<<<<<< @@ -6338,7 +6538,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.dist_p_LB = __pyx_v_dist_p_LB_2; - /* "sklearn/neighbors/ball_tree.pyx":1070 + /* "sklearn/neighbors/ball_tree.pyx":1072 * item.i_node = i2 * item.dist_p_LB = dist_p_LB_2 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -6347,7 +6547,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(__pyx_v_node_stack, __pyx_v_item); - /* "sklearn/neighbors/ball_tree.pyx":1072 + /* "sklearn/neighbors/ball_tree.pyx":1074 * stack_push(node_stack, item) * * item.i_node = i1 # <<<<<<<<<<<<<< @@ -6356,7 +6556,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.i_node = __pyx_v_i1; - /* "sklearn/neighbors/ball_tree.pyx":1073 + /* "sklearn/neighbors/ball_tree.pyx":1075 * * item.i_node = i1 * item.dist_p_LB = dist_p_LB_1 # <<<<<<<<<<<<<< @@ -6365,7 +6565,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ */ __pyx_v_item.dist_p_LB = __pyx_v_dist_p_LB_1; - /* "sklearn/neighbors/ball_tree.pyx":1074 + /* "sklearn/neighbors/ball_tree.pyx":1076 * item.i_node = i1 * item.dist_p_LB = dist_p_LB_1 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -6380,17 +6580,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ __pyx_L4_continue:; } - /* "sklearn/neighbors/ball_tree.pyx":1076 + /* "sklearn/neighbors/ball_tree.pyx":1078 * stack_push(node_stack, item) * * if check_index == heapqueue_idx_largest(near_set_indx, k): # <<<<<<<<<<<<<< * self.warning_flag = True * */ - __pyx_t_1 = (__pyx_v_check_index == __pyx_v_heapqueue_idx_largest(__pyx_v_near_set_indx, __pyx_v_k)); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_check_index == __pyx_v_heapqueue_idx_largest(__pyx_v_near_set_indx, __pyx_v_k)); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1077 + /* "sklearn/neighbors/ball_tree.pyx":1079 * * if check_index == heapqueue_idx_largest(near_set_indx, k): * self.warning_flag = True # <<<<<<<<<<<<<< @@ -6402,17 +6602,17 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ } __pyx_L12:; - /* "sklearn/neighbors/ball_tree.pyx":1079 + /* "sklearn/neighbors/ball_tree.pyx":1081 * self.warning_flag = True * * for i from 0 <= i < k: # <<<<<<<<<<<<<< * near_set_dist[i] = dist_from_dist_p(near_set_dist[i], p) * */ - __pyx_t_2 = __pyx_v_k; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + __pyx_t_3 = __pyx_v_k; + for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1080 + /* "sklearn/neighbors/ball_tree.pyx":1082 * * for i from 0 <= i < k: * near_set_dist[i] = dist_from_dist_p(near_set_dist[i], p) # <<<<<<<<<<<<<< @@ -6425,7 +6625,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_one_(struct _ __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":1082 +/* "sklearn/neighbors/ball_tree.pyx":1084 * near_set_dist[i] = dist_from_dist_p(near_set_dist[i], p) * * cdef ITYPE_t query_radius_count_(BallTree self, # <<<<<<<<<<<<<< @@ -6449,12 +6649,13 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item __pyx_v_item; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; - long __pyx_t_3; - __Pyx_RefNannySetupContext("query_radius_count_"); + __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_t_1; + int __pyx_t_2; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_3; + long __pyx_t_4; + __Pyx_RefNannySetupContext("query_radius_count_", 0); - /* "sklearn/neighbors/ball_tree.pyx":1085 + /* "sklearn/neighbors/ball_tree.pyx":1087 * DTYPE_t* pt, DTYPE_t r, * stack* node_stack): * cdef DTYPE_t* data = self.data.data # <<<<<<<<<<<<<< @@ -6463,7 +6664,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_data = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->data->data); - /* "sklearn/neighbors/ball_tree.pyx":1086 + /* "sklearn/neighbors/ball_tree.pyx":1088 * stack* node_stack): * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data # <<<<<<<<<<<<<< @@ -6472,7 +6673,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_idx_array = ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_self->idx_array->data); - /* "sklearn/neighbors/ball_tree.pyx":1087 + /* "sklearn/neighbors/ball_tree.pyx":1089 * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data # <<<<<<<<<<<<<< @@ -6481,7 +6682,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_centroid_arr = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->node_centroid_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":1088 + /* "sklearn/neighbors/ball_tree.pyx":1090 * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data * cdef NodeInfo* node_info_arr = self.node_info_arr.data # <<<<<<<<<<<<<< @@ -6490,7 +6691,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_info_arr = ((struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo *)__pyx_v_self->node_info_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":1089 + /* "sklearn/neighbors/ball_tree.pyx":1091 * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data * cdef NodeInfo* node_info_arr = self.node_info_arr.data * cdef NodeInfo* node_info = node_info_arr # <<<<<<<<<<<<<< @@ -6499,16 +6700,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_info = __pyx_v_node_info_arr; - /* "sklearn/neighbors/ball_tree.pyx":1091 + /* "sklearn/neighbors/ball_tree.pyx":1093 * cdef NodeInfo* node_info = node_info_arr * * cdef DTYPE_t p = self.p # <<<<<<<<<<<<<< * cdef ITYPE_t n_features = self.data.shape[1] * cdef ITYPE_t i, i_node */ - __pyx_v_p = __pyx_v_self->p; + __pyx_t_1 = __pyx_v_self->p; + __pyx_v_p = __pyx_t_1; - /* "sklearn/neighbors/ball_tree.pyx":1092 + /* "sklearn/neighbors/ball_tree.pyx":1094 * * cdef DTYPE_t p = self.p * cdef ITYPE_t n_features = self.data.shape[1] # <<<<<<<<<<<<<< @@ -6517,7 +6719,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_n_features = (__pyx_v_self->data->dimensions[1]); - /* "sklearn/neighbors/ball_tree.pyx":1094 + /* "sklearn/neighbors/ball_tree.pyx":1096 * cdef ITYPE_t n_features = self.data.shape[1] * cdef ITYPE_t i, i_node * cdef ITYPE_t count = 0 # <<<<<<<<<<<<<< @@ -6526,7 +6728,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_count = 0; - /* "sklearn/neighbors/ball_tree.pyx":1095 + /* "sklearn/neighbors/ball_tree.pyx":1097 * cdef ITYPE_t i, i_node * cdef ITYPE_t count = 0 * cdef DTYPE_t r_p = dist_p_from_dist(r, p) # <<<<<<<<<<<<<< @@ -6535,7 +6737,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_r_p = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_p_from_dist(__pyx_v_r, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1100 + /* "sklearn/neighbors/ball_tree.pyx":1102 * cdef stack_item item * * item.i_node = 0 # <<<<<<<<<<<<<< @@ -6544,7 +6746,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_item.i_node = 0; - /* "sklearn/neighbors/ball_tree.pyx":1101 + /* "sklearn/neighbors/ball_tree.pyx":1103 * * item.i_node = 0 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -6553,7 +6755,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(__pyx_v_node_stack, __pyx_v_item); - /* "sklearn/neighbors/ball_tree.pyx":1103 + /* "sklearn/neighbors/ball_tree.pyx":1105 * stack_push(node_stack, item) * * while(node_stack.n > 0): # <<<<<<<<<<<<<< @@ -6561,10 +6763,10 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor * i_node = item.i_node */ while (1) { - __pyx_t_1 = (__pyx_v_node_stack->n > 0); - if (!__pyx_t_1) break; + __pyx_t_2 = (__pyx_v_node_stack->n > 0); + if (!__pyx_t_2) break; - /* "sklearn/neighbors/ball_tree.pyx":1104 + /* "sklearn/neighbors/ball_tree.pyx":1106 * * while(node_stack.n > 0): * item = stack_pop(node_stack) # <<<<<<<<<<<<<< @@ -6573,16 +6775,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_item = __pyx_f_7sklearn_9neighbors_9ball_tree_stack_pop(__pyx_v_node_stack); - /* "sklearn/neighbors/ball_tree.pyx":1105 + /* "sklearn/neighbors/ball_tree.pyx":1107 * while(node_stack.n > 0): * item = stack_pop(node_stack) * i_node = item.i_node # <<<<<<<<<<<<<< * node_info = node_info_arr + i_node * */ - __pyx_v_i_node = __pyx_v_item.i_node; + __pyx_t_3 = __pyx_v_item.i_node; + __pyx_v_i_node = __pyx_t_3; - /* "sklearn/neighbors/ball_tree.pyx":1106 + /* "sklearn/neighbors/ball_tree.pyx":1108 * item = stack_pop(node_stack) * i_node = item.i_node * node_info = node_info_arr + i_node # <<<<<<<<<<<<<< @@ -6591,7 +6794,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_info = (__pyx_v_node_info_arr + __pyx_v_i_node); - /* "sklearn/neighbors/ball_tree.pyx":1109 + /* "sklearn/neighbors/ball_tree.pyx":1111 * * dist_pt = dist(pt, node_centroid_arr + n_features * i_node, * n_features, p) # <<<<<<<<<<<<<< @@ -6600,17 +6803,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_dist_pt = __pyx_f_7sklearn_9neighbors_9ball_tree_dist(__pyx_v_pt, (__pyx_v_node_centroid_arr + (__pyx_v_n_features * __pyx_v_i_node)), __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1114 + /* "sklearn/neighbors/ball_tree.pyx":1116 * # Case 1: all node points are outside distance r. * # prune this branch. * if dist_pt - node_info.radius > r: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_1 = ((__pyx_v_dist_pt - __pyx_v_node_info->radius) > __pyx_v_r); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_dist_pt - __pyx_v_node_info->radius) > __pyx_v_r); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1115 + /* "sklearn/neighbors/ball_tree.pyx":1117 * # prune this branch. * if dist_pt - node_info.radius > r: * continue # <<<<<<<<<<<<<< @@ -6621,17 +6824,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L5; } - /* "sklearn/neighbors/ball_tree.pyx":1120 + /* "sklearn/neighbors/ball_tree.pyx":1122 * # Case 2: all node points are within distance r * # add all points * elif dist_pt + node_info.radius < r: # <<<<<<<<<<<<<< * count += (node_info.idx_end - node_info.idx_start) * */ - __pyx_t_1 = ((__pyx_v_dist_pt + __pyx_v_node_info->radius) < __pyx_v_r); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_dist_pt + __pyx_v_node_info->radius) < __pyx_v_r); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1121 + /* "sklearn/neighbors/ball_tree.pyx":1123 * # add all points * elif dist_pt + node_info.radius < r: * count += (node_info.idx_end - node_info.idx_start) # <<<<<<<<<<<<<< @@ -6642,7 +6845,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L5; } - /* "sklearn/neighbors/ball_tree.pyx":1126 + /* "sklearn/neighbors/ball_tree.pyx":1128 * # Case 3: this is a leaf node. Go through all points to * # determine if they fall within radius * elif node_info.is_leaf: # <<<<<<<<<<<<<< @@ -6651,17 +6854,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ if (__pyx_v_node_info->is_leaf) { - /* "sklearn/neighbors/ball_tree.pyx":1127 + /* "sklearn/neighbors/ball_tree.pyx":1129 * # determine if they fall within radius * elif node_info.is_leaf: * for i from node_info.idx_start <= i < node_info.idx_end: # <<<<<<<<<<<<<< * dist_pt = dist_p(pt, * data + idx_array[i] * n_features, */ - __pyx_t_2 = __pyx_v_node_info->idx_end; - for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + __pyx_t_3 = __pyx_v_node_info->idx_end; + for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1130 + /* "sklearn/neighbors/ball_tree.pyx":1132 * dist_pt = dist_p(pt, * data + idx_array[i] * n_features, * n_features, p) # <<<<<<<<<<<<<< @@ -6670,17 +6873,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_dist_pt = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_p(__pyx_v_pt, (__pyx_v_data + ((__pyx_v_idx_array[__pyx_v_i]) * __pyx_v_n_features)), __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1131 + /* "sklearn/neighbors/ball_tree.pyx":1133 * data + idx_array[i] * n_features, * n_features, p) * if dist_pt <= r_p: # <<<<<<<<<<<<<< * count += 1 * */ - __pyx_t_1 = (__pyx_v_dist_pt <= __pyx_v_r_p); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dist_pt <= __pyx_v_r_p); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1132 + /* "sklearn/neighbors/ball_tree.pyx":1134 * n_features, p) * if dist_pt <= r_p: * count += 1 # <<<<<<<<<<<<<< @@ -6696,7 +6899,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1137 + /* "sklearn/neighbors/ball_tree.pyx":1139 * # Case 4: Node is not a leaf. Recursively query subnodes * else: * item.i_node = 2 * i_node + 1 # <<<<<<<<<<<<<< @@ -6705,7 +6908,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_item.i_node = ((2 * __pyx_v_i_node) + 1); - /* "sklearn/neighbors/ball_tree.pyx":1138 + /* "sklearn/neighbors/ball_tree.pyx":1140 * else: * item.i_node = 2 * i_node + 1 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -6714,18 +6917,18 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(__pyx_v_node_stack, __pyx_v_item); - /* "sklearn/neighbors/ball_tree.pyx":1140 + /* "sklearn/neighbors/ball_tree.pyx":1142 * stack_push(node_stack, item) * * item.i_node = i = 2 * i_node + 2 # <<<<<<<<<<<<<< * stack_push(node_stack, item) * */ - __pyx_t_3 = ((2 * __pyx_v_i_node) + 2); - __pyx_v_item.i_node = __pyx_t_3; - __pyx_v_i = __pyx_t_3; + __pyx_t_4 = ((2 * __pyx_v_i_node) + 2); + __pyx_v_item.i_node = __pyx_t_4; + __pyx_v_i = __pyx_t_4; - /* "sklearn/neighbors/ball_tree.pyx":1141 + /* "sklearn/neighbors/ball_tree.pyx":1143 * * item.i_node = i = 2 * i_node + 2 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -6738,7 +6941,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_L3_continue:; } - /* "sklearn/neighbors/ball_tree.pyx":1143 + /* "sklearn/neighbors/ball_tree.pyx":1145 * stack_push(node_stack, item) * * return count # <<<<<<<<<<<<<< @@ -6754,7 +6957,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1145 +/* "sklearn/neighbors/ball_tree.pyx":1147 * return count * * cdef ITYPE_t query_radius_idx_only_(BallTree self, # <<<<<<<<<<<<<< @@ -6778,12 +6981,13 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item __pyx_v_item; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; - long __pyx_t_3; - __Pyx_RefNannySetupContext("query_radius_idx_only_"); + __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_t_1; + int __pyx_t_2; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_3; + long __pyx_t_4; + __Pyx_RefNannySetupContext("query_radius_idx_only_", 0); - /* "sklearn/neighbors/ball_tree.pyx":1149 + /* "sklearn/neighbors/ball_tree.pyx":1151 * ITYPE_t* indices, * stack* node_stack): * cdef DTYPE_t* data = self.data.data # <<<<<<<<<<<<<< @@ -6792,7 +6996,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_data = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->data->data); - /* "sklearn/neighbors/ball_tree.pyx":1150 + /* "sklearn/neighbors/ball_tree.pyx":1152 * stack* node_stack): * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data # <<<<<<<<<<<<<< @@ -6801,7 +7005,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_idx_array = ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_self->idx_array->data); - /* "sklearn/neighbors/ball_tree.pyx":1151 + /* "sklearn/neighbors/ball_tree.pyx":1153 * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data # <<<<<<<<<<<<<< @@ -6810,7 +7014,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_centroid_arr = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->node_centroid_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":1152 + /* "sklearn/neighbors/ball_tree.pyx":1154 * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data * cdef NodeInfo* node_info_arr = self.node_info_arr.data # <<<<<<<<<<<<<< @@ -6819,7 +7023,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_info_arr = ((struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo *)__pyx_v_self->node_info_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":1153 + /* "sklearn/neighbors/ball_tree.pyx":1155 * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data * cdef NodeInfo* node_info_arr = self.node_info_arr.data * cdef NodeInfo* node_info = node_info_arr # <<<<<<<<<<<<<< @@ -6828,16 +7032,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_info = __pyx_v_node_info_arr; - /* "sklearn/neighbors/ball_tree.pyx":1155 + /* "sklearn/neighbors/ball_tree.pyx":1157 * cdef NodeInfo* node_info = node_info_arr * * cdef DTYPE_t p = self.p # <<<<<<<<<<<<<< * cdef ITYPE_t n_features = self.data.shape[1] * cdef ITYPE_t i, i_node */ - __pyx_v_p = __pyx_v_self->p; + __pyx_t_1 = __pyx_v_self->p; + __pyx_v_p = __pyx_t_1; - /* "sklearn/neighbors/ball_tree.pyx":1156 + /* "sklearn/neighbors/ball_tree.pyx":1158 * * cdef DTYPE_t p = self.p * cdef ITYPE_t n_features = self.data.shape[1] # <<<<<<<<<<<<<< @@ -6846,7 +7051,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_n_features = (__pyx_v_self->data->dimensions[1]); - /* "sklearn/neighbors/ball_tree.pyx":1158 + /* "sklearn/neighbors/ball_tree.pyx":1160 * cdef ITYPE_t n_features = self.data.shape[1] * cdef ITYPE_t i, i_node * cdef ITYPE_t idx_i = 0 # <<<<<<<<<<<<<< @@ -6855,7 +7060,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_idx_i = 0; - /* "sklearn/neighbors/ball_tree.pyx":1159 + /* "sklearn/neighbors/ball_tree.pyx":1161 * cdef ITYPE_t i, i_node * cdef ITYPE_t idx_i = 0 * cdef DTYPE_t r_p = dist_p_from_dist(r, p) # <<<<<<<<<<<<<< @@ -6864,7 +7069,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_r_p = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_p_from_dist(__pyx_v_r, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1164 + /* "sklearn/neighbors/ball_tree.pyx":1166 * cdef stack_item item * * item.i_node = 0 # <<<<<<<<<<<<<< @@ -6873,7 +7078,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_item.i_node = 0; - /* "sklearn/neighbors/ball_tree.pyx":1165 + /* "sklearn/neighbors/ball_tree.pyx":1167 * * item.i_node = 0 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -6882,7 +7087,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(__pyx_v_node_stack, __pyx_v_item); - /* "sklearn/neighbors/ball_tree.pyx":1167 + /* "sklearn/neighbors/ball_tree.pyx":1169 * stack_push(node_stack, item) * * while(node_stack.n > 0): # <<<<<<<<<<<<<< @@ -6890,10 +7095,10 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor * i_node = item.i_node */ while (1) { - __pyx_t_1 = (__pyx_v_node_stack->n > 0); - if (!__pyx_t_1) break; + __pyx_t_2 = (__pyx_v_node_stack->n > 0); + if (!__pyx_t_2) break; - /* "sklearn/neighbors/ball_tree.pyx":1168 + /* "sklearn/neighbors/ball_tree.pyx":1170 * * while(node_stack.n > 0): * item = stack_pop(node_stack) # <<<<<<<<<<<<<< @@ -6902,16 +7107,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_item = __pyx_f_7sklearn_9neighbors_9ball_tree_stack_pop(__pyx_v_node_stack); - /* "sklearn/neighbors/ball_tree.pyx":1169 + /* "sklearn/neighbors/ball_tree.pyx":1171 * while(node_stack.n > 0): * item = stack_pop(node_stack) * i_node = item.i_node # <<<<<<<<<<<<<< * node_info = node_info_arr + i_node * */ - __pyx_v_i_node = __pyx_v_item.i_node; + __pyx_t_3 = __pyx_v_item.i_node; + __pyx_v_i_node = __pyx_t_3; - /* "sklearn/neighbors/ball_tree.pyx":1170 + /* "sklearn/neighbors/ball_tree.pyx":1172 * item = stack_pop(node_stack) * i_node = item.i_node * node_info = node_info_arr + i_node # <<<<<<<<<<<<<< @@ -6920,7 +7126,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_info = (__pyx_v_node_info_arr + __pyx_v_i_node); - /* "sklearn/neighbors/ball_tree.pyx":1173 + /* "sklearn/neighbors/ball_tree.pyx":1175 * * dist_pt = dist(pt, node_centroid_arr + n_features * i_node, * n_features, p) # <<<<<<<<<<<<<< @@ -6929,17 +7135,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_dist_pt = __pyx_f_7sklearn_9neighbors_9ball_tree_dist(__pyx_v_pt, (__pyx_v_node_centroid_arr + (__pyx_v_n_features * __pyx_v_i_node)), __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1178 + /* "sklearn/neighbors/ball_tree.pyx":1180 * # Case 1: all node points are outside distance r. * # prune this branch. * if dist_pt - node_info.radius > r: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_1 = ((__pyx_v_dist_pt - __pyx_v_node_info->radius) > __pyx_v_r); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_dist_pt - __pyx_v_node_info->radius) > __pyx_v_r); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1179 + /* "sklearn/neighbors/ball_tree.pyx":1181 * # prune this branch. * if dist_pt - node_info.radius > r: * continue # <<<<<<<<<<<<<< @@ -6950,27 +7156,27 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L5; } - /* "sklearn/neighbors/ball_tree.pyx":1184 + /* "sklearn/neighbors/ball_tree.pyx":1186 * # Case 2: all node points are within distance r * # add all points * elif dist_pt + node_info.radius < r: # <<<<<<<<<<<<<< * for i from node_info.idx_start <= i < node_info.idx_end: * indices[idx_i] = idx_array[i] */ - __pyx_t_1 = ((__pyx_v_dist_pt + __pyx_v_node_info->radius) < __pyx_v_r); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_dist_pt + __pyx_v_node_info->radius) < __pyx_v_r); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1185 + /* "sklearn/neighbors/ball_tree.pyx":1187 * # add all points * elif dist_pt + node_info.radius < r: * for i from node_info.idx_start <= i < node_info.idx_end: # <<<<<<<<<<<<<< * indices[idx_i] = idx_array[i] * idx_i += 1 */ - __pyx_t_2 = __pyx_v_node_info->idx_end; - for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + __pyx_t_3 = __pyx_v_node_info->idx_end; + for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1186 + /* "sklearn/neighbors/ball_tree.pyx":1188 * elif dist_pt + node_info.radius < r: * for i from node_info.idx_start <= i < node_info.idx_end: * indices[idx_i] = idx_array[i] # <<<<<<<<<<<<<< @@ -6979,7 +7185,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ (__pyx_v_indices[__pyx_v_idx_i]) = (__pyx_v_idx_array[__pyx_v_i]); - /* "sklearn/neighbors/ball_tree.pyx":1187 + /* "sklearn/neighbors/ball_tree.pyx":1189 * for i from node_info.idx_start <= i < node_info.idx_end: * indices[idx_i] = idx_array[i] * idx_i += 1 # <<<<<<<<<<<<<< @@ -6991,7 +7197,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L5; } - /* "sklearn/neighbors/ball_tree.pyx":1192 + /* "sklearn/neighbors/ball_tree.pyx":1194 * # Case 3: this is a leaf node. Go through all points to * # determine if they fall within radius * elif node_info.is_leaf: # <<<<<<<<<<<<<< @@ -7000,17 +7206,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ if (__pyx_v_node_info->is_leaf) { - /* "sklearn/neighbors/ball_tree.pyx":1193 + /* "sklearn/neighbors/ball_tree.pyx":1195 * # determine if they fall within radius * elif node_info.is_leaf: * for i from node_info.idx_start <= i < node_info.idx_end: # <<<<<<<<<<<<<< * dist_pt = dist_p(pt, * data + idx_array[i] * n_features, */ - __pyx_t_2 = __pyx_v_node_info->idx_end; - for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + __pyx_t_3 = __pyx_v_node_info->idx_end; + for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1196 + /* "sklearn/neighbors/ball_tree.pyx":1198 * dist_pt = dist_p(pt, * data + idx_array[i] * n_features, * n_features, p) # <<<<<<<<<<<<<< @@ -7019,17 +7225,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_dist_pt = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_p(__pyx_v_pt, (__pyx_v_data + ((__pyx_v_idx_array[__pyx_v_i]) * __pyx_v_n_features)), __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1197 + /* "sklearn/neighbors/ball_tree.pyx":1199 * data + idx_array[i] * n_features, * n_features, p) * if dist_pt <= r_p: # <<<<<<<<<<<<<< * indices[idx_i] = idx_array[i] * idx_i += 1 */ - __pyx_t_1 = (__pyx_v_dist_pt <= __pyx_v_r_p); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dist_pt <= __pyx_v_r_p); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1198 + /* "sklearn/neighbors/ball_tree.pyx":1200 * n_features, p) * if dist_pt <= r_p: * indices[idx_i] = idx_array[i] # <<<<<<<<<<<<<< @@ -7038,7 +7244,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ (__pyx_v_indices[__pyx_v_idx_i]) = (__pyx_v_idx_array[__pyx_v_i]); - /* "sklearn/neighbors/ball_tree.pyx":1199 + /* "sklearn/neighbors/ball_tree.pyx":1201 * if dist_pt <= r_p: * indices[idx_i] = idx_array[i] * idx_i += 1 # <<<<<<<<<<<<<< @@ -7054,7 +7260,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1204 + /* "sklearn/neighbors/ball_tree.pyx":1206 * # Case 4: Node is not a leaf. Recursively query subnodes * else: * item.i_node = 2 * i_node + 1 # <<<<<<<<<<<<<< @@ -7063,7 +7269,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_item.i_node = ((2 * __pyx_v_i_node) + 1); - /* "sklearn/neighbors/ball_tree.pyx":1205 + /* "sklearn/neighbors/ball_tree.pyx":1207 * else: * item.i_node = 2 * i_node + 1 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -7072,18 +7278,18 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(__pyx_v_node_stack, __pyx_v_item); - /* "sklearn/neighbors/ball_tree.pyx":1207 + /* "sklearn/neighbors/ball_tree.pyx":1209 * stack_push(node_stack, item) * * item.i_node = i = 2 * i_node + 2 # <<<<<<<<<<<<<< * stack_push(node_stack, item) * */ - __pyx_t_3 = ((2 * __pyx_v_i_node) + 2); - __pyx_v_item.i_node = __pyx_t_3; - __pyx_v_i = __pyx_t_3; + __pyx_t_4 = ((2 * __pyx_v_i_node) + 2); + __pyx_v_item.i_node = __pyx_t_4; + __pyx_v_i = __pyx_t_4; - /* "sklearn/neighbors/ball_tree.pyx":1208 + /* "sklearn/neighbors/ball_tree.pyx":1210 * * item.i_node = i = 2 * i_node + 2 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -7096,7 +7302,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_L3_continue:; } - /* "sklearn/neighbors/ball_tree.pyx":1210 + /* "sklearn/neighbors/ball_tree.pyx":1212 * stack_push(node_stack, item) * * return idx_i # <<<<<<<<<<<<<< @@ -7112,7 +7318,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1212 +/* "sklearn/neighbors/ball_tree.pyx":1214 * return idx_i * * cdef ITYPE_t query_radius_distances_(BallTree self, # <<<<<<<<<<<<<< @@ -7136,12 +7342,13 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack_item __pyx_v_item; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; - long __pyx_t_3; - __Pyx_RefNannySetupContext("query_radius_distances_"); + __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_t_1; + int __pyx_t_2; + __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_3; + long __pyx_t_4; + __Pyx_RefNannySetupContext("query_radius_distances_", 0); - /* "sklearn/neighbors/ball_tree.pyx":1217 + /* "sklearn/neighbors/ball_tree.pyx":1219 * DTYPE_t* distances, * stack* node_stack): * cdef DTYPE_t* data = self.data.data # <<<<<<<<<<<<<< @@ -7150,7 +7357,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_data = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->data->data); - /* "sklearn/neighbors/ball_tree.pyx":1218 + /* "sklearn/neighbors/ball_tree.pyx":1220 * stack* node_stack): * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data # <<<<<<<<<<<<<< @@ -7159,7 +7366,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_idx_array = ((__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *)__pyx_v_self->idx_array->data); - /* "sklearn/neighbors/ball_tree.pyx":1219 + /* "sklearn/neighbors/ball_tree.pyx":1221 * cdef DTYPE_t* data = self.data.data * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data # <<<<<<<<<<<<<< @@ -7168,7 +7375,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_centroid_arr = ((__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *)__pyx_v_self->node_centroid_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":1220 + /* "sklearn/neighbors/ball_tree.pyx":1222 * cdef ITYPE_t* idx_array = self.idx_array.data * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data * cdef NodeInfo* node_info_arr = self.node_info_arr.data # <<<<<<<<<<<<<< @@ -7177,7 +7384,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_info_arr = ((struct __pyx_t_7sklearn_9neighbors_9ball_tree_NodeInfo *)__pyx_v_self->node_info_arr->data); - /* "sklearn/neighbors/ball_tree.pyx":1221 + /* "sklearn/neighbors/ball_tree.pyx":1223 * cdef DTYPE_t* node_centroid_arr = self.node_centroid_arr.data * cdef NodeInfo* node_info_arr = self.node_info_arr.data * cdef NodeInfo* node_info = node_info_arr # <<<<<<<<<<<<<< @@ -7186,16 +7393,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_info = __pyx_v_node_info_arr; - /* "sklearn/neighbors/ball_tree.pyx":1223 + /* "sklearn/neighbors/ball_tree.pyx":1225 * cdef NodeInfo* node_info = node_info_arr * * cdef DTYPE_t p = self.p # <<<<<<<<<<<<<< * cdef ITYPE_t n_features = self.data.shape[1] * cdef ITYPE_t i, i_node */ - __pyx_v_p = __pyx_v_self->p; + __pyx_t_1 = __pyx_v_self->p; + __pyx_v_p = __pyx_t_1; - /* "sklearn/neighbors/ball_tree.pyx":1224 + /* "sklearn/neighbors/ball_tree.pyx":1226 * * cdef DTYPE_t p = self.p * cdef ITYPE_t n_features = self.data.shape[1] # <<<<<<<<<<<<<< @@ -7204,7 +7412,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_n_features = (__pyx_v_self->data->dimensions[1]); - /* "sklearn/neighbors/ball_tree.pyx":1226 + /* "sklearn/neighbors/ball_tree.pyx":1228 * cdef ITYPE_t n_features = self.data.shape[1] * cdef ITYPE_t i, i_node * cdef ITYPE_t idx_i = 0 # <<<<<<<<<<<<<< @@ -7213,7 +7421,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_idx_i = 0; - /* "sklearn/neighbors/ball_tree.pyx":1227 + /* "sklearn/neighbors/ball_tree.pyx":1229 * cdef ITYPE_t i, i_node * cdef ITYPE_t idx_i = 0 * cdef DTYPE_t r_p = dist_p_from_dist(r, p) # <<<<<<<<<<<<<< @@ -7222,7 +7430,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_r_p = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_p_from_dist(__pyx_v_r, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1232 + /* "sklearn/neighbors/ball_tree.pyx":1234 * cdef stack_item item * * item.i_node = 0 # <<<<<<<<<<<<<< @@ -7231,7 +7439,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_item.i_node = 0; - /* "sklearn/neighbors/ball_tree.pyx":1233 + /* "sklearn/neighbors/ball_tree.pyx":1235 * * item.i_node = 0 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -7240,7 +7448,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(__pyx_v_node_stack, __pyx_v_item); - /* "sklearn/neighbors/ball_tree.pyx":1235 + /* "sklearn/neighbors/ball_tree.pyx":1237 * stack_push(node_stack, item) * * while(node_stack.n > 0): # <<<<<<<<<<<<<< @@ -7248,10 +7456,10 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor * i_node = item.i_node */ while (1) { - __pyx_t_1 = (__pyx_v_node_stack->n > 0); - if (!__pyx_t_1) break; + __pyx_t_2 = (__pyx_v_node_stack->n > 0); + if (!__pyx_t_2) break; - /* "sklearn/neighbors/ball_tree.pyx":1236 + /* "sklearn/neighbors/ball_tree.pyx":1238 * * while(node_stack.n > 0): * item = stack_pop(node_stack) # <<<<<<<<<<<<<< @@ -7260,16 +7468,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_item = __pyx_f_7sklearn_9neighbors_9ball_tree_stack_pop(__pyx_v_node_stack); - /* "sklearn/neighbors/ball_tree.pyx":1237 + /* "sklearn/neighbors/ball_tree.pyx":1239 * while(node_stack.n > 0): * item = stack_pop(node_stack) * i_node = item.i_node # <<<<<<<<<<<<<< * node_info = node_info_arr + i_node * */ - __pyx_v_i_node = __pyx_v_item.i_node; + __pyx_t_3 = __pyx_v_item.i_node; + __pyx_v_i_node = __pyx_t_3; - /* "sklearn/neighbors/ball_tree.pyx":1238 + /* "sklearn/neighbors/ball_tree.pyx":1240 * item = stack_pop(node_stack) * i_node = item.i_node * node_info = node_info_arr + i_node # <<<<<<<<<<<<<< @@ -7278,7 +7487,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_node_info = (__pyx_v_node_info_arr + __pyx_v_i_node); - /* "sklearn/neighbors/ball_tree.pyx":1241 + /* "sklearn/neighbors/ball_tree.pyx":1243 * * dist_pt = dist(pt, node_centroid_arr + n_features * i_node, * n_features, p) # <<<<<<<<<<<<<< @@ -7287,17 +7496,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_dist_pt = __pyx_f_7sklearn_9neighbors_9ball_tree_dist(__pyx_v_pt, (__pyx_v_node_centroid_arr + (__pyx_v_n_features * __pyx_v_i_node)), __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1246 + /* "sklearn/neighbors/ball_tree.pyx":1248 * # Case 1: all node points are outside distance r. * # prune this branch. * if dist_pt - node_info.radius > r: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_1 = ((__pyx_v_dist_pt - __pyx_v_node_info->radius) > __pyx_v_r); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_dist_pt - __pyx_v_node_info->radius) > __pyx_v_r); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1247 + /* "sklearn/neighbors/ball_tree.pyx":1249 * # prune this branch. * if dist_pt - node_info.radius > r: * continue # <<<<<<<<<<<<<< @@ -7308,27 +7517,27 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L5; } - /* "sklearn/neighbors/ball_tree.pyx":1252 + /* "sklearn/neighbors/ball_tree.pyx":1254 * # Case 2: all node points are within distance r * # add all points * elif dist_pt + node_info.radius < r: # <<<<<<<<<<<<<< * for i from node_info.idx_start <= i < node_info.idx_end: * dist_pt = dist(pt, */ - __pyx_t_1 = ((__pyx_v_dist_pt + __pyx_v_node_info->radius) < __pyx_v_r); - if (__pyx_t_1) { + __pyx_t_2 = ((__pyx_v_dist_pt + __pyx_v_node_info->radius) < __pyx_v_r); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1253 + /* "sklearn/neighbors/ball_tree.pyx":1255 * # add all points * elif dist_pt + node_info.radius < r: * for i from node_info.idx_start <= i < node_info.idx_end: # <<<<<<<<<<<<<< * dist_pt = dist(pt, * data + idx_array[i] * n_features, */ - __pyx_t_2 = __pyx_v_node_info->idx_end; - for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + __pyx_t_3 = __pyx_v_node_info->idx_end; + for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1256 + /* "sklearn/neighbors/ball_tree.pyx":1258 * dist_pt = dist(pt, * data + idx_array[i] * n_features, * n_features, p) # <<<<<<<<<<<<<< @@ -7337,7 +7546,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_dist_pt = __pyx_f_7sklearn_9neighbors_9ball_tree_dist(__pyx_v_pt, (__pyx_v_data + ((__pyx_v_idx_array[__pyx_v_i]) * __pyx_v_n_features)), __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1257 + /* "sklearn/neighbors/ball_tree.pyx":1259 * data + idx_array[i] * n_features, * n_features, p) * indices[idx_i] = idx_array[i] # <<<<<<<<<<<<<< @@ -7346,7 +7555,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ (__pyx_v_indices[__pyx_v_idx_i]) = (__pyx_v_idx_array[__pyx_v_i]); - /* "sklearn/neighbors/ball_tree.pyx":1258 + /* "sklearn/neighbors/ball_tree.pyx":1260 * n_features, p) * indices[idx_i] = idx_array[i] * distances[idx_i] = dist_pt # <<<<<<<<<<<<<< @@ -7355,7 +7564,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ (__pyx_v_distances[__pyx_v_idx_i]) = __pyx_v_dist_pt; - /* "sklearn/neighbors/ball_tree.pyx":1259 + /* "sklearn/neighbors/ball_tree.pyx":1261 * indices[idx_i] = idx_array[i] * distances[idx_i] = dist_pt * idx_i += 1 # <<<<<<<<<<<<<< @@ -7367,7 +7576,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor goto __pyx_L5; } - /* "sklearn/neighbors/ball_tree.pyx":1264 + /* "sklearn/neighbors/ball_tree.pyx":1266 * # Case 3: this is a leaf node. Go through all points to * # determine if they fall within radius * elif node_info.is_leaf: # <<<<<<<<<<<<<< @@ -7376,17 +7585,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ if (__pyx_v_node_info->is_leaf) { - /* "sklearn/neighbors/ball_tree.pyx":1265 + /* "sklearn/neighbors/ball_tree.pyx":1267 * # determine if they fall within radius * elif node_info.is_leaf: * for i from node_info.idx_start <= i < node_info.idx_end: # <<<<<<<<<<<<<< * dist_pt = dist_p(pt, * data + idx_array[i] * n_features, */ - __pyx_t_2 = __pyx_v_node_info->idx_end; - for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { + __pyx_t_3 = __pyx_v_node_info->idx_end; + for (__pyx_v_i = __pyx_v_node_info->idx_start; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1268 + /* "sklearn/neighbors/ball_tree.pyx":1270 * dist_pt = dist_p(pt, * data + idx_array[i] * n_features, * n_features, p) # <<<<<<<<<<<<<< @@ -7395,17 +7604,17 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_dist_pt = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_p(__pyx_v_pt, (__pyx_v_data + ((__pyx_v_idx_array[__pyx_v_i]) * __pyx_v_n_features)), __pyx_v_n_features, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1269 + /* "sklearn/neighbors/ball_tree.pyx":1271 * data + idx_array[i] * n_features, * n_features, p) * if dist_pt <= r_p: # <<<<<<<<<<<<<< * indices[idx_i] = idx_array[i] * distances[idx_i] = dist_from_dist_p(dist_pt, p) */ - __pyx_t_1 = (__pyx_v_dist_pt <= __pyx_v_r_p); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_dist_pt <= __pyx_v_r_p); + if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1270 + /* "sklearn/neighbors/ball_tree.pyx":1272 * n_features, p) * if dist_pt <= r_p: * indices[idx_i] = idx_array[i] # <<<<<<<<<<<<<< @@ -7414,7 +7623,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ (__pyx_v_indices[__pyx_v_idx_i]) = (__pyx_v_idx_array[__pyx_v_i]); - /* "sklearn/neighbors/ball_tree.pyx":1271 + /* "sklearn/neighbors/ball_tree.pyx":1273 * if dist_pt <= r_p: * indices[idx_i] = idx_array[i] * distances[idx_i] = dist_from_dist_p(dist_pt, p) # <<<<<<<<<<<<<< @@ -7423,7 +7632,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ (__pyx_v_distances[__pyx_v_idx_i]) = __pyx_f_7sklearn_9neighbors_9ball_tree_dist_from_dist_p(__pyx_v_dist_pt, __pyx_v_p); - /* "sklearn/neighbors/ball_tree.pyx":1272 + /* "sklearn/neighbors/ball_tree.pyx":1274 * indices[idx_i] = idx_array[i] * distances[idx_i] = dist_from_dist_p(dist_pt, p) * idx_i += 1 # <<<<<<<<<<<<<< @@ -7439,7 +7648,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1277 + /* "sklearn/neighbors/ball_tree.pyx":1279 * # Case 4: Node is not a leaf. Recursively query subnodes * else: * item.i_node = 2 * i_node + 1 # <<<<<<<<<<<<<< @@ -7448,7 +7657,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_item.i_node = ((2 * __pyx_v_i_node) + 1); - /* "sklearn/neighbors/ball_tree.pyx":1278 + /* "sklearn/neighbors/ball_tree.pyx":1280 * else: * item.i_node = 2 * i_node + 1 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -7457,18 +7666,18 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_stack_push(__pyx_v_node_stack, __pyx_v_item); - /* "sklearn/neighbors/ball_tree.pyx":1280 + /* "sklearn/neighbors/ball_tree.pyx":1282 * stack_push(node_stack, item) * * item.i_node = i = 2 * i_node + 2 # <<<<<<<<<<<<<< * stack_push(node_stack, item) * */ - __pyx_t_3 = ((2 * __pyx_v_i_node) + 2); - __pyx_v_item.i_node = __pyx_t_3; - __pyx_v_i = __pyx_t_3; + __pyx_t_4 = ((2 * __pyx_v_i_node) + 2); + __pyx_v_item.i_node = __pyx_t_4; + __pyx_v_i = __pyx_t_4; - /* "sklearn/neighbors/ball_tree.pyx":1281 + /* "sklearn/neighbors/ball_tree.pyx":1283 * * item.i_node = i = 2 * i_node + 2 * stack_push(node_stack, item) # <<<<<<<<<<<<<< @@ -7481,7 +7690,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_L3_continue:; } - /* "sklearn/neighbors/ball_tree.pyx":1283 + /* "sklearn/neighbors/ball_tree.pyx":1285 * stack_push(node_stack, item) * * return idx_i # <<<<<<<<<<<<<< @@ -7497,7 +7706,18 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":478 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_4data_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_4data_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4data___get__(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/neighbors/ball_tree.pyx":480 * [ 0. 0.19662693 0.29473397] * """ * cdef readonly np.ndarray data # <<<<<<<<<<<<<< @@ -7505,14 +7725,13 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor * cdef np.ndarray node_centroid_arr */ -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4data___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4data___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4data___get__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data)); - __pyx_r = ((PyObject *)((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->data); + __Pyx_INCREF(((PyObject *)__pyx_v_self->data)); + __pyx_r = ((PyObject *)__pyx_v_self->data); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -7522,7 +7741,18 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4data___get__ return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":486 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_flag_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_flag_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_flag___get__(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/neighbors/ball_tree.pyx":488 * cdef ITYPE_t n_levels * cdef ITYPE_t n_nodes * cdef readonly int warning_flag # <<<<<<<<<<<<<< @@ -7530,17 +7760,16 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4data___get__ * def __cinit__(self): */ -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_flag___get__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_flag___get__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_flag___get__(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__"); + __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)__pyx_v_self)->warning_flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->warning_flag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7558,7 +7787,7 @@ static PyObject *__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_fla return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1290 +/* "sklearn/neighbors/ball_tree.pyx":1292 * # * @cython.profile(False) * cdef inline void copy_array(DTYPE_t* x, DTYPE_t* y, ITYPE_t n): # <<<<<<<<<<<<<< @@ -7570,9 +7799,9 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_copy_array(__py __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_i; __Pyx_RefNannyDeclarations __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_1; - __Pyx_RefNannySetupContext("copy_array"); + __Pyx_RefNannySetupContext("copy_array", 0); - /* "sklearn/neighbors/ball_tree.pyx":1293 + /* "sklearn/neighbors/ball_tree.pyx":1295 * # copy array y into array x * cdef ITYPE_t i * for i from 0 <= i < n: # <<<<<<<<<<<<<< @@ -7582,7 +7811,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_copy_array(__py __pyx_t_1 = __pyx_v_n; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1294 + /* "sklearn/neighbors/ball_tree.pyx":1296 * cdef ITYPE_t i * for i from 0 <= i < n: * x[i] = y[i] # <<<<<<<<<<<<<< @@ -7595,7 +7824,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_copy_array(__py __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":1298 +/* "sklearn/neighbors/ball_tree.pyx":1300 * * @cython.cdivision(True) * cdef void compute_centroid(DTYPE_t* centroid, # <<<<<<<<<<<<<< @@ -7611,9 +7840,9 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_t_7skl __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_1; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_3; - __Pyx_RefNannySetupContext("compute_centroid"); + __Pyx_RefNannySetupContext("compute_centroid", 0); - /* "sklearn/neighbors/ball_tree.pyx":1309 + /* "sklearn/neighbors/ball_tree.pyx":1311 * cdef ITYPE_t i, j * * for j from 0 <= j < n_features: # <<<<<<<<<<<<<< @@ -7623,7 +7852,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_t_7skl __pyx_t_1 = __pyx_v_n_features; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_1; __pyx_v_j++) { - /* "sklearn/neighbors/ball_tree.pyx":1310 + /* "sklearn/neighbors/ball_tree.pyx":1312 * * for j from 0 <= j < n_features: * centroid[j] = 0 # <<<<<<<<<<<<<< @@ -7633,7 +7862,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_t_7skl (__pyx_v_centroid[__pyx_v_j]) = 0.0; } - /* "sklearn/neighbors/ball_tree.pyx":1312 + /* "sklearn/neighbors/ball_tree.pyx":1314 * centroid[j] = 0 * * for i from 0 <= i < n_points: # <<<<<<<<<<<<<< @@ -7643,7 +7872,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_t_7skl __pyx_t_1 = __pyx_v_n_points; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1313 + /* "sklearn/neighbors/ball_tree.pyx":1315 * * for i from 0 <= i < n_points: * this_pt = data + n_features * node_indices[i] # <<<<<<<<<<<<<< @@ -7652,7 +7881,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_t_7skl */ __pyx_v_this_pt = (__pyx_v_data + (__pyx_v_n_features * (__pyx_v_node_indices[__pyx_v_i]))); - /* "sklearn/neighbors/ball_tree.pyx":1314 + /* "sklearn/neighbors/ball_tree.pyx":1316 * for i from 0 <= i < n_points: * this_pt = data + n_features * node_indices[i] * for j from 0 <= j < n_features: # <<<<<<<<<<<<<< @@ -7662,7 +7891,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_t_7skl __pyx_t_2 = __pyx_v_n_features; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "sklearn/neighbors/ball_tree.pyx":1315 + /* "sklearn/neighbors/ball_tree.pyx":1317 * this_pt = data + n_features * node_indices[i] * for j from 0 <= j < n_features: * centroid[j] += this_pt[j] # <<<<<<<<<<<<<< @@ -7674,7 +7903,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_t_7skl } } - /* "sklearn/neighbors/ball_tree.pyx":1317 + /* "sklearn/neighbors/ball_tree.pyx":1319 * centroid[j] += this_pt[j] * * for j from 0 <= j < n_features: # <<<<<<<<<<<<<< @@ -7684,7 +7913,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_t_7skl __pyx_t_1 = __pyx_v_n_features; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_1; __pyx_v_j++) { - /* "sklearn/neighbors/ball_tree.pyx":1318 + /* "sklearn/neighbors/ball_tree.pyx":1320 * * for j from 0 <= j < n_features: * centroid[j] /= n_points # <<<<<<<<<<<<<< @@ -7698,7 +7927,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_compute_centroid(__pyx_t_7skl __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":1321 +/* "sklearn/neighbors/ball_tree.pyx":1323 * * * cdef ITYPE_t find_split_dim(DTYPE_t* data, # <<<<<<<<<<<<<< @@ -7720,9 +7949,9 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_1; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("find_split_dim"); + __Pyx_RefNannySetupContext("find_split_dim", 0); - /* "sklearn/neighbors/ball_tree.pyx":1330 + /* "sklearn/neighbors/ball_tree.pyx":1332 * cdef ITYPE_t i, j, j_max * * j_max = 0 # <<<<<<<<<<<<<< @@ -7731,7 +7960,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_j_max = 0; - /* "sklearn/neighbors/ball_tree.pyx":1331 + /* "sklearn/neighbors/ball_tree.pyx":1333 * * j_max = 0 * max_spread = 0 # <<<<<<<<<<<<<< @@ -7740,7 +7969,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_max_spread = 0.0; - /* "sklearn/neighbors/ball_tree.pyx":1333 + /* "sklearn/neighbors/ball_tree.pyx":1335 * max_spread = 0 * * for j from 0 <= j < n_features: # <<<<<<<<<<<<<< @@ -7750,7 +7979,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = __pyx_v_n_features; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_1; __pyx_v_j++) { - /* "sklearn/neighbors/ball_tree.pyx":1334 + /* "sklearn/neighbors/ball_tree.pyx":1336 * * for j from 0 <= j < n_features: * max_val = data[node_indices[0] * n_features + j] # <<<<<<<<<<<<<< @@ -7759,7 +7988,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_max_val = (__pyx_v_data[(((__pyx_v_node_indices[0]) * __pyx_v_n_features) + __pyx_v_j)]); - /* "sklearn/neighbors/ball_tree.pyx":1335 + /* "sklearn/neighbors/ball_tree.pyx":1337 * for j from 0 <= j < n_features: * max_val = data[node_indices[0] * n_features + j] * min_val = max_val # <<<<<<<<<<<<<< @@ -7768,7 +7997,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_min_val = __pyx_v_max_val; - /* "sklearn/neighbors/ball_tree.pyx":1336 + /* "sklearn/neighbors/ball_tree.pyx":1338 * max_val = data[node_indices[0] * n_features + j] * min_val = max_val * for i from 1 <= i < n_points: # <<<<<<<<<<<<<< @@ -7778,7 +8007,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = __pyx_v_n_points; for (__pyx_v_i = 1; __pyx_v_i < __pyx_t_2; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1337 + /* "sklearn/neighbors/ball_tree.pyx":1339 * min_val = max_val * for i from 1 <= i < n_points: * val = data[node_indices[i] * n_features + j] # <<<<<<<<<<<<<< @@ -7787,7 +8016,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_val = (__pyx_v_data[(((__pyx_v_node_indices[__pyx_v_i]) * __pyx_v_n_features) + __pyx_v_j)]); - /* "sklearn/neighbors/ball_tree.pyx":1338 + /* "sklearn/neighbors/ball_tree.pyx":1340 * for i from 1 <= i < n_points: * val = data[node_indices[i] * n_features + j] * max_val = dmax(max_val, val) # <<<<<<<<<<<<<< @@ -7796,7 +8025,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_max_val = __pyx_f_7sklearn_9neighbors_9ball_tree_dmax(__pyx_v_max_val, __pyx_v_val); - /* "sklearn/neighbors/ball_tree.pyx":1339 + /* "sklearn/neighbors/ball_tree.pyx":1341 * val = data[node_indices[i] * n_features + j] * max_val = dmax(max_val, val) * min_val = dmin(min_val, val) # <<<<<<<<<<<<<< @@ -7806,7 +8035,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_v_min_val = __pyx_f_7sklearn_9neighbors_9ball_tree_dmin(__pyx_v_min_val, __pyx_v_val); } - /* "sklearn/neighbors/ball_tree.pyx":1340 + /* "sklearn/neighbors/ball_tree.pyx":1342 * max_val = dmax(max_val, val) * min_val = dmin(min_val, val) * spread = max_val - min_val # <<<<<<<<<<<<<< @@ -7815,7 +8044,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_spread = (__pyx_v_max_val - __pyx_v_min_val); - /* "sklearn/neighbors/ball_tree.pyx":1341 + /* "sklearn/neighbors/ball_tree.pyx":1343 * min_val = dmin(min_val, val) * spread = max_val - min_val * if spread > max_spread: # <<<<<<<<<<<<<< @@ -7825,7 +8054,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_3 = (__pyx_v_spread > __pyx_v_max_spread); if (__pyx_t_3) { - /* "sklearn/neighbors/ball_tree.pyx":1342 + /* "sklearn/neighbors/ball_tree.pyx":1344 * spread = max_val - min_val * if spread > max_spread: * max_spread = spread # <<<<<<<<<<<<<< @@ -7834,7 +8063,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_max_spread = __pyx_v_spread; - /* "sklearn/neighbors/ball_tree.pyx":1343 + /* "sklearn/neighbors/ball_tree.pyx":1345 * if spread > max_spread: * max_spread = spread * j_max = j # <<<<<<<<<<<<<< @@ -7847,7 +8076,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_L7:; } - /* "sklearn/neighbors/ball_tree.pyx":1344 + /* "sklearn/neighbors/ball_tree.pyx":1346 * max_spread = spread * j_max = j * return j_max # <<<<<<<<<<<<<< @@ -7863,7 +8092,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1348 +/* "sklearn/neighbors/ball_tree.pyx":1350 * * @cython.profile(False) * cdef inline void iswap(ITYPE_t* arr, ITYPE_t i1, ITYPE_t i2): # <<<<<<<<<<<<<< @@ -7874,9 +8103,9 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *__pyx_v_arr, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_i1, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_i2) { __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_tmp; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("iswap"); + __Pyx_RefNannySetupContext("iswap", 0); - /* "sklearn/neighbors/ball_tree.pyx":1349 + /* "sklearn/neighbors/ball_tree.pyx":1351 * @cython.profile(False) * cdef inline void iswap(ITYPE_t* arr, ITYPE_t i1, ITYPE_t i2): * cdef ITYPE_t tmp = arr[i1] # <<<<<<<<<<<<<< @@ -7885,7 +8114,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_t_7 */ __pyx_v_tmp = (__pyx_v_arr[__pyx_v_i1]); - /* "sklearn/neighbors/ball_tree.pyx":1350 + /* "sklearn/neighbors/ball_tree.pyx":1352 * cdef inline void iswap(ITYPE_t* arr, ITYPE_t i1, ITYPE_t i2): * cdef ITYPE_t tmp = arr[i1] * arr[i1] = arr[i2] # <<<<<<<<<<<<<< @@ -7894,7 +8123,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_t_7 */ (__pyx_v_arr[__pyx_v_i1]) = (__pyx_v_arr[__pyx_v_i2]); - /* "sklearn/neighbors/ball_tree.pyx":1351 + /* "sklearn/neighbors/ball_tree.pyx":1353 * cdef ITYPE_t tmp = arr[i1] * arr[i1] = arr[i2] * arr[i2] = tmp # <<<<<<<<<<<<<< @@ -7906,7 +8135,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_t_7 __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":1355 +/* "sklearn/neighbors/ball_tree.pyx":1357 * * @cython.profile(False) * cdef inline void dswap(DTYPE_t* arr, ITYPE_t i1, ITYPE_t i2): # <<<<<<<<<<<<<< @@ -7917,9 +8146,9 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_t_7 static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_dswap(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_arr, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_i1, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_i2) { __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_v_tmp; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("dswap"); + __Pyx_RefNannySetupContext("dswap", 0); - /* "sklearn/neighbors/ball_tree.pyx":1356 + /* "sklearn/neighbors/ball_tree.pyx":1358 * @cython.profile(False) * cdef inline void dswap(DTYPE_t* arr, ITYPE_t i1, ITYPE_t i2): * cdef DTYPE_t tmp = arr[i1] # <<<<<<<<<<<<<< @@ -7928,7 +8157,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_dswap(__pyx_t_7 */ __pyx_v_tmp = (__pyx_v_arr[__pyx_v_i1]); - /* "sklearn/neighbors/ball_tree.pyx":1357 + /* "sklearn/neighbors/ball_tree.pyx":1359 * cdef inline void dswap(DTYPE_t* arr, ITYPE_t i1, ITYPE_t i2): * cdef DTYPE_t tmp = arr[i1] * arr[i1] = arr[i2] # <<<<<<<<<<<<<< @@ -7937,7 +8166,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_dswap(__pyx_t_7 */ (__pyx_v_arr[__pyx_v_i1]) = (__pyx_v_arr[__pyx_v_i2]); - /* "sklearn/neighbors/ball_tree.pyx":1358 + /* "sklearn/neighbors/ball_tree.pyx":1360 * cdef DTYPE_t tmp = arr[i1] * arr[i1] = arr[i2] * arr[i2] = tmp # <<<<<<<<<<<<<< @@ -7949,7 +8178,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_dswap(__pyx_t_7 __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":1361 +/* "sklearn/neighbors/ball_tree.pyx":1363 * * * cdef void partition_indices(DTYPE_t* data, # <<<<<<<<<<<<<< @@ -7967,9 +8196,9 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk __Pyx_RefNannyDeclarations __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("partition_indices"); + __Pyx_RefNannySetupContext("partition_indices", 0); - /* "sklearn/neighbors/ball_tree.pyx":1377 + /* "sklearn/neighbors/ball_tree.pyx":1379 * cdef ITYPE_t left, right, midindex, i * cdef DTYPE_t d1, d2 * left = 0 # <<<<<<<<<<<<<< @@ -7978,7 +8207,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk */ __pyx_v_left = 0; - /* "sklearn/neighbors/ball_tree.pyx":1378 + /* "sklearn/neighbors/ball_tree.pyx":1380 * cdef DTYPE_t d1, d2 * left = 0 * right = n_points - 1 # <<<<<<<<<<<<<< @@ -7987,7 +8216,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk */ __pyx_v_right = (__pyx_v_n_points - 1); - /* "sklearn/neighbors/ball_tree.pyx":1380 + /* "sklearn/neighbors/ball_tree.pyx":1382 * right = n_points - 1 * * while True: # <<<<<<<<<<<<<< @@ -7997,7 +8226,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk while (1) { if (!1) break; - /* "sklearn/neighbors/ball_tree.pyx":1381 + /* "sklearn/neighbors/ball_tree.pyx":1383 * * while True: * midindex = left # <<<<<<<<<<<<<< @@ -8006,7 +8235,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk */ __pyx_v_midindex = __pyx_v_left; - /* "sklearn/neighbors/ball_tree.pyx":1382 + /* "sklearn/neighbors/ball_tree.pyx":1384 * while True: * midindex = left * for i from left <= i < right: # <<<<<<<<<<<<<< @@ -8016,7 +8245,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk __pyx_t_1 = __pyx_v_right; for (__pyx_v_i = __pyx_v_left; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1383 + /* "sklearn/neighbors/ball_tree.pyx":1385 * midindex = left * for i from left <= i < right: * d1 = data[node_indices[i] * n_features + split_dim] # <<<<<<<<<<<<<< @@ -8025,7 +8254,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk */ __pyx_v_d1 = (__pyx_v_data[(((__pyx_v_node_indices[__pyx_v_i]) * __pyx_v_n_features) + __pyx_v_split_dim)]); - /* "sklearn/neighbors/ball_tree.pyx":1384 + /* "sklearn/neighbors/ball_tree.pyx":1386 * for i from left <= i < right: * d1 = data[node_indices[i] * n_features + split_dim] * d2 = data[node_indices[right] * n_features + split_dim] # <<<<<<<<<<<<<< @@ -8034,7 +8263,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk */ __pyx_v_d2 = (__pyx_v_data[(((__pyx_v_node_indices[__pyx_v_right]) * __pyx_v_n_features) + __pyx_v_split_dim)]); - /* "sklearn/neighbors/ball_tree.pyx":1385 + /* "sklearn/neighbors/ball_tree.pyx":1387 * d1 = data[node_indices[i] * n_features + split_dim] * d2 = data[node_indices[right] * n_features + split_dim] * if d1 < d2: # <<<<<<<<<<<<<< @@ -8044,7 +8273,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk __pyx_t_2 = (__pyx_v_d1 < __pyx_v_d2); if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1386 + /* "sklearn/neighbors/ball_tree.pyx":1388 * d2 = data[node_indices[right] * n_features + split_dim] * if d1 < d2: * iswap(node_indices, i, midindex) # <<<<<<<<<<<<<< @@ -8053,7 +8282,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk */ __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_v_node_indices, __pyx_v_i, __pyx_v_midindex); - /* "sklearn/neighbors/ball_tree.pyx":1387 + /* "sklearn/neighbors/ball_tree.pyx":1389 * if d1 < d2: * iswap(node_indices, i, midindex) * midindex += 1 # <<<<<<<<<<<<<< @@ -8066,7 +8295,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk __pyx_L7:; } - /* "sklearn/neighbors/ball_tree.pyx":1388 + /* "sklearn/neighbors/ball_tree.pyx":1390 * iswap(node_indices, i, midindex) * midindex += 1 * iswap(node_indices, midindex, right) # <<<<<<<<<<<<<< @@ -8075,7 +8304,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk */ __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_v_node_indices, __pyx_v_midindex, __pyx_v_right); - /* "sklearn/neighbors/ball_tree.pyx":1389 + /* "sklearn/neighbors/ball_tree.pyx":1391 * midindex += 1 * iswap(node_indices, midindex, right) * if midindex == split_index: # <<<<<<<<<<<<<< @@ -8085,7 +8314,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk __pyx_t_2 = (__pyx_v_midindex == __pyx_v_split_index); if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1390 + /* "sklearn/neighbors/ball_tree.pyx":1392 * iswap(node_indices, midindex, right) * if midindex == split_index: * break # <<<<<<<<<<<<<< @@ -8096,7 +8325,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk goto __pyx_L8; } - /* "sklearn/neighbors/ball_tree.pyx":1391 + /* "sklearn/neighbors/ball_tree.pyx":1393 * if midindex == split_index: * break * elif midindex < split_index: # <<<<<<<<<<<<<< @@ -8106,7 +8335,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk __pyx_t_2 = (__pyx_v_midindex < __pyx_v_split_index); if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1392 + /* "sklearn/neighbors/ball_tree.pyx":1394 * break * elif midindex < split_index: * left = midindex + 1 # <<<<<<<<<<<<<< @@ -8118,7 +8347,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1394 + /* "sklearn/neighbors/ball_tree.pyx":1396 * left = midindex + 1 * else: * right = midindex - 1 # <<<<<<<<<<<<<< @@ -8134,7 +8363,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":1402 +/* "sklearn/neighbors/ball_tree.pyx":1404 * # This calculates the lower-bound distance between a point and a node * @cython.profile(False) * cdef inline DTYPE_t calc_dist_LB(DTYPE_t* pt, # <<<<<<<<<<<<<< @@ -8145,9 +8374,9 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_partition_indices(__pyx_t_7sk static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_calc_dist_LB(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_pt, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_centroid, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_v_radius, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_n_features, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_v_p) { __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calc_dist_LB"); + __Pyx_RefNannySetupContext("calc_dist_LB", 0); - /* "sklearn/neighbors/ball_tree.pyx":1408 + /* "sklearn/neighbors/ball_tree.pyx":1410 * DTYPE_t p): * return dmax(0, (dist(pt, centroid, n_features, p) * - radius)) # <<<<<<<<<<<<<< @@ -8163,7 +8392,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1412 +/* "sklearn/neighbors/ball_tree.pyx":1414 * * @cython.profile(False) * cdef inline DTYPE_t calc_dist_p_LB(DTYPE_t* pt, # <<<<<<<<<<<<<< @@ -8174,9 +8403,9 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_calc_dist_p_LB(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_pt, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_centroid, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_v_radius, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_n_features, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_v_p) { __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("calc_dist_p_LB"); + __Pyx_RefNannySetupContext("calc_dist_p_LB", 0); - /* "sklearn/neighbors/ball_tree.pyx":1418 + /* "sklearn/neighbors/ball_tree.pyx":1420 * DTYPE_t p): * return dist_p_from_dist(dmax(0, (dist(pt, centroid, n_features, p) * - radius)), p) # <<<<<<<<<<<<<< @@ -8192,7 +8421,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1428 +/* "sklearn/neighbors/ball_tree.pyx":1430 * # are represented by infinities. * @cython.profile(False) * cdef inline DTYPE_t pqueue_largest(DTYPE_t* queue, ITYPE_t queue_size): # <<<<<<<<<<<<<< @@ -8203,9 +8432,9 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_largest(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_queue, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_queue_size) { __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pqueue_largest"); + __Pyx_RefNannySetupContext("pqueue_largest", 0); - /* "sklearn/neighbors/ball_tree.pyx":1429 + /* "sklearn/neighbors/ball_tree.pyx":1431 * @cython.profile(False) * cdef inline DTYPE_t pqueue_largest(DTYPE_t* queue, ITYPE_t queue_size): * return queue[queue_size - 1] # <<<<<<<<<<<<<< @@ -8221,7 +8450,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1432 +/* "sklearn/neighbors/ball_tree.pyx":1434 * * * cdef inline ITYPE_t pqueue_idx_largest(ITYPE_t* idx_array, ITYPE_t queue_size): # <<<<<<<<<<<<<< @@ -8232,9 +8461,9 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_idx_largest(__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *__pyx_v_idx_array, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_queue_size) { __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pqueue_idx_largest"); + __Pyx_RefNannySetupContext("pqueue_idx_largest", 0); - /* "sklearn/neighbors/ball_tree.pyx":1433 + /* "sklearn/neighbors/ball_tree.pyx":1435 * * cdef inline ITYPE_t pqueue_idx_largest(ITYPE_t* idx_array, ITYPE_t queue_size): * return idx_array[queue_size - 1] # <<<<<<<<<<<<<< @@ -8250,7 +8479,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7skl return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1436 +/* "sklearn/neighbors/ball_tree.pyx":1438 * * * cdef inline void pqueue_insert(DTYPE_t val, ITYPE_t i_val, # <<<<<<<<<<<<<< @@ -8266,9 +8495,9 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ __Pyx_RefNannyDeclarations int __pyx_t_1; __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_t_2; - __Pyx_RefNannySetupContext("pqueue_insert"); + __Pyx_RefNannySetupContext("pqueue_insert", 0); - /* "sklearn/neighbors/ball_tree.pyx":1439 + /* "sklearn/neighbors/ball_tree.pyx":1441 * DTYPE_t* queue, ITYPE_t* idx_array, * ITYPE_t queue_size): * cdef ITYPE_t i_lower = 0 # <<<<<<<<<<<<<< @@ -8277,7 +8506,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ */ __pyx_v_i_lower = 0; - /* "sklearn/neighbors/ball_tree.pyx":1440 + /* "sklearn/neighbors/ball_tree.pyx":1442 * ITYPE_t queue_size): * cdef ITYPE_t i_lower = 0 * cdef ITYPE_t i_upper = queue_size - 1 # <<<<<<<<<<<<<< @@ -8286,7 +8515,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ */ __pyx_v_i_upper = (__pyx_v_queue_size - 1); - /* "sklearn/neighbors/ball_tree.pyx":1444 + /* "sklearn/neighbors/ball_tree.pyx":1446 * cdef ITYPE_t i * * if val >= queue[i_upper]: # <<<<<<<<<<<<<< @@ -8296,7 +8525,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ __pyx_t_1 = (__pyx_v_val >= (__pyx_v_queue[__pyx_v_i_upper])); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1445 + /* "sklearn/neighbors/ball_tree.pyx":1447 * * if val >= queue[i_upper]: * return # <<<<<<<<<<<<<< @@ -8307,7 +8536,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ goto __pyx_L3; } - /* "sklearn/neighbors/ball_tree.pyx":1446 + /* "sklearn/neighbors/ball_tree.pyx":1448 * if val >= queue[i_upper]: * return * elif val <= queue[i_lower]: # <<<<<<<<<<<<<< @@ -8317,7 +8546,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ __pyx_t_1 = (__pyx_v_val <= (__pyx_v_queue[__pyx_v_i_lower])); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1447 + /* "sklearn/neighbors/ball_tree.pyx":1449 * return * elif val <= queue[i_lower]: * i_mid = i_lower # <<<<<<<<<<<<<< @@ -8329,7 +8558,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1449 + /* "sklearn/neighbors/ball_tree.pyx":1451 * i_mid = i_lower * else: * while True: # <<<<<<<<<<<<<< @@ -8339,7 +8568,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ while (1) { if (!1) break; - /* "sklearn/neighbors/ball_tree.pyx":1450 + /* "sklearn/neighbors/ball_tree.pyx":1452 * else: * while True: * if (i_upper - i_lower) < 2: # <<<<<<<<<<<<<< @@ -8349,7 +8578,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ __pyx_t_1 = ((__pyx_v_i_upper - __pyx_v_i_lower) < 2); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1451 + /* "sklearn/neighbors/ball_tree.pyx":1453 * while True: * if (i_upper - i_lower) < 2: * i_mid = i_lower + 1 # <<<<<<<<<<<<<< @@ -8358,7 +8587,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ */ __pyx_v_i_mid = (__pyx_v_i_lower + 1); - /* "sklearn/neighbors/ball_tree.pyx":1452 + /* "sklearn/neighbors/ball_tree.pyx":1454 * if (i_upper - i_lower) < 2: * i_mid = i_lower + 1 * break # <<<<<<<<<<<<<< @@ -8370,7 +8599,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1454 + /* "sklearn/neighbors/ball_tree.pyx":1456 * break * else: * i_mid = (i_lower + i_upper) / 2 # <<<<<<<<<<<<<< @@ -8381,7 +8610,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ } __pyx_L6:; - /* "sklearn/neighbors/ball_tree.pyx":1456 + /* "sklearn/neighbors/ball_tree.pyx":1458 * i_mid = (i_lower + i_upper) / 2 * * if i_mid == i_lower: # <<<<<<<<<<<<<< @@ -8391,7 +8620,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ __pyx_t_1 = (__pyx_v_i_mid == __pyx_v_i_lower); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1457 + /* "sklearn/neighbors/ball_tree.pyx":1459 * * if i_mid == i_lower: * i_mid += 1 # <<<<<<<<<<<<<< @@ -8400,7 +8629,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ */ __pyx_v_i_mid = (__pyx_v_i_mid + 1); - /* "sklearn/neighbors/ball_tree.pyx":1458 + /* "sklearn/neighbors/ball_tree.pyx":1460 * if i_mid == i_lower: * i_mid += 1 * break # <<<<<<<<<<<<<< @@ -8412,7 +8641,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ } __pyx_L7:; - /* "sklearn/neighbors/ball_tree.pyx":1460 + /* "sklearn/neighbors/ball_tree.pyx":1462 * break * * if val >= queue[i_mid]: # <<<<<<<<<<<<<< @@ -8422,7 +8651,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ __pyx_t_1 = (__pyx_v_val >= (__pyx_v_queue[__pyx_v_i_mid])); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1461 + /* "sklearn/neighbors/ball_tree.pyx":1463 * * if val >= queue[i_mid]: * i_lower = i_mid # <<<<<<<<<<<<<< @@ -8434,7 +8663,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1463 + /* "sklearn/neighbors/ball_tree.pyx":1465 * i_lower = i_mid * else: * i_upper = i_mid # <<<<<<<<<<<<<< @@ -8449,7 +8678,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ } __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":1465 + /* "sklearn/neighbors/ball_tree.pyx":1467 * i_upper = i_mid * * for i from queue_size > i > i_mid: # <<<<<<<<<<<<<< @@ -8459,7 +8688,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ __pyx_t_2 = __pyx_v_i_mid; for (__pyx_v_i = __pyx_v_queue_size-1; __pyx_v_i > __pyx_t_2; __pyx_v_i--) { - /* "sklearn/neighbors/ball_tree.pyx":1466 + /* "sklearn/neighbors/ball_tree.pyx":1468 * * for i from queue_size > i > i_mid: * queue[i] = queue[i - 1] # <<<<<<<<<<<<<< @@ -8468,7 +8697,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ */ (__pyx_v_queue[__pyx_v_i]) = (__pyx_v_queue[(__pyx_v_i - 1)]); - /* "sklearn/neighbors/ball_tree.pyx":1467 + /* "sklearn/neighbors/ball_tree.pyx":1469 * for i from queue_size > i > i_mid: * queue[i] = queue[i - 1] * idx_array[i] = idx_array[i - 1] # <<<<<<<<<<<<<< @@ -8478,7 +8707,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ (__pyx_v_idx_array[__pyx_v_i]) = (__pyx_v_idx_array[(__pyx_v_i - 1)]); } - /* "sklearn/neighbors/ball_tree.pyx":1469 + /* "sklearn/neighbors/ball_tree.pyx":1471 * idx_array[i] = idx_array[i - 1] * * queue[i_mid] = val # <<<<<<<<<<<<<< @@ -8487,7 +8716,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ */ (__pyx_v_queue[__pyx_v_i_mid]) = __pyx_v_val; - /* "sklearn/neighbors/ball_tree.pyx":1470 + /* "sklearn/neighbors/ball_tree.pyx":1472 * * queue[i_mid] = val * idx_array[i_mid] = i_val # <<<<<<<<<<<<<< @@ -8500,7 +8729,7 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":1496 +/* "sklearn/neighbors/ball_tree.pyx":1498 * # `sort_dist_idx()` * @cython.profile(False) * cdef inline DTYPE_t max_heap_largest(DTYPE_t* heap, ITYPE_t k): # <<<<<<<<<<<<<< @@ -8508,12 +8737,12 @@ static CYTHON_INLINE void __pyx_f_7sklearn_9neighbors_9ball_tree_pqueue_insert(_ * */ -static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_largest(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_heap, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_k) { +static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_largest(__pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *__pyx_v_heap, CYTHON_UNUSED __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_k) { __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("max_heap_largest"); + __Pyx_RefNannySetupContext("max_heap_largest", 0); - /* "sklearn/neighbors/ball_tree.pyx":1497 + /* "sklearn/neighbors/ball_tree.pyx":1499 * @cython.profile(False) * cdef inline DTYPE_t max_heap_largest(DTYPE_t* heap, ITYPE_t k): * return heap[0] # <<<<<<<<<<<<<< @@ -8529,7 +8758,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1501 +/* "sklearn/neighbors/ball_tree.pyx":1503 * * @cython.profile(False) * cdef inline ITYPE_t max_heap_idx_largest(ITYPE_t* idx_array, ITYPE_t k): # <<<<<<<<<<<<<< @@ -8537,12 +8766,12 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t __pyx_f_7skl * */ -static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_idx_largest(__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *__pyx_v_idx_array, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_k) { +static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_idx_largest(__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *__pyx_v_idx_array, CYTHON_UNUSED __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_k) { __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("max_heap_idx_largest"); + __Pyx_RefNannySetupContext("max_heap_idx_largest", 0); - /* "sklearn/neighbors/ball_tree.pyx":1502 + /* "sklearn/neighbors/ball_tree.pyx":1504 * @cython.profile(False) * cdef inline ITYPE_t max_heap_idx_largest(ITYPE_t* idx_array, ITYPE_t k): * return idx_array[0] # <<<<<<<<<<<<<< @@ -8558,7 +8787,7 @@ static CYTHON_INLINE __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7skl return __pyx_r; } -/* "sklearn/neighbors/ball_tree.pyx":1505 +/* "sklearn/neighbors/ball_tree.pyx":1507 * * * cdef void max_heap_insert(DTYPE_t val, ITYPE_t i_val, # <<<<<<<<<<<<<< @@ -8573,9 +8802,9 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_i_swap; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("max_heap_insert"); + __Pyx_RefNannySetupContext("max_heap_insert", 0); - /* "sklearn/neighbors/ball_tree.pyx":1513 + /* "sklearn/neighbors/ball_tree.pyx":1515 * * # check if val should be in heap * if val > heap[0]: # <<<<<<<<<<<<<< @@ -8585,7 +8814,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle __pyx_t_1 = (__pyx_v_val > (__pyx_v_heap[0])); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1514 + /* "sklearn/neighbors/ball_tree.pyx":1516 * # check if val should be in heap * if val > heap[0]: * return # <<<<<<<<<<<<<< @@ -8597,7 +8826,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle } __pyx_L3:; - /* "sklearn/neighbors/ball_tree.pyx":1517 + /* "sklearn/neighbors/ball_tree.pyx":1519 * * # insert val at position zero * heap[0] = val # <<<<<<<<<<<<<< @@ -8606,7 +8835,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle */ (__pyx_v_heap[0]) = __pyx_v_val; - /* "sklearn/neighbors/ball_tree.pyx":1518 + /* "sklearn/neighbors/ball_tree.pyx":1520 * # insert val at position zero * heap[0] = val * idx_array[0] = i_val # <<<<<<<<<<<<<< @@ -8615,7 +8844,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle */ (__pyx_v_idx_array[0]) = __pyx_v_i_val; - /* "sklearn/neighbors/ball_tree.pyx":1521 + /* "sklearn/neighbors/ball_tree.pyx":1523 * * #descend the heap, swapping values until the max heap criterion is met * i = 0 # <<<<<<<<<<<<<< @@ -8624,7 +8853,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle */ __pyx_v_i = 0; - /* "sklearn/neighbors/ball_tree.pyx":1522 + /* "sklearn/neighbors/ball_tree.pyx":1524 * #descend the heap, swapping values until the max heap criterion is met * i = 0 * while 1: # <<<<<<<<<<<<<< @@ -8634,7 +8863,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle while (1) { if (!1) break; - /* "sklearn/neighbors/ball_tree.pyx":1523 + /* "sklearn/neighbors/ball_tree.pyx":1525 * i = 0 * while 1: * ic1 = 2 * i + 1 # <<<<<<<<<<<<<< @@ -8643,7 +8872,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle */ __pyx_v_ic1 = ((2 * __pyx_v_i) + 1); - /* "sklearn/neighbors/ball_tree.pyx":1524 + /* "sklearn/neighbors/ball_tree.pyx":1526 * while 1: * ic1 = 2 * i + 1 * ic2 = ic1 + 1 # <<<<<<<<<<<<<< @@ -8652,7 +8881,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle */ __pyx_v_ic2 = (__pyx_v_ic1 + 1); - /* "sklearn/neighbors/ball_tree.pyx":1526 + /* "sklearn/neighbors/ball_tree.pyx":1528 * ic2 = ic1 + 1 * * if ic1 >= heap_size: # <<<<<<<<<<<<<< @@ -8662,7 +8891,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle __pyx_t_1 = (__pyx_v_ic1 >= __pyx_v_heap_size); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1527 + /* "sklearn/neighbors/ball_tree.pyx":1529 * * if ic1 >= heap_size: * break # <<<<<<<<<<<<<< @@ -8673,7 +8902,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle goto __pyx_L6; } - /* "sklearn/neighbors/ball_tree.pyx":1528 + /* "sklearn/neighbors/ball_tree.pyx":1530 * if ic1 >= heap_size: * break * elif ic2 >= heap_size: # <<<<<<<<<<<<<< @@ -8683,7 +8912,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle __pyx_t_1 = (__pyx_v_ic2 >= __pyx_v_heap_size); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1529 + /* "sklearn/neighbors/ball_tree.pyx":1531 * break * elif ic2 >= heap_size: * if heap[ic1] > val: # <<<<<<<<<<<<<< @@ -8693,7 +8922,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle __pyx_t_1 = ((__pyx_v_heap[__pyx_v_ic1]) > __pyx_v_val); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1530 + /* "sklearn/neighbors/ball_tree.pyx":1532 * elif ic2 >= heap_size: * if heap[ic1] > val: * i_swap = ic1 # <<<<<<<<<<<<<< @@ -8705,7 +8934,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1532 + /* "sklearn/neighbors/ball_tree.pyx":1534 * i_swap = ic1 * else: * break # <<<<<<<<<<<<<< @@ -8718,7 +8947,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle goto __pyx_L6; } - /* "sklearn/neighbors/ball_tree.pyx":1533 + /* "sklearn/neighbors/ball_tree.pyx":1535 * else: * break * elif heap[ic1] >= heap[ic2]: # <<<<<<<<<<<<<< @@ -8728,7 +8957,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle __pyx_t_1 = ((__pyx_v_heap[__pyx_v_ic1]) >= (__pyx_v_heap[__pyx_v_ic2])); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1534 + /* "sklearn/neighbors/ball_tree.pyx":1536 * break * elif heap[ic1] >= heap[ic2]: * if val < heap[ic1]: # <<<<<<<<<<<<<< @@ -8738,7 +8967,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle __pyx_t_1 = (__pyx_v_val < (__pyx_v_heap[__pyx_v_ic1])); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1535 + /* "sklearn/neighbors/ball_tree.pyx":1537 * elif heap[ic1] >= heap[ic2]: * if val < heap[ic1]: * i_swap = ic1 # <<<<<<<<<<<<<< @@ -8750,7 +8979,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1537 + /* "sklearn/neighbors/ball_tree.pyx":1539 * i_swap = ic1 * else: * break # <<<<<<<<<<<<<< @@ -8764,7 +8993,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1539 + /* "sklearn/neighbors/ball_tree.pyx":1541 * break * else: * if val < heap[ic2]: # <<<<<<<<<<<<<< @@ -8774,7 +9003,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle __pyx_t_1 = (__pyx_v_val < (__pyx_v_heap[__pyx_v_ic2])); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1540 + /* "sklearn/neighbors/ball_tree.pyx":1542 * else: * if val < heap[ic2]: * i_swap = ic2 # <<<<<<<<<<<<<< @@ -8786,7 +9015,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle } /*else*/ { - /* "sklearn/neighbors/ball_tree.pyx":1542 + /* "sklearn/neighbors/ball_tree.pyx":1544 * i_swap = ic2 * else: * break # <<<<<<<<<<<<<< @@ -8799,7 +9028,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle } __pyx_L6:; - /* "sklearn/neighbors/ball_tree.pyx":1544 + /* "sklearn/neighbors/ball_tree.pyx":1546 * break * * heap[i] = heap[i_swap] # <<<<<<<<<<<<<< @@ -8808,7 +9037,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle */ (__pyx_v_heap[__pyx_v_i]) = (__pyx_v_heap[__pyx_v_i_swap]); - /* "sklearn/neighbors/ball_tree.pyx":1545 + /* "sklearn/neighbors/ball_tree.pyx":1547 * * heap[i] = heap[i_swap] * idx_array[i] = idx_array[i_swap] # <<<<<<<<<<<<<< @@ -8817,7 +9046,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle */ (__pyx_v_idx_array[__pyx_v_i]) = (__pyx_v_idx_array[__pyx_v_i_swap]); - /* "sklearn/neighbors/ball_tree.pyx":1547 + /* "sklearn/neighbors/ball_tree.pyx":1549 * idx_array[i] = idx_array[i_swap] * * i = i_swap # <<<<<<<<<<<<<< @@ -8828,7 +9057,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle } __pyx_L5_break:; - /* "sklearn/neighbors/ball_tree.pyx":1549 + /* "sklearn/neighbors/ball_tree.pyx":1551 * i = i_swap * * heap[i] = val # <<<<<<<<<<<<<< @@ -8837,7 +9066,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle */ (__pyx_v_heap[__pyx_v_i]) = __pyx_v_val; - /* "sklearn/neighbors/ball_tree.pyx":1550 + /* "sklearn/neighbors/ball_tree.pyx":1552 * * heap[i] = val * idx_array[i] = i_val # <<<<<<<<<<<<<< @@ -8850,7 +9079,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_max_heap_insert(__pyx_t_7skle __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":1557 +/* "sklearn/neighbors/ball_tree.pyx":1559 * # this is a quicksort implementation which sorts `dist` and * # simultaneously performs the same swaps on `idx`. * cdef void sort_dist_idx(DTYPE_t* dist, ITYPE_t* idx, ITYPE_t k): # <<<<<<<<<<<<<< @@ -8862,9 +9091,9 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_sort_dist_idx(__pyx_t_7sklear __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_v_pivot_idx; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("sort_dist_idx"); + __Pyx_RefNannySetupContext("sort_dist_idx", 0); - /* "sklearn/neighbors/ball_tree.pyx":1559 + /* "sklearn/neighbors/ball_tree.pyx":1561 * cdef void sort_dist_idx(DTYPE_t* dist, ITYPE_t* idx, ITYPE_t k): * cdef ITYPE_t pivot_idx * if k > 1: # <<<<<<<<<<<<<< @@ -8874,7 +9103,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_sort_dist_idx(__pyx_t_7sklear __pyx_t_1 = (__pyx_v_k > 1); if (__pyx_t_1) { - /* "sklearn/neighbors/ball_tree.pyx":1560 + /* "sklearn/neighbors/ball_tree.pyx":1562 * cdef ITYPE_t pivot_idx * if k > 1: * pivot_idx = partition_dist_idx(dist, idx, k) # <<<<<<<<<<<<<< @@ -8883,7 +9112,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_sort_dist_idx(__pyx_t_7sklear */ __pyx_v_pivot_idx = __pyx_f_7sklearn_9neighbors_9ball_tree_partition_dist_idx(__pyx_v_dist, __pyx_v_idx, __pyx_v_k); - /* "sklearn/neighbors/ball_tree.pyx":1562 + /* "sklearn/neighbors/ball_tree.pyx":1564 * pivot_idx = partition_dist_idx(dist, idx, k) * * sort_dist_idx(dist, idx, pivot_idx) # <<<<<<<<<<<<<< @@ -8892,7 +9121,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_sort_dist_idx(__pyx_t_7sklear */ __pyx_f_7sklearn_9neighbors_9ball_tree_sort_dist_idx(__pyx_v_dist, __pyx_v_idx, __pyx_v_pivot_idx); - /* "sklearn/neighbors/ball_tree.pyx":1566 + /* "sklearn/neighbors/ball_tree.pyx":1568 * sort_dist_idx(dist + pivot_idx + 1, * idx + pivot_idx + 1, * k - pivot_idx - 1) # <<<<<<<<<<<<<< @@ -8907,7 +9136,7 @@ static void __pyx_f_7sklearn_9neighbors_9ball_tree_sort_dist_idx(__pyx_t_7sklear __Pyx_RefNannyFinishContext(); } -/* "sklearn/neighbors/ball_tree.pyx":1569 +/* "sklearn/neighbors/ball_tree.pyx":1571 * * * cdef ITYPE_t partition_dist_idx(DTYPE_t* dist, ITYPE_t* idx, ITYPE_t k): # <<<<<<<<<<<<<< @@ -8924,9 +9153,9 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __Pyx_RefNannyDeclarations long __pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("partition_dist_idx"); + __Pyx_RefNannySetupContext("partition_dist_idx", 0); - /* "sklearn/neighbors/ball_tree.pyx":1570 + /* "sklearn/neighbors/ball_tree.pyx":1572 * * cdef ITYPE_t partition_dist_idx(DTYPE_t* dist, ITYPE_t* idx, ITYPE_t k): * cdef ITYPE_t pivot_idx = k / 2 # <<<<<<<<<<<<<< @@ -8935,7 +9164,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_pivot_idx = __Pyx_div_long(__pyx_v_k, 2); - /* "sklearn/neighbors/ball_tree.pyx":1571 + /* "sklearn/neighbors/ball_tree.pyx":1573 * cdef ITYPE_t partition_dist_idx(DTYPE_t* dist, ITYPE_t* idx, ITYPE_t k): * cdef ITYPE_t pivot_idx = k / 2 * cdef DTYPE_t pivot_val = dist[pivot_idx] # <<<<<<<<<<<<<< @@ -8944,7 +9173,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_pivot_val = (__pyx_v_dist[__pyx_v_pivot_idx]); - /* "sklearn/neighbors/ball_tree.pyx":1572 + /* "sklearn/neighbors/ball_tree.pyx":1574 * cdef ITYPE_t pivot_idx = k / 2 * cdef DTYPE_t pivot_val = dist[pivot_idx] * cdef ITYPE_t store_idx = 0 # <<<<<<<<<<<<<< @@ -8953,7 +9182,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_v_store_idx = 0; - /* "sklearn/neighbors/ball_tree.pyx":1575 + /* "sklearn/neighbors/ball_tree.pyx":1577 * cdef ITYPE_t i * * dswap(dist, pivot_idx, k - 1) # <<<<<<<<<<<<<< @@ -8962,7 +9191,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_dswap(__pyx_v_dist, __pyx_v_pivot_idx, (__pyx_v_k - 1)); - /* "sklearn/neighbors/ball_tree.pyx":1576 + /* "sklearn/neighbors/ball_tree.pyx":1578 * * dswap(dist, pivot_idx, k - 1) * iswap(idx, pivot_idx, k - 1) # <<<<<<<<<<<<<< @@ -8971,7 +9200,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_v_idx, __pyx_v_pivot_idx, (__pyx_v_k - 1)); - /* "sklearn/neighbors/ball_tree.pyx":1578 + /* "sklearn/neighbors/ball_tree.pyx":1580 * iswap(idx, pivot_idx, k - 1) * * for i from 0 <= i < k - 1: # <<<<<<<<<<<<<< @@ -8981,7 +9210,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_1 = (__pyx_v_k - 1); for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "sklearn/neighbors/ball_tree.pyx":1579 + /* "sklearn/neighbors/ball_tree.pyx":1581 * * for i from 0 <= i < k - 1: * if dist[i] < pivot_val: # <<<<<<<<<<<<<< @@ -8991,7 +9220,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_t_2 = ((__pyx_v_dist[__pyx_v_i]) < __pyx_v_pivot_val); if (__pyx_t_2) { - /* "sklearn/neighbors/ball_tree.pyx":1580 + /* "sklearn/neighbors/ball_tree.pyx":1582 * for i from 0 <= i < k - 1: * if dist[i] < pivot_val: * dswap(dist, i, store_idx) # <<<<<<<<<<<<<< @@ -9000,7 +9229,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_dswap(__pyx_v_dist, __pyx_v_i, __pyx_v_store_idx); - /* "sklearn/neighbors/ball_tree.pyx":1581 + /* "sklearn/neighbors/ball_tree.pyx":1583 * if dist[i] < pivot_val: * dswap(dist, i, store_idx) * iswap(idx, i, store_idx) # <<<<<<<<<<<<<< @@ -9009,7 +9238,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_v_idx, __pyx_v_i, __pyx_v_store_idx); - /* "sklearn/neighbors/ball_tree.pyx":1582 + /* "sklearn/neighbors/ball_tree.pyx":1584 * dswap(dist, i, store_idx) * iswap(idx, i, store_idx) * store_idx += 1 # <<<<<<<<<<<<<< @@ -9022,7 +9251,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor __pyx_L5:; } - /* "sklearn/neighbors/ball_tree.pyx":1583 + /* "sklearn/neighbors/ball_tree.pyx":1585 * iswap(idx, i, store_idx) * store_idx += 1 * dswap(dist, store_idx, k - 1) # <<<<<<<<<<<<<< @@ -9031,7 +9260,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_dswap(__pyx_v_dist, __pyx_v_store_idx, (__pyx_v_k - 1)); - /* "sklearn/neighbors/ball_tree.pyx":1584 + /* "sklearn/neighbors/ball_tree.pyx":1586 * store_idx += 1 * dswap(dist, store_idx, k - 1) * iswap(idx, store_idx, k - 1) # <<<<<<<<<<<<<< @@ -9039,7 +9268,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor */ __pyx_f_7sklearn_9neighbors_9ball_tree_iswap(__pyx_v_idx, __pyx_v_store_idx, (__pyx_v_k - 1)); - /* "sklearn/neighbors/ball_tree.pyx":1585 + /* "sklearn/neighbors/ball_tree.pyx":1587 * dswap(dist, store_idx, k - 1) * iswap(idx, store_idx, k - 1) * return store_idx # <<<<<<<<<<<<<< @@ -9053,7 +9282,18 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor return __pyx_r; } -/* "numpy.pxd":190 +/* 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) { + int __pyx_r; + __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)); + __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): # <<<<<<<<<<<<<< @@ -9061,8 +9301,7 @@ static __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t __pyx_f_7sklearn_9neighbor * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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; int __pyx_v_ndim; @@ -9087,13 +9326,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -9104,11 +9343,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -9117,7 +9356,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -9126,16 +9365,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -9145,7 +9384,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -9153,11 +9392,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -9166,9 +9405,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -9178,37 +9417,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * 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") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.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_43), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_43), 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -9218,46 +9457,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * 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") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.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_45), 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, ((PyObject *)__pyx_k_tuple_45), 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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -9266,7 +9505,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -9275,7 +9514,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.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) # <<<<<<<<<<<<<< @@ -9284,7 +9523,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.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 # <<<<<<<<<<<<<< @@ -9293,7 +9532,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -9304,49 +9543,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -9355,25 +9594,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -9382,17 +9621,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -9401,7 +9642,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -9417,7 +9658,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -9429,49 +9670,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -9482,10 +9724,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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" */ @@ -9502,24 +9744,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_47), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_47), 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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (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" @@ -9528,10 +9770,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -9541,10 +9783,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -9554,10 +9796,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -9567,10 +9809,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -9580,10 +9822,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -9593,10 +9835,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -9606,10 +9848,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -9619,10 +9861,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -9632,10 +9874,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -9645,10 +9887,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -9658,10 +9900,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -9671,10 +9913,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -9684,10 +9926,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -9697,10 +9939,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -9710,10 +9952,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -9723,10 +9965,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -9736,37 +9978,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_48), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_48), __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_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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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)); __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -9775,7 +10017,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -9784,57 +10026,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -9859,31 +10101,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* 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)); + __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 CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -9891,11 +10141,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -9905,7 +10155,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -9913,14 +10163,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -9935,9 +10185,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -9945,7 +10195,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9963,7 +10213,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -9978,9 +10228,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -9988,7 +10238,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10006,7 +10256,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -10021,9 +10271,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -10031,7 +10281,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10049,7 +10299,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -10064,9 +10314,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -10074,7 +10324,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10092,7 +10342,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -10107,9 +10357,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -10117,7 +10367,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10135,7 +10385,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.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: # <<<<<<<<<<<<<< @@ -10158,18 +10408,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -10178,7 +10429,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -10187,7 +10438,7 @@ 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":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -10195,31 +10446,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -10228,20 +10484,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} + #endif + } else if (1) { + __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -10249,99 +10534,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_50), 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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * 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_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_51), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_51), 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_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -10349,16 +10633,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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -10367,7 +10650,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -10376,430 +10659,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.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_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.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_53), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_53), 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_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.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 = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.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_48), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_48), __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -10807,25 +11073,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_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __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_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -10854,7 +11120,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -10866,9 +11132,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -10878,7 +11144,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -10890,7 +11156,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -10899,7 +11165,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -10910,7 +11176,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -10919,7 +11185,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -10931,7 +11197,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -10943,9 +11209,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -10955,7 +11221,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -10970,7 +11236,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -10990,7 +11256,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } static struct __pyx_vtabstruct_7sklearn_9neighbors_9ball_tree_BallTree __pyx_vtable_7sklearn_9neighbors_9ball_tree_BallTree; -static PyObject *__pyx_tp_new_7sklearn_9neighbors_9ball_tree_BallTree(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_7sklearn_9neighbors_9ball_tree_BallTree(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -11000,7 +11266,7 @@ static PyObject *__pyx_tp_new_7sklearn_9neighbors_9ball_tree_BallTree(PyTypeObje p->idx_array = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->node_centroid_arr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->node_info_arr = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + if (__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_1__cinit__(o, __pyx_empty_tuple, NULL) < 0) { Py_DECREF(o); o = 0; } return o; @@ -11008,10 +11274,12 @@ static PyObject *__pyx_tp_new_7sklearn_9neighbors_9ball_tree_BallTree(PyTypeObje static void __pyx_tp_dealloc_7sklearn_9neighbors_9ball_tree_BallTree(PyObject *o) { struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *p = (struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *)o; - Py_XDECREF(((PyObject *)p->data)); - Py_XDECREF(((PyObject *)p->idx_array)); - Py_XDECREF(((PyObject *)p->node_centroid_arr)); - Py_XDECREF(((PyObject *)p->node_info_arr)); + PyObject_GC_UnTrack(o); + Py_CLEAR(p->data); + Py_CLEAR(p->idx_array); + Py_CLEAR(p->node_centroid_arr); + Py_CLEAR(p->node_info_arr); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -11051,20 +11319,20 @@ static int __pyx_tp_clear_7sklearn_9neighbors_9ball_tree_BallTree(PyObject *o) { return 0; } -static PyObject *__pyx_getprop_7sklearn_9neighbors_9ball_tree_8BallTree_data(PyObject *o, void *x) { - return __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4data___get__(o); +static PyObject *__pyx_getprop_7sklearn_9neighbors_9ball_tree_8BallTree_data(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_4data_1__get__(o); } -static PyObject *__pyx_getprop_7sklearn_9neighbors_9ball_tree_8BallTree_warning_flag(PyObject *o, void *x) { - return __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_flag___get__(o); +static PyObject *__pyx_getprop_7sklearn_9neighbors_9ball_tree_8BallTree_warning_flag(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_12warning_flag_1__get__(o); } static PyMethodDef __pyx_methods_7sklearn_9neighbors_9ball_tree_BallTree[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_2__reduce__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_2__reduce__)}, - {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_3__getstate__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_3__getstate__)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_4__setstate__, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_4__setstate__)}, - {__Pyx_NAMESTR("query"), (PyCFunction)__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_5query, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_5query)}, - {__Pyx_NAMESTR("query_radius"), (PyCFunction)__pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_6query_radius)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_4__reduce__)}, + {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_7__getstate__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_6__getstate__)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_9__setstate__, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_8__setstate__)}, + {__Pyx_NAMESTR("query"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_11query, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_10query)}, + {__Pyx_NAMESTR("query_radius"), (PyCFunction)__pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_13query_radius, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_9neighbors_9ball_tree_8BallTree_12query_radius)}, {0, 0, 0, 0} }; @@ -11212,7 +11480,7 @@ static PyTypeObject __pyx_type_7sklearn_9neighbors_9ball_tree_BallTree = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pf_7sklearn_9neighbors_9ball_tree_8BallTree_1__init__, /*tp_init*/ + __pyx_pw_7sklearn_9neighbors_9ball_tree_8BallTree_3__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_7sklearn_9neighbors_9ball_tree_BallTree, /*tp_new*/ 0, /*tp_free*/ @@ -11266,11 +11534,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 1, 0, 0}, {&__pyx_kp_u_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 1, 0, 0}, {&__pyx_kp_u_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 1, 0, 0}, - {&__pyx_n_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 1}, - {&__pyx_kp_u_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 1, 0, 0}, - {&__pyx_kp_u_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 1, 0, 0}, - {&__pyx_kp_u_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 1, 0, 0}, + {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0}, + {&__pyx_n_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 1}, {&__pyx_kp_u_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 1, 0, 0}, + {&__pyx_kp_u_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 1, 0, 0}, + {&__pyx_kp_u_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 1, 0, 0}, + {&__pyx_kp_u_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 1, 0, 0}, {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, {&__pyx_n_s__ITYPE, __pyx_k__ITYPE, sizeof(__pyx_k__ITYPE), 0, 0, 1, 1}, @@ -11302,6 +11571,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__newObj, __pyx_k__newObj, sizeof(__pyx_k__newObj), 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__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1}, {&__pyx_n_s__ones, __pyx_k__ones, sizeof(__pyx_k__ones), 0, 0, 1, 1}, {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, @@ -11318,10 +11588,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -11329,45 +11599,45 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/neighbors/ball_tree.pyx":363 + /* "sklearn/neighbors/ball_tree.pyx":365 * #print "resize", self.n, new_size * if new_size < self.n: * raise ValueError("new_size smaller than current") # <<<<<<<<<<<<<< * * self.size = new_size */ - __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "sklearn/neighbors/ball_tree.pyx":382 + /* "sklearn/neighbors/ball_tree.pyx":384 * cdef inline stack_item stack_pop(stack* self): * if self.n == 0: * raise ValueError("popping empty stack") # <<<<<<<<<<<<<< * * self.n -= 1 */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "sklearn/neighbors/ball_tree.pyx":493 + /* "sklearn/neighbors/ball_tree.pyx":495 * in rare cases where __init__ is not called * """ * self.data = np.empty((0,0), dtype=DTYPE) # <<<<<<<<<<<<<< * self.idx_array = np.empty(0, dtype=ITYPE) * self.node_centroid_arr = np.empty((0,0), dtype=DTYPE) */ - __pyx_k_tuple_5 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); + __pyx_k_tuple_5 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -11375,36 +11645,36 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_5, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_k_tuple_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "sklearn/neighbors/ball_tree.pyx":494 + /* "sklearn/neighbors/ball_tree.pyx":496 * """ * self.data = np.empty((0,0), dtype=DTYPE) * self.idx_array = np.empty(0, dtype=ITYPE) # <<<<<<<<<<<<<< * self.node_centroid_arr = np.empty((0,0), dtype=DTYPE) * self.node_info_arr = np.empty(0, dtype='c') */ - __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - /* "sklearn/neighbors/ball_tree.pyx":495 + /* "sklearn/neighbors/ball_tree.pyx":497 * self.data = np.empty((0,0), dtype=DTYPE) * self.idx_array = np.empty(0, dtype=ITYPE) * self.node_centroid_arr = np.empty((0,0), dtype=DTYPE) # <<<<<<<<<<<<<< * self.node_info_arr = np.empty(0, dtype='c') * */ - __pyx_k_tuple_8 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __pyx_k_tuple_8 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -11412,334 +11682,349 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_8, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_8)); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_k_tuple_8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); - /* "sklearn/neighbors/ball_tree.pyx":496 + /* "sklearn/neighbors/ball_tree.pyx":498 * self.idx_array = np.empty(0, dtype=ITYPE) * self.node_centroid_arr = np.empty((0,0), dtype=DTYPE) * self.node_info_arr = np.empty(0, dtype='c') # <<<<<<<<<<<<<< * * def __init__(self, X, ITYPE_t leaf_size=20, DTYPE_t p=2): */ - __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "sklearn/neighbors/ball_tree.pyx":503 + /* "sklearn/neighbors/ball_tree.pyx":505 * * if X.size == 0: * raise ValueError("X is an empty array") # <<<<<<<<<<<<<< * * if self.data.ndim != 2: */ - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "sklearn/neighbors/ball_tree.pyx":506 + /* "sklearn/neighbors/ball_tree.pyx":508 * * if self.data.ndim != 2: * raise ValueError("X should have two dimensions") # <<<<<<<<<<<<<< * * if p < 1: */ - __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_kp_s_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_13)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - /* "sklearn/neighbors/ball_tree.pyx":509 + /* "sklearn/neighbors/ball_tree.pyx":511 * * if p < 1: * raise ValueError("p must be greater than or equal to 1") # <<<<<<<<<<<<<< * self.p = p * */ - __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); + __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_INCREF(((PyObject *)__pyx_kp_s_15)); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); - /* "sklearn/neighbors/ball_tree.pyx":513 + /* "sklearn/neighbors/ball_tree.pyx":515 * * if leaf_size < 1: * raise ValueError("leaf_size must be greater than or equal to 1") # <<<<<<<<<<<<<< * self.leaf_size = leaf_size * */ - __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18)); + __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); __Pyx_INCREF(((PyObject *)__pyx_kp_s_17)); PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_17)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); - /* "sklearn/neighbors/ball_tree.pyx":615 + /* "sklearn/neighbors/ball_tree.pyx":617 * * if X.shape[-1] != self.data.shape[1]: * raise ValueError("query data dimension must match BallTree " # <<<<<<<<<<<<<< * "data dimension") * */ - __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21)); + __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - /* "sklearn/neighbors/ball_tree.pyx":619 + /* "sklearn/neighbors/ball_tree.pyx":621 * * if k > self.data.shape[0]: * raise ValueError("k must be less than or equal " # <<<<<<<<<<<<<< * "to the number of training points") * */ - __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); __Pyx_INCREF(((PyObject *)__pyx_kp_s_22)); PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_22)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); - /* "sklearn/neighbors/ball_tree.pyx":639 + /* "sklearn/neighbors/ball_tree.pyx":641 * # initialize arrays. This is only needed for correct behavior of * # the warning flag. * distances.fill(-9999) # <<<<<<<<<<<<<< * idx_array.fill(-9999) * */ - __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24)); + __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_INCREF(__pyx_int_neg_9999); PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, __pyx_int_neg_9999); __Pyx_GIVEREF(__pyx_int_neg_9999); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - /* "sklearn/neighbors/ball_tree.pyx":640 + /* "sklearn/neighbors/ball_tree.pyx":642 * # the warning flag. * distances.fill(-9999) * idx_array.fill(-9999) # <<<<<<<<<<<<<< * * cdef np.ndarray Xi */ - __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25)); + __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_INCREF(__pyx_int_neg_9999); PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, __pyx_int_neg_9999); __Pyx_GIVEREF(__pyx_int_neg_9999); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); - /* "sklearn/neighbors/ball_tree.pyx":739 + /* "sklearn/neighbors/ball_tree.pyx":741 * """ * if count_only and return_distance: * raise ValueError("count_only and return_distance " # <<<<<<<<<<<<<< * "cannot both be true") * */ - __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); + __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_30); __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_29)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); - /* "sklearn/neighbors/ball_tree.pyx":743 + /* "sklearn/neighbors/ball_tree.pyx":745 * * if sort_results and not return_distance: * raise ValueError("return_distance must be True if sort_distances " # <<<<<<<<<<<<<< * "is True") * */ - __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32)); + __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_32); __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); - /* "sklearn/neighbors/ball_tree.pyx":753 + /* "sklearn/neighbors/ball_tree.pyx":755 * X = array2d(X, dtype=DTYPE, order='C') * if X.shape[-1] != self.data.shape[1]: * raise ValueError("query data dimension must match BallTree " # <<<<<<<<<<<<<< * "data dimension") * */ - __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33)); + __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_33); __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); - /* "sklearn/neighbors/ball_tree.pyx":759 + /* "sklearn/neighbors/ball_tree.pyx":761 * r = np.asarray(r, dtype=DTYPE, order='C') * r = np.atleast_1d(r) * if r.shape == (1,): # <<<<<<<<<<<<<< * r = r[0] * np.ones(X.shape[:-1], dtype=np.double) * else: */ - __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_34)); + __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_34); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); - /* "sklearn/neighbors/ball_tree.pyx":763 + /* "sklearn/neighbors/ball_tree.pyx":765 * else: * if r.shape != X.shape[:-1]: * raise ValueError("r must be broadcastable to X.shape") # <<<<<<<<<<<<<< * * # flatten X and r for iteration */ - __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36)); + __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_36); __Pyx_INCREF(((PyObject *)__pyx_kp_s_35)); PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_35)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); - /* "sklearn/neighbors/ball_tree.pyx":768 + /* "sklearn/neighbors/ball_tree.pyx":770 * orig_shape = X.shape * X = X.reshape((-1, X.shape[-1])) * r = r.reshape(-1) # <<<<<<<<<<<<<< * * cdef stack node_stack */ - __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37)); + __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_37); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); - /* "sklearn/neighbors/ball_tree.pyx":887 + /* "sklearn/neighbors/ball_tree.pyx":889 * * if parent_info.is_leaf: * raise ValueError("Fatal: parent is a leaf. Memory " # <<<<<<<<<<<<<< * "allocation is flawed") * */ - __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39)); + __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_39); __Pyx_INCREF(((PyObject *)__pyx_kp_s_38)); PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_38)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); - /* "sklearn/neighbors/ball_tree.pyx":912 + /* "sklearn/neighbors/ball_tree.pyx":914 * * if n_points == 0: * raise ValueError("zero-sized node") # <<<<<<<<<<<<<< * * elif n_points == 1: */ - __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41)); + __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_41); __Pyx_INCREF(((PyObject *)__pyx_kp_s_40)); PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_40)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); - /* "numpy.pxd":211 + /* "numpy.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_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_43)); + __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_43); __Pyx_INCREF(((PyObject *)__pyx_kp_u_42)); PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_u_42)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_42)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43)); - /* "numpy.pxd":215 + /* "numpy.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_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_45)); + __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_45); __Pyx_INCREF(((PyObject *)__pyx_kp_u_44)); PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_kp_u_44)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_44)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47)); + __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_47); __Pyx_INCREF(((PyObject *)__pyx_kp_u_46)); PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_u_46)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_46)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_50)); + __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_50); __Pyx_INCREF(((PyObject *)__pyx_kp_u_49)); PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_kp_u_49)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_49)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51)); + __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_51); __Pyx_INCREF(((PyObject *)__pyx_kp_u_46)); PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_kp_u_46)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_46)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); - /* "numpy.pxd":819 + /* "numpy.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_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_53)); + __pyx_k_tuple_53 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_53); __Pyx_INCREF(((PyObject *)__pyx_kp_u_52)); PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_kp_u_52)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_52)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); + + /* "sklearn/neighbors/ball_tree.pyx":393 + * # newObj function + * # this is a helper function for pickling + * def newObj(obj): # <<<<<<<<<<<<<< + * return obj.__new__(obj) + * + */ + __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_55); + __Pyx_INCREF(((PyObject *)__pyx_n_s__obj)); + PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_n_s__obj)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__obj)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); + __pyx_k_codeobj_56 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_57, __pyx_n_s__newObj, 393, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -11781,12 +12066,18 @@ PyMODINIT_FUNC PyInit_ball_tree(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_ball_tree(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_ball_tree(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -11797,16 +12088,23 @@ PyMODINIT_FUNC PyInit_ball_tree(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ball_tree"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_54), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ball_tree"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_54), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.neighbors.ball_tree")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.neighbors.ball_tree", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -11827,16 +12125,23 @@ PyMODINIT_FUNC PyInit_ball_tree(void) __pyx_vtable_7sklearn_9neighbors_9ball_tree_BallTree.query_radius_count_ = (__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t, struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack *))__pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_radius_count_; __pyx_vtable_7sklearn_9neighbors_9ball_tree_BallTree.query_radius_idx_only_ = (__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *, struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack *))__pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_radius_idx_only_; __pyx_vtable_7sklearn_9neighbors_9ball_tree_BallTree.query_radius_distances_ = (__pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t (*)(struct __pyx_obj_7sklearn_9neighbors_9ball_tree_BallTree *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t, __pyx_t_7sklearn_9neighbors_9ball_tree_ITYPE_t *, __pyx_t_7sklearn_9neighbors_9ball_tree_DTYPE_t *, struct __pyx_t_7sklearn_9neighbors_9ball_tree_stack *))__pyx_f_7sklearn_9neighbors_9ball_tree_8BallTree_query_radius_distances_; - if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_9ball_tree_BallTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_9ball_tree_BallTree.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_9ball_tree_BallTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BallTree", (PyObject *)&__pyx_type_7sklearn_9neighbors_9ball_tree_BallTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_9neighbors_9ball_tree_BallTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_9neighbors_9ball_tree_BallTree.tp_dict, __pyx_vtabptr_7sklearn_9neighbors_9ball_tree_BallTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BallTree", (PyObject *)&__pyx_type_7sklearn_9neighbors_9ball_tree_BallTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_9neighbors_9ball_tree_BallTree = &__pyx_type_7sklearn_9neighbors_9ball_tree_BallTree; /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -11858,119 +12163,132 @@ PyMODINIT_FUNC PyInit_ball_tree(void) * * from ..utils import array2d # <<<<<<<<<<<<<< * - * ###################################################################### + * np.import_array() */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__array2d)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__array2d)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__array2d)); __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__utils), ((PyObject *)__pyx_t_1), 2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __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 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__array2d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__array2d); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__array2d); + 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); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __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; - /* "sklearn/neighbors/ball_tree.pyx":202 + /* "sklearn/neighbors/ball_tree.pyx":198 + * from ..utils import array2d + * + * np.import_array() # <<<<<<<<<<<<<< + * + * ###################################################################### + */ + import_array(); + + /* "sklearn/neighbors/ball_tree.pyx":204 * # * # type used for data * DTYPE = np.float64 # <<<<<<<<<<<<<< * ctypedef np.float64_t DTYPE_t * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":207 + /* "sklearn/neighbors/ball_tree.pyx":209 * # type used for indices & counts * # warning: there will be problems if this is switched to an unsigned type! * ITYPE = np.int32 # <<<<<<<<<<<<<< * ctypedef np.int32_t ITYPE_t * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ITYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ITYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/neighbors/ball_tree.pyx":211 + /* "sklearn/neighbors/ball_tree.pyx":213 * * # infinity * cdef DTYPE_t infinity = np.inf # <<<<<<<<<<<<<< * * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_7sklearn_9neighbors_9ball_tree_infinity = __pyx_t_3; - /* "sklearn/neighbors/ball_tree.pyx":391 + /* "sklearn/neighbors/ball_tree.pyx":393 * # newObj function * # this is a helper function for pickling * def newObj(obj): # <<<<<<<<<<<<<< * return obj.__new__(obj) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_9neighbors_9ball_tree_newObj, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_9neighbors_9ball_tree_1newObj, NULL, __pyx_n_s_58); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__newObj, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__newObj, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":565 + /* "sklearn/neighbors/ball_tree.pyx":567 * self.n_nodes = state[7] * * def query(self, X, k=1, return_distance=True): # <<<<<<<<<<<<<< * """ * query(X, k=1, return_distance=True) */ - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_19 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":672 + /* "sklearn/neighbors/ball_tree.pyx":674 * return idx_array.reshape((orig_shape[:-1]) + (k,)) * * def query_radius(self, X, r, return_distance=False, # <<<<<<<<<<<<<< * count_only=False, sort_results=False): * """ */ - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_26 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/neighbors/ball_tree.pyx":673 + /* "sklearn/neighbors/ball_tree.pyx":675 * * def query_radius(self, X, r, return_distance=False, * count_only=False, sort_results=False): # <<<<<<<<<<<<<< * """ * query_radius(self, X, r, count_only = False): */ - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_27 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_28 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); @@ -11984,12 +12302,12 @@ PyMODINIT_FUNC PyInit_ball_tree(void) */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_56), ((PyObject *)__pyx_kp_u_57)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_58), ((PyObject *)__pyx_kp_u_59)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_59), ((PyObject *)__pyx_kp_u_60)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_61), ((PyObject *)__pyx_kp_u_62)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -12016,7 +12334,6 @@ PyMODINIT_FUNC PyInit_ball_tree(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -12049,9 +12366,9 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { } static CYTHON_INLINE void __Pyx_ErrRestore(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->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -12061,55 +12378,60 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -12132,7 +12454,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -12141,10 +12462,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -12154,7 +12474,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -12163,13 +12482,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } 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; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -12186,14 +12528,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -12203,8 +12540,8 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif @@ -12218,7 +12555,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -12230,7 +12566,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -12242,13 +12578,17 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings( { PyObject* key = 0; Py_ssize_t pos = 0; +#if CPYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else while (PyDict_Next(kwdict, &pos, &key, 0)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) #endif - goto invalid_keyword_type; + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; } if ((!kw_allowed) && unlikely(key)) goto invalid_keyword; @@ -12257,6 +12597,7 @@ static CYTHON_INLINE int __Pyx_CheckKeywordStrings( PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); return 0; +#endif invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 @@ -12290,7 +12631,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -12306,55 +12647,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -12380,34 +12743,68 @@ static CYTHON_INLINE long __Pyx_div_long(long a, long b) { return q; } - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +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 { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { @@ -12436,12 +12833,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -12458,6 +12876,15 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { return module; } +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { +#if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", + PyString_AsString(name)); +#else + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); +#endif +} + 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; @@ -12487,6 +12914,10 @@ static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* 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_VERSION_HEX < 0x03000000 @@ -12506,6 +12937,7 @@ static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) { if (likely(!ret)) return val; } + #endif return (npy_int32)-1; } } @@ -13222,8 +13654,8 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename) { +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); @@ -13277,6 +13709,23 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -13286,15 +13735,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -13310,7 +13754,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -13320,7 +13764,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -13334,51 +13778,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -13389,28 +13887,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -13418,11 +13933,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -13457,6 +13970,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/sklearn/neighbors/ball_tree.pyx b/sklearn/neighbors/ball_tree.pyx index 50643300d7738..a2f0d1c064848 100644 --- a/sklearn/neighbors/ball_tree.pyx +++ b/sklearn/neighbors/ball_tree.pyx @@ -195,6 +195,8 @@ from libc cimport stdlib from ..utils import array2d +np.import_array() + ###################################################################### # global definitions # diff --git a/sklearn/svm/liblinear.c b/sklearn/svm/liblinear.c index 8f826a956efb0..58584b0271bab 100644 --- a/sklearn/svm/liblinear.c +++ b/sklearn/svm/liblinear.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.2 on Wed Dec 12 09:30:25 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:50 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -1070,7 +1070,7 @@ static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_11[] = "Format string allocated too short."; static char __pyx_k_13[] = "\nWrapper for liblinear\n\nAuthor: fabian.pedregosa@inria.fr\n"; -static char __pyx_k_16[] = "/home/andy/checkout/scikit-learn/sklearn/svm/liblinear.pyx"; +static char __pyx_k_16[] = "/scratch/apps/src/scikit-learn/sklearn/svm/liblinear.pyx"; static char __pyx_k_17[] = "sklearn.svm.liblinear"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; @@ -1230,41 +1230,41 @@ static PyObject *__pyx_pw_7sklearn_3svm_9liblinear_1train_wrap(PyObject *__pyx_s case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solver_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bias)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__class_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__random_seed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "train_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; @@ -1280,24 +1280,24 @@ static PyObject *__pyx_pw_7sklearn_3svm_9liblinear_1train_wrap(PyObject *__pyx_s } __pyx_v_X = ((PyArrayObject *)values[0]); __pyx_v_Y = ((PyArrayObject *)values[1]); - __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_bias = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_solver_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_solver_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_bias = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_bias == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_class_weight = ((PyArrayObject *)values[6]); - __pyx_v_random_seed = __Pyx_PyInt_AsUnsignedInt(values[7]); if (unlikely((__pyx_v_random_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_random_seed = __Pyx_PyInt_AsUnsignedInt(values[7]); if (unlikely((__pyx_v_random_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("train_wrap", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.liblinear.train_wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __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 = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __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 = 14; __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 = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_3svm_9liblinear_train_wrap(__pyx_self, __pyx_v_X, __pyx_v_Y, __pyx_v_solver_type, __pyx_v_eps, __pyx_v_bias, __pyx_v_C, __pyx_v_class_weight, __pyx_v_random_seed); goto __pyx_L0; __pyx_L1_error:; @@ -1307,7 +1307,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_9liblinear_1train_wrap(PyObject *__pyx_s return __pyx_r; } -/* "sklearn/svm/liblinear.pyx":12 +/* "sklearn/svm/liblinear.pyx":14 * * * def train_wrap(np.ndarray[np.float64_t, ndim=2, mode='c'] X, # <<<<<<<<<<<<<< @@ -1375,21 +1375,21 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb __pyx_pybuffernd_class_weight.rcbuffer = &__pyx_pybuffer_class_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __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_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/liblinear.pyx":26 + /* "sklearn/svm/liblinear.pyx":28 * cdef int len_w * * problem = set_problem(X.data, Y.data, X.shape, bias) # <<<<<<<<<<<<<< @@ -1398,46 +1398,46 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ __pyx_v_problem = set_problem(__pyx_v_X->data, __pyx_v_Y->data, __pyx_v_X->dimensions, __pyx_v_bias); - /* "sklearn/svm/liblinear.pyx":29 + /* "sklearn/svm/liblinear.pyx":31 * * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * param = set_parameter(solver_type, eps, C, class_weight.shape[0], * class_weight_label.data, class_weight.data, random_seed) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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 = 29; __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 = 31; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 31; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -1445,7 +1445,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/liblinear.pyx":31 + /* "sklearn/svm/liblinear.pyx":33 * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) * param = set_parameter(solver_type, eps, C, class_weight.shape[0], * class_weight_label.data, class_weight.data, random_seed) # <<<<<<<<<<<<<< @@ -1454,7 +1454,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ __pyx_v_param = set_parameter(__pyx_v_solver_type, __pyx_v_eps, __pyx_v_C, (__pyx_v_class_weight->dimensions[0]), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, __pyx_v_random_seed); - /* "sklearn/svm/liblinear.pyx":33 + /* "sklearn/svm/liblinear.pyx":35 * class_weight_label.data, class_weight.data, random_seed) * * error_msg = check_parameter(problem, param) # <<<<<<<<<<<<<< @@ -1463,7 +1463,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ __pyx_v_error_msg = check_parameter(__pyx_v_problem, __pyx_v_param); - /* "sklearn/svm/liblinear.pyx":34 + /* "sklearn/svm/liblinear.pyx":36 * * error_msg = check_parameter(problem, param) * if error_msg: # <<<<<<<<<<<<<< @@ -1473,7 +1473,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb __pyx_t_7 = (__pyx_v_error_msg != 0); if (__pyx_t_7) { - /* "sklearn/svm/liblinear.pyx":35 + /* "sklearn/svm/liblinear.pyx":37 * error_msg = check_parameter(problem, param) * if error_msg: * free_problem(problem) # <<<<<<<<<<<<<< @@ -1482,7 +1482,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ free_problem(__pyx_v_problem); - /* "sklearn/svm/liblinear.pyx":36 + /* "sklearn/svm/liblinear.pyx":38 * if error_msg: * free_problem(problem) * free_parameter(param) # <<<<<<<<<<<<<< @@ -1491,31 +1491,31 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ free_parameter(__pyx_v_param); - /* "sklearn/svm/liblinear.pyx":37 + /* "sklearn/svm/liblinear.pyx":39 * free_problem(problem) * free_parameter(param) * raise ValueError(error_msg) # <<<<<<<<<<<<<< * * # early return */ - __pyx_t_5 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 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_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/svm/liblinear.pyx":40 + /* "sklearn/svm/liblinear.pyx":42 * * # early return * model = train(problem, param) # <<<<<<<<<<<<<< @@ -1524,7 +1524,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ __pyx_v_model = train(__pyx_v_problem, __pyx_v_param); - /* "sklearn/svm/liblinear.pyx":44 + /* "sklearn/svm/liblinear.pyx":46 * # coef matrix holder created as fortran since that's what's used in liblinear * cdef np.ndarray[np.float64_t, ndim=2, mode='fortran'] w * cdef int nr_class = get_nr_class(model) # <<<<<<<<<<<<<< @@ -1533,7 +1533,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ __pyx_v_nr_class = get_nr_class(__pyx_v_model); - /* "sklearn/svm/liblinear.pyx":45 + /* "sklearn/svm/liblinear.pyx":47 * cdef np.ndarray[np.float64_t, ndim=2, mode='fortran'] w * cdef int nr_class = get_nr_class(model) * cdef int nr_feature = get_nr_feature(model) # <<<<<<<<<<<<<< @@ -1542,7 +1542,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ __pyx_v_nr_feature = get_nr_feature(__pyx_v_model); - /* "sklearn/svm/liblinear.pyx":46 + /* "sklearn/svm/liblinear.pyx":48 * cdef int nr_class = get_nr_class(model) * cdef int nr_feature = get_nr_feature(model) * if bias > 0: nr_feature = nr_feature + 1 # <<<<<<<<<<<<<< @@ -1556,7 +1556,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb } __pyx_L4:; - /* "sklearn/svm/liblinear.pyx":47 + /* "sklearn/svm/liblinear.pyx":49 * cdef int nr_feature = get_nr_feature(model) * if bias > 0: nr_feature = nr_feature + 1 * if nr_class == 2: # <<<<<<<<<<<<<< @@ -1566,21 +1566,21 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb __pyx_t_7 = (__pyx_v_nr_class == 2); if (__pyx_t_7) { - /* "sklearn/svm/liblinear.pyx":48 + /* "sklearn/svm/liblinear.pyx":50 * if bias > 0: nr_feature = nr_feature + 1 * if nr_class == 2: * w = np.empty((1, nr_feature),order='F') # <<<<<<<<<<<<<< * copy_w(w.data, model, nr_feature) * else: */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1); @@ -1588,20 +1588,20 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __Pyx_GIVEREF(__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 = 48; __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __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 = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __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 = 50; __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 = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1617,13 +1617,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb } } __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = 0; __pyx_v_w = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/svm/liblinear.pyx":49 + /* "sklearn/svm/liblinear.pyx":51 * if nr_class == 2: * w = np.empty((1, nr_feature),order='F') * copy_w(w.data, model, nr_feature) # <<<<<<<<<<<<<< @@ -1635,7 +1635,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb } /*else*/ { - /* "sklearn/svm/liblinear.pyx":51 + /* "sklearn/svm/liblinear.pyx":53 * copy_w(w.data, model, nr_feature) * else: * len_w = (nr_class) * nr_feature # <<<<<<<<<<<<<< @@ -1644,23 +1644,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ __pyx_v_len_w = (__pyx_v_nr_class * __pyx_v_nr_feature); - /* "sklearn/svm/liblinear.pyx":52 + /* "sklearn/svm/liblinear.pyx":54 * else: * len_w = (nr_class) * nr_feature * w = np.empty((nr_class, nr_feature),order='F') # <<<<<<<<<<<<<< * copy_w(w.data, model, len_w) * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -1668,20 +1668,20 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb __Pyx_GIVEREF(__pyx_t_5); __pyx_t_2 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1697,13 +1697,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb } } __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = 0; __pyx_v_w = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/svm/liblinear.pyx":53 + /* "sklearn/svm/liblinear.pyx":55 * len_w = (nr_class) * nr_feature * w = np.empty((nr_class, nr_feature),order='F') * copy_w(w.data, model, len_w) # <<<<<<<<<<<<<< @@ -1714,7 +1714,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb } __pyx_L5:; - /* "sklearn/svm/liblinear.pyx":56 + /* "sklearn/svm/liblinear.pyx":58 * * ### FREE * free_and_destroy_model(&model) # <<<<<<<<<<<<<< @@ -1723,7 +1723,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ free_and_destroy_model((&__pyx_v_model)); - /* "sklearn/svm/liblinear.pyx":57 + /* "sklearn/svm/liblinear.pyx":59 * ### FREE * free_and_destroy_model(&model) * free_problem(problem) # <<<<<<<<<<<<<< @@ -1732,7 +1732,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ free_problem(__pyx_v_problem); - /* "sklearn/svm/liblinear.pyx":58 + /* "sklearn/svm/liblinear.pyx":60 * free_and_destroy_model(&model) * free_problem(problem) * free_parameter(param) # <<<<<<<<<<<<<< @@ -1741,7 +1741,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb */ free_parameter(__pyx_v_param); - /* "sklearn/svm/liblinear.pyx":61 + /* "sklearn/svm/liblinear.pyx":63 * # destroy_param(param) don't call this or it will destroy class_weight_label and class_weight * * return w # <<<<<<<<<<<<<< @@ -1786,7 +1786,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_train_wrap(CYTHON_UNUSED PyOb return __pyx_r; } -/* "sklearn/svm/liblinear.pyx":64 +/* "sklearn/svm/liblinear.pyx":66 * * * cdef _csr_train_wrap(np.int32_t n_features, # <<<<<<<<<<<<<< @@ -1866,70 +1866,70 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy __pyx_pybuffernd_class_weight.rcbuffer = &__pyx_pybuffer_class_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_values.diminfo[0].strides = __pyx_pybuffernd_X_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_values.diminfo[0].shape = __pyx_pybuffernd_X_values.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Y.rcbuffer->pybuffer, (PyObject*)__pyx_v_Y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __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_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/liblinear.pyx":79 + /* "sklearn/svm/liblinear.pyx":81 * * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * * problem = csr_set_problem(X_values.data, X_indices.shape, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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 = 79; __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 = 81; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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 = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 81; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -1937,7 +1937,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/liblinear.pyx":83 + /* "sklearn/svm/liblinear.pyx":85 * problem = csr_set_problem(X_values.data, X_indices.shape, * X_indices.data, X_indptr.shape, * X_indptr.data, Y.data, n_features, bias) # <<<<<<<<<<<<<< @@ -1946,7 +1946,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ __pyx_v_problem = csr_set_problem(__pyx_v_X_values->data, __pyx_v_X_indices->dimensions, __pyx_v_X_indices->data, __pyx_v_X_indptr->dimensions, __pyx_v_X_indptr->data, __pyx_v_Y->data, __pyx_v_n_features, __pyx_v_bias); - /* "sklearn/svm/liblinear.pyx":86 + /* "sklearn/svm/liblinear.pyx":88 * * param = set_parameter(solver_type, eps, C, class_weight.shape[0], * class_weight_label.data, class_weight.data, random_seed) # <<<<<<<<<<<<<< @@ -1955,7 +1955,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ __pyx_v_param = set_parameter(__pyx_v_solver_type, __pyx_v_eps, __pyx_v_C, (__pyx_v_class_weight->dimensions[0]), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, __pyx_v_random_seed); - /* "sklearn/svm/liblinear.pyx":88 + /* "sklearn/svm/liblinear.pyx":90 * class_weight_label.data, class_weight.data, random_seed) * * error_msg = check_parameter(problem, param) # <<<<<<<<<<<<<< @@ -1964,7 +1964,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ __pyx_v_error_msg = check_parameter(__pyx_v_problem, __pyx_v_param); - /* "sklearn/svm/liblinear.pyx":89 + /* "sklearn/svm/liblinear.pyx":91 * * error_msg = check_parameter(problem, param) * if error_msg: # <<<<<<<<<<<<<< @@ -1974,7 +1974,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy __pyx_t_7 = (__pyx_v_error_msg != 0); if (__pyx_t_7) { - /* "sklearn/svm/liblinear.pyx":90 + /* "sklearn/svm/liblinear.pyx":92 * error_msg = check_parameter(problem, param) * if error_msg: * free_problem(problem) # <<<<<<<<<<<<<< @@ -1983,7 +1983,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ free_problem(__pyx_v_problem); - /* "sklearn/svm/liblinear.pyx":91 + /* "sklearn/svm/liblinear.pyx":93 * if error_msg: * free_problem(problem) * free_parameter(param) # <<<<<<<<<<<<<< @@ -1992,31 +1992,31 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ free_parameter(__pyx_v_param); - /* "sklearn/svm/liblinear.pyx":92 + /* "sklearn/svm/liblinear.pyx":94 * free_problem(problem) * free_parameter(param) * raise ValueError(error_msg) # <<<<<<<<<<<<<< * * # early return */ - __pyx_t_5 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __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 = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 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_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/svm/liblinear.pyx":95 + /* "sklearn/svm/liblinear.pyx":97 * * # early return * model = train(problem, param) # <<<<<<<<<<<<<< @@ -2025,7 +2025,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ __pyx_v_model = train(__pyx_v_problem, __pyx_v_param); - /* "sklearn/svm/liblinear.pyx":99 + /* "sklearn/svm/liblinear.pyx":101 * # fortran order since that's what liblinear does * cdef np.ndarray[np.float64_t, ndim=2, mode='fortran'] w * cdef int nr_class = get_nr_class(model) # <<<<<<<<<<<<<< @@ -2034,7 +2034,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ __pyx_v_nr_class = get_nr_class(__pyx_v_model); - /* "sklearn/svm/liblinear.pyx":100 + /* "sklearn/svm/liblinear.pyx":102 * cdef np.ndarray[np.float64_t, ndim=2, mode='fortran'] w * cdef int nr_class = get_nr_class(model) * cdef int nr_feature = n_features # <<<<<<<<<<<<<< @@ -2043,7 +2043,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ __pyx_v_nr_feature = __pyx_v_n_features; - /* "sklearn/svm/liblinear.pyx":101 + /* "sklearn/svm/liblinear.pyx":103 * cdef int nr_class = get_nr_class(model) * cdef int nr_feature = n_features * if bias > 0: nr_feature = nr_feature + 1 # <<<<<<<<<<<<<< @@ -2057,7 +2057,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy } __pyx_L4:; - /* "sklearn/svm/liblinear.pyx":102 + /* "sklearn/svm/liblinear.pyx":104 * cdef int nr_feature = n_features * if bias > 0: nr_feature = nr_feature + 1 * if nr_class == 2: # <<<<<<<<<<<<<< @@ -2067,21 +2067,21 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy __pyx_t_7 = (__pyx_v_nr_class == 2); if (__pyx_t_7) { - /* "sklearn/svm/liblinear.pyx":103 + /* "sklearn/svm/liblinear.pyx":105 * if bias > 0: nr_feature = nr_feature + 1 * if nr_class == 2: * w = np.empty((1, nr_feature),order='F') # <<<<<<<<<<<<<< * copy_w(w.data, model, nr_feature) * else: */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1); @@ -2089,20 +2089,20 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __Pyx_GIVEREF(__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 = 103; __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __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 = 105; __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2118,13 +2118,13 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy } } __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = 0; __pyx_v_w = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/svm/liblinear.pyx":104 + /* "sklearn/svm/liblinear.pyx":106 * if nr_class == 2: * w = np.empty((1, nr_feature),order='F') * copy_w(w.data, model, nr_feature) # <<<<<<<<<<<<<< @@ -2136,7 +2136,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy } /*else*/ { - /* "sklearn/svm/liblinear.pyx":106 + /* "sklearn/svm/liblinear.pyx":108 * copy_w(w.data, model, nr_feature) * else: * len_w = (nr_class * nr_feature) # <<<<<<<<<<<<<< @@ -2145,23 +2145,23 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ __pyx_v_len_w = (__pyx_v_nr_class * __pyx_v_nr_feature); - /* "sklearn/svm/liblinear.pyx":107 + /* "sklearn/svm/liblinear.pyx":109 * else: * len_w = (nr_class * nr_feature) * w = np.empty((nr_class, nr_feature),order='F') # <<<<<<<<<<<<<< * copy_w(w.data, model, len_w) * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_nr_class); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_nr_feature); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -2169,20 +2169,20 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy __Pyx_GIVEREF(__pyx_t_5); __pyx_t_2 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_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 = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2198,13 +2198,13 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy } } __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = 0; __pyx_v_w = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/svm/liblinear.pyx":108 + /* "sklearn/svm/liblinear.pyx":110 * len_w = (nr_class * nr_feature) * w = np.empty((nr_class, nr_feature),order='F') * copy_w(w.data, model, len_w) # <<<<<<<<<<<<<< @@ -2215,7 +2215,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy } __pyx_L5:; - /* "sklearn/svm/liblinear.pyx":111 + /* "sklearn/svm/liblinear.pyx":113 * * ### FREE * free_and_destroy_model(&model) # <<<<<<<<<<<<<< @@ -2224,7 +2224,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ free_and_destroy_model((&__pyx_v_model)); - /* "sklearn/svm/liblinear.pyx":112 + /* "sklearn/svm/liblinear.pyx":114 * ### FREE * free_and_destroy_model(&model) * free_problem(problem) # <<<<<<<<<<<<<< @@ -2233,7 +2233,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ free_problem(__pyx_v_problem); - /* "sklearn/svm/liblinear.pyx":113 + /* "sklearn/svm/liblinear.pyx":115 * free_and_destroy_model(&model) * free_problem(problem) * free_parameter(param) # <<<<<<<<<<<<<< @@ -2242,7 +2242,7 @@ static PyObject *__pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_5numpy */ free_parameter(__pyx_v_param); - /* "sklearn/svm/liblinear.pyx":116 + /* "sklearn/svm/liblinear.pyx":118 * # destroy_param(param) don't call this or it will destroy weight_label and class_weight * * return w # <<<<<<<<<<<<<< @@ -2333,41 +2333,41 @@ static PyObject *__pyx_pw_7sklearn_3svm_9liblinear_3csr_train_wrap(PyObject *__p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__solver_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bias)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__class_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__random_seed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "csr_train_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "csr_train_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; @@ -2388,11 +2388,11 @@ static PyObject *__pyx_pw_7sklearn_3svm_9liblinear_3csr_train_wrap(PyObject *__p __pyx_v_bias = values[4]; __pyx_v_C = values[5]; __pyx_v_class_weight = values[6]; - __pyx_v_random_seed = __Pyx_PyInt_AsUnsignedInt(values[7]); if (unlikely((__pyx_v_random_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_random_seed = __Pyx_PyInt_AsUnsignedInt(values[7]); if (unlikely((__pyx_v_random_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("csr_train_wrap", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.liblinear.csr_train_wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2403,7 +2403,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_9liblinear_3csr_train_wrap(PyObject *__p return __pyx_r; } -/* "sklearn/svm/liblinear.pyx":119 +/* "sklearn/svm/liblinear.pyx":121 * * * def csr_train_wrap(X, Y, solver_type, eps, bias, C, class_weight, # <<<<<<<<<<<<<< @@ -2430,7 +2430,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_2csr_train_wrap(CYTHON_UNUSED int __pyx_clineno = 0; __Pyx_RefNannySetupContext("csr_train_wrap", 0); - /* "sklearn/svm/liblinear.pyx":126 + /* "sklearn/svm/liblinear.pyx":128 * X matrix is given in CSR sparse format. * """ * return _csr_train_wrap(X.shape[1], X.data, X.indices, X.indptr, Y, # <<<<<<<<<<<<<< @@ -2438,49 +2438,49 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_2csr_train_wrap(CYTHON_UNUSED * random_seed) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __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_PyInt_from_py_npy_int32(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __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 = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __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 = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!(likely(((__pyx_v_Y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_Y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = __pyx_v_Y; __Pyx_INCREF(__pyx_t_5); - /* "sklearn/svm/liblinear.pyx":127 + /* "sklearn/svm/liblinear.pyx":129 * """ * return _csr_train_wrap(X.shape[1], X.data, X.indices, X.indptr, Y, * solver_type, eps, bias, C, class_weight, # <<<<<<<<<<<<<< * random_seed) * */ - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_solver_type); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_v_bias); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_C); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!(likely(((__pyx_v_class_weight) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_class_weight, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_solver_type); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_v_bias); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_C); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_class_weight) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_class_weight, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = __pyx_v_class_weight; __Pyx_INCREF(__pyx_t_10); - /* "sklearn/svm/liblinear.pyx":128 + /* "sklearn/svm/liblinear.pyx":130 * return _csr_train_wrap(X.shape[1], X.data, X.indices, X.indptr, Y, * solver_type, eps, bias, C, class_weight, * random_seed) # <<<<<<<<<<<<<< * * */ - __pyx_t_11 = __pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_3, ((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_4), ((PyArrayObject *)__pyx_t_5), __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, ((PyArrayObject *)__pyx_t_10), __pyx_v_random_seed); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_f_7sklearn_3svm_9liblinear__csr_train_wrap(__pyx_t_3, ((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_4), ((PyArrayObject *)__pyx_t_5), __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, ((PyArrayObject *)__pyx_t_10), __pyx_v_random_seed); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2518,7 +2518,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_9liblinear_5set_verbosity_wrap(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_verbosity_wrap (wrapper)", 0); assert(__pyx_arg_verbosity); { - __pyx_v_verbosity = __Pyx_PyInt_AsInt(__pyx_arg_verbosity); if (unlikely((__pyx_v_verbosity == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_verbosity = __Pyx_PyInt_AsInt(__pyx_arg_verbosity); if (unlikely((__pyx_v_verbosity == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2531,7 +2531,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_9liblinear_5set_verbosity_wrap(PyObject return __pyx_r; } -/* "sklearn/svm/liblinear.pyx":131 +/* "sklearn/svm/liblinear.pyx":133 * * * def set_verbosity_wrap(int verbosity): # <<<<<<<<<<<<<< @@ -2544,7 +2544,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_4set_verbosity_wrap(CYTHON_UN __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_verbosity_wrap", 0); - /* "sklearn/svm/liblinear.pyx":135 + /* "sklearn/svm/liblinear.pyx":137 * Control verbosity of libsvm library * """ * set_verbosity(verbosity) # <<<<<<<<<<<<<< @@ -2558,8 +2558,8 @@ static PyObject *__pyx_pf_7sklearn_3svm_9liblinear_4set_verbosity_wrap(CYTHON_UN } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -3377,8 +3377,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -4598,7 +4598,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -4694,14 +4694,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "sklearn/svm/liblinear.pyx":12 + /* "sklearn/svm/liblinear.pyx":14 * * * def train_wrap(np.ndarray[np.float64_t, ndim=2, mode='c'] X, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] Y, * int solver_type, double eps, double bias, double C, */ - __pyx_k_tuple_14 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_14 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_n_s__X)); @@ -4755,16 +4755,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_14, 16, ((PyObject *)__pyx_n_s__nr_feature)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nr_feature)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - __pyx_k_codeobj_15 = (PyObject*)__Pyx_PyCode_New(8, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__train_wrap, 12, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_15 = (PyObject*)__Pyx_PyCode_New(8, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__train_wrap, 14, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/liblinear.pyx":119 + /* "sklearn/svm/liblinear.pyx":121 * * * def csr_train_wrap(X, Y, solver_type, eps, bias, C, class_weight, # <<<<<<<<<<<<<< * unsigned random_seed): * """ */ - __pyx_k_tuple_18 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_18 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_18); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__X)); @@ -4791,16 +4791,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_18, 7, ((PyObject *)__pyx_n_s__random_seed)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__random_seed)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); - __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__csr_train_wrap, 119, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__csr_train_wrap, 121, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/liblinear.pyx":131 + /* "sklearn/svm/liblinear.pyx":133 * * * def set_verbosity_wrap(int verbosity): # <<<<<<<<<<<<<< * """ * Control verbosity of libsvm library */ - __pyx_k_tuple_20 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_20 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_INCREF(((PyObject *)__pyx_n_s__verbosity)); PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_n_s__verbosity)); @@ -4809,7 +4809,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_20, 1, ((PyObject *)__pyx_n_s__verbosity)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__verbosity)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - __pyx_k_codeobj_21 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__set_verbosity_wrap, 131, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_21 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s__set_verbosity_wrap, 133, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -4927,40 +4927,49 @@ PyMODINIT_FUNC PyInit_liblinear(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/liblinear.pyx":12 + /* "sklearn/svm/liblinear.pyx":11 + * cimport liblinear + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/svm/liblinear.pyx":14 * * * def train_wrap(np.ndarray[np.float64_t, ndim=2, mode='c'] X, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] Y, * int solver_type, double eps, double bias, double C, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_9liblinear_1train_wrap, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_9liblinear_1train_wrap, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__train_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__train_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/liblinear.pyx":119 + /* "sklearn/svm/liblinear.pyx":121 * * * def csr_train_wrap(X, Y, solver_type, eps, bias, C, class_weight, # <<<<<<<<<<<<<< * unsigned random_seed): * """ */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_9liblinear_3csr_train_wrap, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_9liblinear_3csr_train_wrap, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__csr_train_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__csr_train_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/liblinear.pyx":131 + /* "sklearn/svm/liblinear.pyx":133 * * * def set_verbosity_wrap(int verbosity): # <<<<<<<<<<<<<< * """ * Control verbosity of libsvm library */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_9liblinear_5set_verbosity_wrap, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_9liblinear_5set_verbosity_wrap, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_verbosity_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_verbosity_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/svm/liblinear.pyx":1 diff --git a/sklearn/svm/liblinear.pyx b/sklearn/svm/liblinear.pyx index c7bd3eb31e092..eda2dbddf4fb6 100644 --- a/sklearn/svm/liblinear.pyx +++ b/sklearn/svm/liblinear.pyx @@ -8,6 +8,8 @@ import numpy as np cimport numpy as np cimport liblinear +np.import_array() + def train_wrap(np.ndarray[np.float64_t, ndim=2, mode='c'] X, np.ndarray[np.float64_t, ndim=1, mode='c'] Y, diff --git a/sklearn/svm/libsvm.c b/sklearn/svm/libsvm.c index f2cdb4b5b2ea9..57ae91012b40b 100644 --- a/sklearn/svm/libsvm.c +++ b/sklearn/svm/libsvm.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.2 on Tue Dec 11 19:49:23 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:52 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -994,7 +994,7 @@ static char __pyx_k_43[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_44[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_47[] = "Format string allocated too short."; static char __pyx_k_49[] = "\nBinding for libsvm_skl\n----------------------\n\nThese are the bindings for libsvm_skl, which is a fork o libsvm[1]\nthat adds to libsvm some capabilities, like index of support vectors\nand efficient representation of dense matrices.\n\nThese are low-level routines, but can be used for flexibility or\nperformance reasons. See sklearn.svm for a higher-level API.\n\nLow-level memory management is done in libsvm_helper.c. If we happen\nto run out of memory a MemoryError will be raised. In practice this is\nnot very helpful since hight changes are malloc fails inside svm.cpp,\nwhere no sort of memory checks are done.\n\n[1] http://www.csie.ntu.edu.tw/~cjlin/libsvm/\n\nNotes\n-----\nMaybe we could speed it a bit further by decorating functions with\n@cython.boundscheck(False), but probably it is not worth since all\nwork is done in lisvm_helper.c\nAlso, the signature mode='c' is somewhat superficial, since we already\ncheck that arrays are C-contiguous in svm.py\n\nAuthors\n-------\n2010: Fabian Pedregosa \n Gael Varoquaux \n"; -static char __pyx_k_54[] = "/home/andy/checkout/scikit-learn/sklearn/svm/libsvm.pyx"; +static char __pyx_k_54[] = "/scratch/apps/src/scikit-learn/sklearn/svm/libsvm.pyx"; static char __pyx_k_55[] = "sklearn.svm.libsvm"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; @@ -1302,7 +1302,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_1fit(PyObject *__pyx_self, PyObj case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit", 0, 2, 17, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("fit", 0, 2, 17, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -1381,7 +1381,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_1fit(PyObject *__pyx_self, PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1409,21 +1409,21 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_1fit(PyObject *__pyx_self, PyObj __pyx_v_X = ((PyArrayObject *)values[0]); __pyx_v_Y = ((PyArrayObject *)values[1]); if (values[2]) { - __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_svm_type = ((int)0); } __pyx_v_kernel = ((PyObject*)values[3]); if (values[4]) { - __pyx_v_degree = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_degree = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_degree = ((int)3); } if (values[5]) { - __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":52 + /* "sklearn/svm/libsvm.pyx":57 * np.ndarray[np.float64_t, ndim=1, mode='c'] Y, * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, # <<<<<<<<<<<<<< @@ -1433,20 +1433,20 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_1fit(PyObject *__pyx_self, PyObj __pyx_v_gamma = ((double)0.1); } if (values[6]) { - __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_coef0 = ((double)0.); } if (values[7]) { - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_tol = ((double)1e-3); } if (values[8]) { - __pyx_v_C = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":53 + /* "sklearn/svm/libsvm.pyx":58 * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, * double C=1., double nu=0.5, double epsilon=0.1, # <<<<<<<<<<<<<< @@ -1456,32 +1456,32 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_1fit(PyObject *__pyx_self, PyObj __pyx_v_C = ((double)1.); } if (values[9]) { - __pyx_v_nu = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_nu = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_nu = ((double)0.5); } if (values[10]) { - __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_epsilon = ((double)0.1); } __pyx_v_class_weight = ((PyArrayObject *)values[11]); __pyx_v_sample_weight = ((PyArrayObject *)values[12]); if (values[13]) { - __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[13]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[13]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_shrinking = ((int)1); } if (values[14]) { - __pyx_v_probability = __Pyx_PyInt_AsInt(values[14]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_probability = __Pyx_PyInt_AsInt(values[14]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_probability = ((int)0); } if (values[15]) { - __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":59 + /* "sklearn/svm/libsvm.pyx":64 * sample_weight=np.empty(0), * int shrinking=1, int probability=0, * double cache_size=100., # <<<<<<<<<<<<<< @@ -1491,24 +1491,24 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_1fit(PyObject *__pyx_self, PyObj __pyx_v_cache_size = ((double)100.); } if (values[16]) { - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[16]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[16]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_max_iter = ((int)-1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fit", 0, 2, 17, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("fit", 0, 2, 17, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.libsvm.fit", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __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 = 56; __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 = 54; __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 = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __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 = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_3svm_6libsvm_fit(__pyx_self, __pyx_v_X, __pyx_v_Y, __pyx_v_svm_type, __pyx_v_kernel, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_tol, __pyx_v_C, __pyx_v_nu, __pyx_v_epsilon, __pyx_v_class_weight, __pyx_v_sample_weight, __pyx_v_shrinking, __pyx_v_probability, __pyx_v_cache_size, __pyx_v_max_iter); goto __pyx_L0; __pyx_L1_error:; @@ -1518,7 +1518,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_1fit(PyObject *__pyx_self, PyObj return __pyx_r; } -/* "sklearn/svm/libsvm.pyx":48 +/* "sklearn/svm/libsvm.pyx":53 * # Wrapper functions * * def fit( # <<<<<<<<<<<<<< @@ -1530,7 +1530,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py struct svm_parameter __pyx_v_param; struct svm_problem __pyx_v_problem; struct svm_model *__pyx_v_model; - char *__pyx_v_error_msg; + const char * __pyx_v_error_msg; npy_intp __pyx_v_SV_len; PyObject *__pyx_v_kernel_index = NULL; PyArrayObject *__pyx_v_class_weight_label = 0; @@ -1653,70 +1653,70 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __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_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/libsvm.pyx":138 + /* "sklearn/svm/libsvm.pyx":143 * * * if len(sample_weight) == 0: # <<<<<<<<<<<<<< * sample_weight = np.ones(X.shape[0], dtype=np.float64) * else: */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_sample_weight)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_sample_weight)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (__pyx_t_1 == 0); if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":139 + /* "sklearn/svm/libsvm.pyx":144 * * if len(sample_weight) == 0: * sample_weight = np.ones(X.shape[0], dtype=np.float64) # <<<<<<<<<<<<<< * else: * assert sample_weight.shape[0] == X.shape[0], \ */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __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_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __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_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __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_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1732,7 +1732,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_sample_weight)); @@ -1742,7 +1742,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } /*else*/ { - /* "sklearn/svm/libsvm.pyx":141 + /* "sklearn/svm/libsvm.pyx":146 * sample_weight = np.ones(X.shape[0], dtype=np.float64) * else: * assert sample_weight.shape[0] == X.shape[0], \ # <<<<<<<<<<<<<< @@ -1752,18 +1752,18 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_sample_weight->dimensions[0]) == (__pyx_v_X->dimensions[0])))) { - /* "sklearn/svm/libsvm.pyx":144 + /* "sklearn/svm/libsvm.pyx":149 * "sample_weight and X have incompatible shapes: " + \ * "sample_weight has %s samples while X has %s" % \ * (sample_weight.shape[0], X.shape[0]) # <<<<<<<<<<<<<< * * # set problem */ - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_sample_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_sample_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); @@ -1771,55 +1771,55 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py __Pyx_GIVEREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif } __pyx_L3:; - /* "sklearn/svm/libsvm.pyx":147 + /* "sklearn/svm/libsvm.pyx":152 * * # set problem * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) # <<<<<<<<<<<<<< * set_problem( * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __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 = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_kernel)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_kernel)); __Pyx_GIVEREF(((PyObject *)__pyx_v_kernel)); - __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_v_kernel_index = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/svm/libsvm.pyx":149 + /* "sklearn/svm/libsvm.pyx":154 * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) * set_problem( * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) # <<<<<<<<<<<<<< * if problem.x == NULL: * raise MemoryError("Seems we've run out of of memory") */ - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} set_problem((&__pyx_v_problem), __pyx_v_X->data, __pyx_v_Y->data, __pyx_v_sample_weight->data, __pyx_v_X->dimensions, __pyx_t_9); - /* "sklearn/svm/libsvm.pyx":150 + /* "sklearn/svm/libsvm.pyx":155 * set_problem( * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) * if problem.x == NULL: # <<<<<<<<<<<<<< @@ -1829,62 +1829,62 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py __pyx_t_2 = (__pyx_v_problem.x == NULL); if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":151 + /* "sklearn/svm/libsvm.pyx":156 * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) * if problem.x == NULL: * raise MemoryError("Seems we've run out of of memory") # <<<<<<<<<<<<<< * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) */ - __pyx_t_7 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; - /* "sklearn/svm/libsvm.pyx":153 + /* "sklearn/svm/libsvm.pyx":158 * raise MemoryError("Seems we've run out of of memory") * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * * # set parameters */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__arange); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__arange); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __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 = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 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 = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -1892,16 +1892,16 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/svm/libsvm.pyx":157 + /* "sklearn/svm/libsvm.pyx":162 * # set parameters * set_parameter( * ¶m, svm_type, kernel_index, degree, gamma, coef0, nu, cache_size, # <<<<<<<<<<<<<< * C, tol, epsilon, shrinking, probability, class_weight.shape[0], * class_weight_label.data, class_weight.data, max_iter) */ - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":159 + /* "sklearn/svm/libsvm.pyx":164 * ¶m, svm_type, kernel_index, degree, gamma, coef0, nu, cache_size, * C, tol, epsilon, shrinking, probability, class_weight.shape[0], * class_weight_label.data, class_weight.data, max_iter) # <<<<<<<<<<<<<< @@ -1910,7 +1910,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ set_parameter((&__pyx_v_param), __pyx_v_svm_type, __pyx_t_9, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_nu, __pyx_v_cache_size, __pyx_v_C, __pyx_v_tol, __pyx_v_epsilon, __pyx_v_shrinking, __pyx_v_probability, ((int)(__pyx_v_class_weight->dimensions[0])), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, __pyx_v_max_iter); - /* "sklearn/svm/libsvm.pyx":162 + /* "sklearn/svm/libsvm.pyx":167 * * # check parameters * error_msg = svm_check_parameter(&problem, ¶m) # <<<<<<<<<<<<<< @@ -1919,7 +1919,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ __pyx_v_error_msg = svm_check_parameter((&__pyx_v_problem), (&__pyx_v_param)); - /* "sklearn/svm/libsvm.pyx":163 + /* "sklearn/svm/libsvm.pyx":168 * # check parameters * error_msg = svm_check_parameter(&problem, ¶m) * if error_msg: # <<<<<<<<<<<<<< @@ -1929,47 +1929,47 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py __pyx_t_2 = (__pyx_v_error_msg != 0); if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":165 + /* "sklearn/svm/libsvm.pyx":170 * if error_msg: * # for SVR: epsilon is called p in libsvm * error_repl = error_msg.replace("p < 0", "epsilon < 0") # <<<<<<<<<<<<<< * raise ValueError(error_repl) * */ - __pyx_t_6 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_t_6), __pyx_n_s__replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_t_6), __pyx_n_s__replace); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_error_repl = __pyx_t_6; __pyx_t_6 = 0; - /* "sklearn/svm/libsvm.pyx":166 + /* "sklearn/svm/libsvm.pyx":171 * # for SVR: epsilon is called p in libsvm * error_repl = error_msg.replace("p < 0", "epsilon < 0") * raise ValueError(error_repl) # <<<<<<<<<<<<<< * * # this does the real work */ - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_error_repl); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_error_repl); __Pyx_GIVEREF(__pyx_v_error_repl); - __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 = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__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 = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "sklearn/svm/libsvm.pyx":169 + /* "sklearn/svm/libsvm.pyx":174 * * # this does the real work * cdef int fit_status = 0 # <<<<<<<<<<<<<< @@ -1978,7 +1978,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ __pyx_v_fit_status = 0; - /* "sklearn/svm/libsvm.pyx":170 + /* "sklearn/svm/libsvm.pyx":175 * # this does the real work * cdef int fit_status = 0 * model = svm_train(&problem, ¶m, &fit_status) # <<<<<<<<<<<<<< @@ -1987,7 +1987,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ __pyx_v_model = svm_train((&__pyx_v_problem), (&__pyx_v_param), (&__pyx_v_fit_status)); - /* "sklearn/svm/libsvm.pyx":174 + /* "sklearn/svm/libsvm.pyx":179 * # from here until the end, we just copy the data returned by * # svm_train * SV_len = get_l(model) # <<<<<<<<<<<<<< @@ -1996,35 +1996,35 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ __pyx_v_SV_len = get_l(__pyx_v_model); - /* "sklearn/svm/libsvm.pyx":175 + /* "sklearn/svm/libsvm.pyx":180 * # svm_train * SV_len = get_l(model) * n_class = get_nr(model) # <<<<<<<<<<<<<< * * # copy model.sv_coef */ - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t(get_nr(__pyx_v_model)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t(get_nr(__pyx_v_model)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_v_n_class = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/svm/libsvm.pyx":179 + /* "sklearn/svm/libsvm.pyx":184 * # copy model.sv_coef * cdef np.ndarray[np.float64_t, ndim=2, mode='c'] sv_coef * sv_coef = np.empty((n_class-1, SV_len), dtype=np.float64) # <<<<<<<<<<<<<< * copy_sv_coef (sv_coef.data, model) * */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Subtract(__pyx_v_n_class, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Subtract(__pyx_v_n_class, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_SV_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_SV_len); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); @@ -2032,26 +2032,26 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py __Pyx_GIVEREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __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 = 184; __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 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_14 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2067,13 +2067,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_sv_coef.diminfo[0].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sv_coef.diminfo[0].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sv_coef.diminfo[1].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sv_coef.diminfo[1].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_14 = 0; __pyx_v_sv_coef = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm.pyx":180 + /* "sklearn/svm/libsvm.pyx":185 * cdef np.ndarray[np.float64_t, ndim=2, mode='c'] sv_coef * sv_coef = np.empty((n_class-1, SV_len), dtype=np.float64) * copy_sv_coef (sv_coef.data, model) # <<<<<<<<<<<<<< @@ -2082,46 +2082,46 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ copy_sv_coef(__pyx_v_sv_coef->data, __pyx_v_model); - /* "sklearn/svm/libsvm.pyx":185 + /* "sklearn/svm/libsvm.pyx":190 * # the intercept is just model.rho but with sign changed * cdef np.ndarray[np.float64_t, ndim=1, mode='c'] intercept * intercept = np.empty(n_class*(n_class-1)/2, dtype=np.float64) # <<<<<<<<<<<<<< * copy_intercept (intercept.data, model, intercept.shape) * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_v_n_class, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Subtract(__pyx_v_n_class, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_n_class, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_v_n_class, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __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[0]; __pyx_lineno = 185; __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 = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __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_4)); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2137,13 +2137,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_intercept.diminfo[0].strides = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercept.diminfo[0].shape = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_15 = 0; __pyx_v_intercept = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/svm/libsvm.pyx":186 + /* "sklearn/svm/libsvm.pyx":191 * cdef np.ndarray[np.float64_t, ndim=1, mode='c'] intercept * intercept = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * copy_intercept (intercept.data, model, intercept.shape) # <<<<<<<<<<<<<< @@ -2152,40 +2152,40 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ copy_intercept(__pyx_v_intercept->data, __pyx_v_model, __pyx_v_intercept->dimensions); - /* "sklearn/svm/libsvm.pyx":189 + /* "sklearn/svm/libsvm.pyx":194 * * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] support * support = np.empty (SV_len, dtype=np.int32) # <<<<<<<<<<<<<< * copy_support (support.data, model) * */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_SV_len); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_SV_len); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __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 = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 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 = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __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_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_16 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2201,13 +2201,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_support.diminfo[0].strides = __pyx_pybuffernd_support.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_support.diminfo[0].shape = __pyx_pybuffernd_support.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_16 = 0; __pyx_v_support = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/svm/libsvm.pyx":190 + /* "sklearn/svm/libsvm.pyx":195 * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] support * support = np.empty (SV_len, dtype=np.int32) * copy_support (support.data, model) # <<<<<<<<<<<<<< @@ -2216,44 +2216,44 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ copy_support(__pyx_v_support->data, __pyx_v_model); - /* "sklearn/svm/libsvm.pyx":194 + /* "sklearn/svm/libsvm.pyx":199 * # copy model.SV * cdef np.ndarray[np.float64_t, ndim=2, mode='c'] support_vectors * if kernel_index == 4: # <<<<<<<<<<<<<< * # precomputed kernel * support_vectors = np.empty((0, 0), dtype=np.float64) */ - __pyx_t_6 = PyObject_RichCompare(__pyx_v_kernel_index, __pyx_int_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_RichCompare(__pyx_v_kernel_index, __pyx_int_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":196 + /* "sklearn/svm/libsvm.pyx":201 * if kernel_index == 4: * # precomputed kernel * support_vectors = np.empty((0, 0), dtype=np.float64) # <<<<<<<<<<<<<< * else: * support_vectors = np.empty((SV_len, X.shape[1]), dtype=np.float64) */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_11), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_11), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2269,7 +2269,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_support_vectors.diminfo[0].strides = __pyx_pybuffernd_support_vectors.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_support_vectors.diminfo[0].shape = __pyx_pybuffernd_support_vectors.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_support_vectors.diminfo[1].strides = __pyx_pybuffernd_support_vectors.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_support_vectors.diminfo[1].shape = __pyx_pybuffernd_support_vectors.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __pyx_v_support_vectors = ((PyArrayObject *)__pyx_t_4); @@ -2278,23 +2278,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } /*else*/ { - /* "sklearn/svm/libsvm.pyx":198 + /* "sklearn/svm/libsvm.pyx":203 * support_vectors = np.empty((0, 0), dtype=np.float64) * else: * support_vectors = np.empty((SV_len, X.shape[1]), dtype=np.float64) # <<<<<<<<<<<<<< * copy_SV(support_vectors.data, model, support_vectors.shape) * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_SV_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_SV_len); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[1])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[1])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __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 = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); @@ -2302,26 +2302,26 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py __Pyx_GIVEREF(__pyx_t_7); __pyx_t_4 = 0; __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __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_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2337,13 +2337,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_support_vectors.diminfo[0].strides = __pyx_pybuffernd_support_vectors.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_support_vectors.diminfo[0].shape = __pyx_pybuffernd_support_vectors.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_support_vectors.diminfo[1].strides = __pyx_pybuffernd_support_vectors.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_support_vectors.diminfo[1].shape = __pyx_pybuffernd_support_vectors.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __pyx_v_support_vectors = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm.pyx":199 + /* "sklearn/svm/libsvm.pyx":204 * else: * support_vectors = np.empty((SV_len, X.shape[1]), dtype=np.float64) * copy_SV(support_vectors.data, model, support_vectors.shape) # <<<<<<<<<<<<<< @@ -2354,38 +2354,38 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } __pyx_L6:; - /* "sklearn/svm/libsvm.pyx":204 + /* "sklearn/svm/libsvm.pyx":209 * # TODO: do only in classification * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] n_class_SV * n_class_SV = np.empty(n_class, dtype=np.int32) # <<<<<<<<<<<<<< * copy_nSV(n_class_SV.data, model) * */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __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 = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_n_class); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_n_class); __Pyx_GIVEREF(__pyx_v_n_class); - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __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_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_18 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2401,13 +2401,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_n_class_SV.diminfo[0].strides = __pyx_pybuffernd_n_class_SV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n_class_SV.diminfo[0].shape = __pyx_pybuffernd_n_class_SV.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_18 = 0; __pyx_v_n_class_SV = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm.pyx":205 + /* "sklearn/svm/libsvm.pyx":210 * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] n_class_SV * n_class_SV = np.empty(n_class, dtype=np.int32) * copy_nSV(n_class_SV.data, model) # <<<<<<<<<<<<<< @@ -2416,38 +2416,38 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ copy_nSV(__pyx_v_n_class_SV->data, __pyx_v_model); - /* "sklearn/svm/libsvm.pyx":209 + /* "sklearn/svm/libsvm.pyx":214 * # copy label * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] label * label = np.empty((n_class), dtype=np.int32) # <<<<<<<<<<<<<< * copy_label(label.data, model) * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_n_class); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_n_class); __Pyx_GIVEREF(__pyx_v_n_class); - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_19 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2463,13 +2463,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_label.diminfo[0].strides = __pyx_pybuffernd_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_label.diminfo[0].shape = __pyx_pybuffernd_label.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_19 = 0; __pyx_v_label = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/svm/libsvm.pyx":210 + /* "sklearn/svm/libsvm.pyx":215 * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] label * label = np.empty((n_class), dtype=np.int32) * copy_label(label.data, model) # <<<<<<<<<<<<<< @@ -2478,7 +2478,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ copy_label(__pyx_v_label->data, __pyx_v_model); - /* "sklearn/svm/libsvm.pyx":215 + /* "sklearn/svm/libsvm.pyx":220 * cdef np.ndarray[np.float64_t, ndim=1, mode='c'] probA * cdef np.ndarray[np.float64_t, ndim=1, mode='c'] probB * if probability != 0: # <<<<<<<<<<<<<< @@ -2488,7 +2488,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py __pyx_t_2 = (__pyx_v_probability != 0); if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":216 + /* "sklearn/svm/libsvm.pyx":221 * cdef np.ndarray[np.float64_t, ndim=1, mode='c'] probB * if probability != 0: * if svm_type < 2: # SVC and NuSVC # <<<<<<<<<<<<<< @@ -2498,46 +2498,46 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py __pyx_t_2 = (__pyx_v_svm_type < 2); if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":217 + /* "sklearn/svm/libsvm.pyx":222 * if probability != 0: * if svm_type < 2: # SVC and NuSVC * probA = np.empty(n_class*(n_class-1)/2, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * copy_probB(probB.data, model, probB.shape) */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Subtract(__pyx_v_n_class, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Subtract(__pyx_v_n_class, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyNumber_Multiply(__pyx_v_n_class, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Multiply(__pyx_v_n_class, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_int_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_int_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2553,52 +2553,52 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_probA.diminfo[0].strides = __pyx_pybuffernd_probA.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probA.diminfo[0].shape = __pyx_pybuffernd_probA.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_20 = 0; __pyx_v_probA = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/svm/libsvm.pyx":218 + /* "sklearn/svm/libsvm.pyx":223 * if svm_type < 2: # SVC and NuSVC * probA = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * probB = np.empty(n_class*(n_class-1)/2, dtype=np.float64) # <<<<<<<<<<<<<< * copy_probB(probB.data, model, probB.shape) * else: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_v_n_class, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_v_n_class, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_v_n_class, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Multiply(__pyx_v_n_class, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __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_PyNumber_Divide(__pyx_t_4, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __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[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __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 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_21 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2614,13 +2614,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_probB.diminfo[0].strides = __pyx_pybuffernd_probB.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probB.diminfo[0].shape = __pyx_pybuffernd_probB.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_21 = 0; __pyx_v_probB = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/svm/libsvm.pyx":219 + /* "sklearn/svm/libsvm.pyx":224 * probA = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * probB = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * copy_probB(probB.data, model, probB.shape) # <<<<<<<<<<<<<< @@ -2632,32 +2632,32 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } /*else*/ { - /* "sklearn/svm/libsvm.pyx":221 + /* "sklearn/svm/libsvm.pyx":226 * copy_probB(probB.data, model, probB.shape) * else: * probA = np.empty(1, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(0, dtype=np.float64) * copy_probA(probA.data, model, probA.shape) */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_12), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_12), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2673,38 +2673,38 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_probA.diminfo[0].strides = __pyx_pybuffernd_probA.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probA.diminfo[0].shape = __pyx_pybuffernd_probA.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_20 = 0; __pyx_v_probA = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/svm/libsvm.pyx":222 + /* "sklearn/svm/libsvm.pyx":227 * else: * probA = np.empty(1, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * copy_probA(probA.data, model, probA.shape) * else: */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_13), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_13), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_21 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2720,7 +2720,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_probB.diminfo[0].strides = __pyx_pybuffernd_probB.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probB.diminfo[0].shape = __pyx_pybuffernd_probB.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_21 = 0; __pyx_v_probB = ((PyArrayObject *)__pyx_t_4); @@ -2728,7 +2728,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } __pyx_L8:; - /* "sklearn/svm/libsvm.pyx":223 + /* "sklearn/svm/libsvm.pyx":228 * probA = np.empty(1, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) * copy_probA(probA.data, model, probA.shape) # <<<<<<<<<<<<<< @@ -2740,32 +2740,32 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } /*else*/ { - /* "sklearn/svm/libsvm.pyx":225 + /* "sklearn/svm/libsvm.pyx":230 * copy_probA(probA.data, model, probA.shape) * else: * probA = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(0, dtype=np.float64) * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_14), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_14), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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 = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_20 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2781,38 +2781,38 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_probA.diminfo[0].strides = __pyx_pybuffernd_probA.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probA.diminfo[0].shape = __pyx_pybuffernd_probA.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_20 = 0; __pyx_v_probA = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/svm/libsvm.pyx":226 + /* "sklearn/svm/libsvm.pyx":231 * else: * probA = np.empty(0, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * * # memory deallocation */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __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_k_tuple_15), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_15), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __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_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_21 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2828,7 +2828,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } } __pyx_pybuffernd_probB.diminfo[0].strides = __pyx_pybuffernd_probB.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probB.diminfo[0].shape = __pyx_pybuffernd_probB.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_21 = 0; __pyx_v_probB = ((PyArrayObject *)__pyx_t_7); @@ -2836,7 +2836,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py } __pyx_L7:; - /* "sklearn/svm/libsvm.pyx":229 + /* "sklearn/svm/libsvm.pyx":234 * * # memory deallocation * svm_free_and_destroy_model(&model) # <<<<<<<<<<<<<< @@ -2845,7 +2845,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ svm_free_and_destroy_model((&__pyx_v_model)); - /* "sklearn/svm/libsvm.pyx":230 + /* "sklearn/svm/libsvm.pyx":235 * # memory deallocation * svm_free_and_destroy_model(&model) * free(problem.x) # <<<<<<<<<<<<<< @@ -2854,7 +2854,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ free(__pyx_v_problem.x); - /* "sklearn/svm/libsvm.pyx":231 + /* "sklearn/svm/libsvm.pyx":236 * svm_free_and_destroy_model(&model) * free(problem.x) * return (support, support_vectors, n_class_SV, sv_coef, intercept, label, # <<<<<<<<<<<<<< @@ -2863,16 +2863,16 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_fit(CYTHON_UNUSED PyObject *__py */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/svm/libsvm.pyx":232 + /* "sklearn/svm/libsvm.pyx":237 * free(problem.x) * return (support, support_vectors, n_class_SV, sv_coef, intercept, label, * probA, probB, fit_status) # <<<<<<<<<<<<<< * * */ - __pyx_t_7 = PyInt_FromLong(__pyx_v_fit_status); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromLong(__pyx_v_fit_status); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyTuple_New(9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_support)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_support)); @@ -3044,32 +3044,32 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_3predict(PyObject *__pyx_self, P case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__support)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__SV)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nSV)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sv_coef)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (kw_args > 0) { @@ -3158,7 +3158,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_3predict(PyObject *__pyx_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3200,21 +3200,21 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_3predict(PyObject *__pyx_self, P __pyx_v_probA = ((PyArrayObject *)values[7]); __pyx_v_probB = ((PyArrayObject *)values[8]); if (values[9]) { - __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_svm_type = ((int)0); } __pyx_v_kernel = ((PyObject*)values[10]); if (values[11]) { - __pyx_v_degree = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_degree = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_degree = ((int)3); } if (values[12]) { - __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":245 + /* "sklearn/svm/libsvm.pyx":250 * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, # <<<<<<<<<<<<<< @@ -3224,20 +3224,20 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_3predict(PyObject *__pyx_self, P __pyx_v_gamma = ((double)0.1); } if (values[13]) { - __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_coef0 = ((double)0.); } if (values[14]) { - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_tol = ((double)1e-3); } if (values[15]) { - __pyx_v_C = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":246 + /* "sklearn/svm/libsvm.pyx":251 * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, * double C=1., double nu=0.5, double epsilon=0.1, # <<<<<<<<<<<<<< @@ -3247,32 +3247,32 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_3predict(PyObject *__pyx_self, P __pyx_v_C = ((double)1.); } if (values[16]) { - __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_nu = ((double)0.5); } if (values[17]) { - __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_epsilon = ((double)0.1); } __pyx_v_class_weight = ((PyArrayObject *)values[18]); __pyx_v_sample_weight = ((PyArrayObject *)values[19]); if (values[20]) { - __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[20]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[20]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_shrinking = ((int)0); } if (values[21]) { - __pyx_v_probability = __Pyx_PyInt_AsInt(values[21]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_probability = __Pyx_PyInt_AsInt(values[21]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_probability = ((int)0); } if (values[22]) { - __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[22]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[22]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":252 + /* "sklearn/svm/libsvm.pyx":257 * sample_weight=np.empty(0), * int shrinking=0, int probability=0, * double cache_size=100., # <<<<<<<<<<<<<< @@ -3282,31 +3282,31 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_3predict(PyObject *__pyx_self, P __pyx_v_cache_size = ((double)100.); } if (values[23]) { - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[23]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[23]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_max_iter = ((int)-1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict", 0, 7, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.libsvm.predict", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_support), __pyx_ptype_5numpy_ndarray, 1, "support", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV), __pyx_ptype_5numpy_ndarray, 1, "SV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __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 = 249; __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 = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_support), __pyx_ptype_5numpy_ndarray, 1, "support", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV), __pyx_ptype_5numpy_ndarray, 1, "SV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __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 = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_3svm_6libsvm_2predict(__pyx_self, __pyx_v_X, __pyx_v_support, __pyx_v_SV, __pyx_v_nSV, __pyx_v_sv_coef, __pyx_v_intercept, __pyx_v_label, __pyx_v_probA, __pyx_v_probB, __pyx_v_svm_type, __pyx_v_kernel, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_tol, __pyx_v_C, __pyx_v_nu, __pyx_v_epsilon, __pyx_v_class_weight, __pyx_v_sample_weight, __pyx_v_shrinking, __pyx_v_probability, __pyx_v_cache_size, __pyx_v_max_iter); goto __pyx_L0; __pyx_L1_error:; @@ -3316,7 +3316,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_3predict(PyObject *__pyx_self, P return __pyx_r; } -/* "sklearn/svm/libsvm.pyx":235 +/* "sklearn/svm/libsvm.pyx":240 * * * def predict(np.ndarray[np.float64_t, ndim=2, mode='c'] X, # <<<<<<<<<<<<<< @@ -3428,100 +3428,100 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_2predict(CYTHON_UNUSED PyObject __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __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_support.rcbuffer->pybuffer, (PyObject*)__pyx_v_support, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_support.rcbuffer->pybuffer, (PyObject*)__pyx_v_support, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_support.diminfo[0].strides = __pyx_pybuffernd_support.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_support.diminfo[0].shape = __pyx_pybuffernd_support.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_SV.diminfo[0].strides = __pyx_pybuffernd_SV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SV.diminfo[0].shape = __pyx_pybuffernd_SV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_SV.diminfo[1].strides = __pyx_pybuffernd_SV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_SV.diminfo[1].shape = __pyx_pybuffernd_SV.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_nSV.diminfo[0].strides = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nSV.diminfo[0].shape = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sv_coef.diminfo[0].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sv_coef.diminfo[0].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sv_coef.diminfo[1].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sv_coef.diminfo[1].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercept.diminfo[0].strides = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercept.diminfo[0].shape = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_label.diminfo[0].strides = __pyx_pybuffernd_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_label.diminfo[0].shape = __pyx_pybuffernd_label.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probA.diminfo[0].strides = __pyx_pybuffernd_probA.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probA.diminfo[0].shape = __pyx_pybuffernd_probA.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probB.diminfo[0].strides = __pyx_pybuffernd_probB.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probB.diminfo[0].shape = __pyx_pybuffernd_probB.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/libsvm.pyx":300 + /* "sklearn/svm/libsvm.pyx":305 * * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) * set_parameter(¶m, svm_type, kernel_index, degree, gamma, coef0, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __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_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __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 = 300; __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 = 305; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __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 = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 305; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __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_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -3529,40 +3529,40 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_2predict(CYTHON_UNUSED PyObject __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm.pyx":301 + /* "sklearn/svm/libsvm.pyx":306 * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) # <<<<<<<<<<<<<< * set_parameter(¶m, svm_type, kernel_index, degree, gamma, coef0, * nu, cache_size, C, tol, epsilon, shrinking, */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __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 = 301; __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 = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_kernel)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_kernel)); __Pyx_GIVEREF(((PyObject *)__pyx_v_kernel)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __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_5)); __pyx_t_5 = 0; __pyx_v_kernel_index = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/svm/libsvm.pyx":302 + /* "sklearn/svm/libsvm.pyx":307 * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) * set_parameter(¶m, svm_type, kernel_index, degree, gamma, coef0, # <<<<<<<<<<<<<< * nu, cache_size, C, tol, epsilon, shrinking, * probability, class_weight.shape[0], */ - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":306 + /* "sklearn/svm/libsvm.pyx":311 * probability, class_weight.shape[0], * class_weight_label.data, class_weight.data, * max_iter) # <<<<<<<<<<<<<< @@ -3571,7 +3571,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_2predict(CYTHON_UNUSED PyObject */ set_parameter((&__pyx_v_param), __pyx_v_svm_type, __pyx_t_7, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_nu, __pyx_v_cache_size, __pyx_v_C, __pyx_v_tol, __pyx_v_epsilon, __pyx_v_shrinking, __pyx_v_probability, ((int)(__pyx_v_class_weight->dimensions[0])), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, __pyx_v_max_iter); - /* "sklearn/svm/libsvm.pyx":311 + /* "sklearn/svm/libsvm.pyx":316 * support.data, support.shape, sv_coef.strides, * sv_coef.data, intercept.data, nSV.data, * label.data, probA.data, probB.data) # <<<<<<<<<<<<<< @@ -3580,30 +3580,30 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_2predict(CYTHON_UNUSED PyObject */ __pyx_v_model = set_model((&__pyx_v_param), ((int)(__pyx_v_nSV->dimensions[0])), __pyx_v_SV->data, __pyx_v_SV->dimensions, __pyx_v_support->data, __pyx_v_support->dimensions, __pyx_v_sv_coef->strides, __pyx_v_sv_coef->data, __pyx_v_intercept->data, __pyx_v_nSV->data, __pyx_v_label->data, __pyx_v_probA->data, __pyx_v_probB->data); - /* "sklearn/svm/libsvm.pyx":314 + /* "sklearn/svm/libsvm.pyx":319 * * #TODO: use check_model * dec_values = np.empty(X.shape[0]) # <<<<<<<<<<<<<< * if copy_predict(X.data, model, X.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __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 = 314; __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 = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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 = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -3619,13 +3619,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_2predict(CYTHON_UNUSED PyObject } } __pyx_pybuffernd_dec_values.diminfo[0].strides = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dec_values.diminfo[0].shape = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = 0; __pyx_v_dec_values = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/svm/libsvm.pyx":315 + /* "sklearn/svm/libsvm.pyx":320 * #TODO: use check_model * dec_values = np.empty(X.shape[0]) * if copy_predict(X.data, model, X.shape, dec_values.data) < 0: # <<<<<<<<<<<<<< @@ -3635,23 +3635,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_2predict(CYTHON_UNUSED PyObject __pyx_t_12 = (copy_predict(__pyx_v_X->data, __pyx_v_model, __pyx_v_X->dimensions, __pyx_v_dec_values->data) < 0); if (__pyx_t_12) { - /* "sklearn/svm/libsvm.pyx":316 + /* "sklearn/svm/libsvm.pyx":321 * dec_values = np.empty(X.shape[0]) * if copy_predict(X.data, model, X.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * free_model(model) * return dec_values */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __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[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/svm/libsvm.pyx":317 + /* "sklearn/svm/libsvm.pyx":322 * if copy_predict(X.data, model, X.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") * free_model(model) # <<<<<<<<<<<<<< @@ -3660,7 +3660,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_2predict(CYTHON_UNUSED PyObject */ free_model(__pyx_v_model); - /* "sklearn/svm/libsvm.pyx":318 + /* "sklearn/svm/libsvm.pyx":323 * raise MemoryError("We've run out of of memory") * free_model(model) * return dec_values # <<<<<<<<<<<<<< @@ -3801,32 +3801,32 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_5predict_proba(PyObject *__pyx_s case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__support)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__SV)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nSV)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sv_coef)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (kw_args > 0) { @@ -3915,7 +3915,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_5predict_proba(PyObject *__pyx_s } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_proba") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_proba") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3957,21 +3957,21 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_5predict_proba(PyObject *__pyx_s __pyx_v_probA = ((PyArrayObject *)values[7]); __pyx_v_probB = ((PyArrayObject *)values[8]); if (values[9]) { - __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_svm_type = ((int)0); } __pyx_v_kernel = ((PyObject*)values[10]); if (values[11]) { - __pyx_v_degree = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_degree = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_degree = ((int)3); } if (values[12]) { - __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":332 + /* "sklearn/svm/libsvm.pyx":337 * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, # <<<<<<<<<<<<<< @@ -3981,20 +3981,20 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_5predict_proba(PyObject *__pyx_s __pyx_v_gamma = ((double)0.1); } if (values[13]) { - __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_coef0 = ((double)0.); } if (values[14]) { - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_tol = ((double)1e-3); } if (values[15]) { - __pyx_v_C = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":333 + /* "sklearn/svm/libsvm.pyx":338 * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, * double C=1., double nu=0.5, double epsilon=0.1, # <<<<<<<<<<<<<< @@ -4004,32 +4004,32 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_5predict_proba(PyObject *__pyx_s __pyx_v_C = ((double)1.); } if (values[16]) { - __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_nu = ((double)0.5); } if (values[17]) { - __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_epsilon = ((double)0.1); } __pyx_v_class_weight = ((PyArrayObject *)values[18]); __pyx_v_sample_weight = ((PyArrayObject *)values[19]); if (values[20]) { - __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[20]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[20]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_shrinking = ((int)0); } if (values[21]) { - __pyx_v_probability = __Pyx_PyInt_AsInt(values[21]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_probability = __Pyx_PyInt_AsInt(values[21]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_probability = ((int)0); } if (values[22]) { - __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[22]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[22]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":339 + /* "sklearn/svm/libsvm.pyx":344 * sample_weight=np.empty(0), * int shrinking=0, int probability=0, * double cache_size=100., # <<<<<<<<<<<<<< @@ -4039,31 +4039,31 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_5predict_proba(PyObject *__pyx_s __pyx_v_cache_size = ((double)100.); } if (values[23]) { - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[23]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[23]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_max_iter = ((int)-1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("predict_proba", 0, 7, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.libsvm.predict_proba", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_support), __pyx_ptype_5numpy_ndarray, 1, "support", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV), __pyx_ptype_5numpy_ndarray, 1, "SV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __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 = 336; __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 = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_support), __pyx_ptype_5numpy_ndarray, 1, "support", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV), __pyx_ptype_5numpy_ndarray, 1, "SV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __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 = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(__pyx_self, __pyx_v_X, __pyx_v_support, __pyx_v_SV, __pyx_v_nSV, __pyx_v_sv_coef, __pyx_v_intercept, __pyx_v_label, __pyx_v_probA, __pyx_v_probB, __pyx_v_svm_type, __pyx_v_kernel, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_tol, __pyx_v_C, __pyx_v_nu, __pyx_v_epsilon, __pyx_v_class_weight, __pyx_v_sample_weight, __pyx_v_shrinking, __pyx_v_probability, __pyx_v_cache_size, __pyx_v_max_iter); goto __pyx_L0; __pyx_L1_error:; @@ -4073,7 +4073,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_5predict_proba(PyObject *__pyx_s return __pyx_r; } -/* "sklearn/svm/libsvm.pyx":321 +/* "sklearn/svm/libsvm.pyx":326 * * * def predict_proba( # <<<<<<<<<<<<<< @@ -4186,100 +4186,100 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(CYTHON_UNUSED PyO __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __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_support.rcbuffer->pybuffer, (PyObject*)__pyx_v_support, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_support.rcbuffer->pybuffer, (PyObject*)__pyx_v_support, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_support.diminfo[0].strides = __pyx_pybuffernd_support.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_support.diminfo[0].shape = __pyx_pybuffernd_support.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_SV.diminfo[0].strides = __pyx_pybuffernd_SV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SV.diminfo[0].shape = __pyx_pybuffernd_SV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_SV.diminfo[1].strides = __pyx_pybuffernd_SV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_SV.diminfo[1].shape = __pyx_pybuffernd_SV.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_nSV.diminfo[0].strides = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nSV.diminfo[0].shape = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sv_coef.diminfo[0].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sv_coef.diminfo[0].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sv_coef.diminfo[1].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sv_coef.diminfo[1].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercept.diminfo[0].strides = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercept.diminfo[0].shape = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_label.diminfo[0].strides = __pyx_pybuffernd_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_label.diminfo[0].shape = __pyx_pybuffernd_label.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probA.diminfo[0].strides = __pyx_pybuffernd_probA.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probA.diminfo[0].shape = __pyx_pybuffernd_probA.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probB.diminfo[0].strides = __pyx_pybuffernd_probB.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probB.diminfo[0].shape = __pyx_pybuffernd_probB.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/libsvm.pyx":372 + /* "sklearn/svm/libsvm.pyx":377 * cdef svm_model *model * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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 = 372; __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 = 377; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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 = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 377; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -4287,40 +4287,40 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(CYTHON_UNUSED PyO __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm.pyx":374 + /* "sklearn/svm/libsvm.pyx":379 * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) * * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) # <<<<<<<<<<<<<< * set_parameter(¶m, svm_type, kernel_index, degree, gamma, * coef0, nu, cache_size, C, tol, epsilon, shrinking, */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __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 = 374; __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 = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_kernel)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_kernel)); __Pyx_GIVEREF(((PyObject *)__pyx_v_kernel)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __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_5)); __pyx_t_5 = 0; __pyx_v_kernel_index = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/svm/libsvm.pyx":375 + /* "sklearn/svm/libsvm.pyx":380 * * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) * set_parameter(¶m, svm_type, kernel_index, degree, gamma, # <<<<<<<<<<<<<< * coef0, nu, cache_size, C, tol, epsilon, shrinking, * probability, class_weight.shape[0], class_weight_label.data, */ - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":378 + /* "sklearn/svm/libsvm.pyx":383 * coef0, nu, cache_size, C, tol, epsilon, shrinking, * probability, class_weight.shape[0], class_weight_label.data, * class_weight.data, max_iter) # <<<<<<<<<<<<<< @@ -4329,7 +4329,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(CYTHON_UNUSED PyO */ set_parameter((&__pyx_v_param), __pyx_v_svm_type, __pyx_t_7, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_nu, __pyx_v_cache_size, __pyx_v_C, __pyx_v_tol, __pyx_v_epsilon, __pyx_v_shrinking, __pyx_v_probability, ((int)(__pyx_v_class_weight->dimensions[0])), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, __pyx_v_max_iter); - /* "sklearn/svm/libsvm.pyx":383 + /* "sklearn/svm/libsvm.pyx":388 * support.data, support.shape, sv_coef.strides, * sv_coef.data, intercept.data, nSV.data, * label.data, probA.data, probB.data) # <<<<<<<<<<<<<< @@ -4338,7 +4338,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(CYTHON_UNUSED PyO */ __pyx_v_model = set_model((&__pyx_v_param), ((int)(__pyx_v_nSV->dimensions[0])), __pyx_v_SV->data, __pyx_v_SV->dimensions, __pyx_v_support->data, __pyx_v_support->dimensions, __pyx_v_sv_coef->strides, __pyx_v_sv_coef->data, __pyx_v_intercept->data, __pyx_v_nSV->data, __pyx_v_label->data, __pyx_v_probA->data, __pyx_v_probB->data); - /* "sklearn/svm/libsvm.pyx":385 + /* "sklearn/svm/libsvm.pyx":390 * label.data, probA.data, probB.data) * * cdef np.npy_intp n_class = get_nr(model) # <<<<<<<<<<<<<< @@ -4347,23 +4347,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(CYTHON_UNUSED PyO */ __pyx_v_n_class = get_nr(__pyx_v_model); - /* "sklearn/svm/libsvm.pyx":386 + /* "sklearn/svm/libsvm.pyx":391 * * cdef np.npy_intp n_class = get_nr(model) * dec_values = np.empty((X.shape[0], n_class), dtype=np.float64) # <<<<<<<<<<<<<< * if copy_predict_proba(X.data, model, X.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __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); @@ -4371,26 +4371,26 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(CYTHON_UNUSED PyO __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __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 = 391; __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)); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4406,13 +4406,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(CYTHON_UNUSED PyO } } __pyx_pybuffernd_dec_values.diminfo[0].strides = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dec_values.diminfo[0].shape = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dec_values.diminfo[1].strides = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dec_values.diminfo[1].shape = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = 0; __pyx_v_dec_values = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm.pyx":387 + /* "sklearn/svm/libsvm.pyx":392 * cdef np.npy_intp n_class = get_nr(model) * dec_values = np.empty((X.shape[0], n_class), dtype=np.float64) * if copy_predict_proba(X.data, model, X.shape, dec_values.data) < 0: # <<<<<<<<<<<<<< @@ -4422,23 +4422,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(CYTHON_UNUSED PyO __pyx_t_12 = (copy_predict_proba(__pyx_v_X->data, __pyx_v_model, __pyx_v_X->dimensions, __pyx_v_dec_values->data) < 0); if (__pyx_t_12) { - /* "sklearn/svm/libsvm.pyx":388 + /* "sklearn/svm/libsvm.pyx":393 * dec_values = np.empty((X.shape[0], n_class), dtype=np.float64) * if copy_predict_proba(X.data, model, X.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * # free model and param * free_model(model) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __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[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/svm/libsvm.pyx":390 + /* "sklearn/svm/libsvm.pyx":395 * raise MemoryError("We've run out of of memory") * # free model and param * free_model(model) # <<<<<<<<<<<<<< @@ -4447,7 +4447,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_4predict_proba(CYTHON_UNUSED PyO */ free_model(__pyx_v_model); - /* "sklearn/svm/libsvm.pyx":391 + /* "sklearn/svm/libsvm.pyx":396 * # free model and param * free_model(model) * return dec_values # <<<<<<<<<<<<<< @@ -4588,32 +4588,32 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_7decision_function(PyObject *__p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__support)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__SV)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nSV)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sv_coef)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (kw_args > 0) { @@ -4702,7 +4702,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_7decision_function(PyObject *__p } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decision_function") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decision_function") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4744,21 +4744,21 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_7decision_function(PyObject *__p __pyx_v_probA = ((PyArrayObject *)values[7]); __pyx_v_probB = ((PyArrayObject *)values[8]); if (values[9]) { - __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_svm_type = ((int)0); } __pyx_v_kernel = ((PyObject*)values[10]); if (values[11]) { - __pyx_v_degree = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_degree = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_degree = ((int)3); } if (values[12]) { - __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":405 + /* "sklearn/svm/libsvm.pyx":410 * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, # <<<<<<<<<<<<<< @@ -4768,20 +4768,20 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_7decision_function(PyObject *__p __pyx_v_gamma = ((double)0.1); } if (values[13]) { - __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_coef0 = ((double)0.); } if (values[14]) { - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_tol = ((double)1e-3); } if (values[15]) { - __pyx_v_C = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":406 + /* "sklearn/svm/libsvm.pyx":411 * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, * double C=1., double nu=0.5, double epsilon=0.1, # <<<<<<<<<<<<<< @@ -4791,32 +4791,32 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_7decision_function(PyObject *__p __pyx_v_C = ((double)1.); } if (values[16]) { - __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_nu = ((double)0.5); } if (values[17]) { - __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_epsilon = ((double)0.1); } __pyx_v_class_weight = ((PyArrayObject *)values[18]); __pyx_v_sample_weight = ((PyArrayObject *)values[19]); if (values[20]) { - __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[20]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[20]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_shrinking = ((int)0); } if (values[21]) { - __pyx_v_probability = __Pyx_PyInt_AsInt(values[21]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_probability = __Pyx_PyInt_AsInt(values[21]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_probability = ((int)0); } if (values[22]) { - __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[22]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[22]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":412 + /* "sklearn/svm/libsvm.pyx":417 * sample_weight=np.empty(0), * int shrinking=0, int probability=0, * double cache_size=100., # <<<<<<<<<<<<<< @@ -4826,31 +4826,31 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_7decision_function(PyObject *__p __pyx_v_cache_size = ((double)100.); } if (values[23]) { - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[23]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[23]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_max_iter = ((int)-1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("decision_function", 0, 7, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.libsvm.decision_function", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_support), __pyx_ptype_5numpy_ndarray, 1, "support", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV), __pyx_ptype_5numpy_ndarray, 1, "SV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __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 = 409; __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 = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_support), __pyx_ptype_5numpy_ndarray, 1, "support", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV), __pyx_ptype_5numpy_ndarray, 1, "SV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __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 = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_3svm_6libsvm_6decision_function(__pyx_self, __pyx_v_X, __pyx_v_support, __pyx_v_SV, __pyx_v_nSV, __pyx_v_sv_coef, __pyx_v_intercept, __pyx_v_label, __pyx_v_probA, __pyx_v_probB, __pyx_v_svm_type, __pyx_v_kernel, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_tol, __pyx_v_C, __pyx_v_nu, __pyx_v_epsilon, __pyx_v_class_weight, __pyx_v_sample_weight, __pyx_v_shrinking, __pyx_v_probability, __pyx_v_cache_size, __pyx_v_max_iter); goto __pyx_L0; __pyx_L1_error:; @@ -4860,7 +4860,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_7decision_function(PyObject *__p return __pyx_r; } -/* "sklearn/svm/libsvm.pyx":394 +/* "sklearn/svm/libsvm.pyx":399 * * * def decision_function( # <<<<<<<<<<<<<< @@ -4973,100 +4973,100 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __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_support.rcbuffer->pybuffer, (PyObject*)__pyx_v_support, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_support.rcbuffer->pybuffer, (PyObject*)__pyx_v_support, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_support.diminfo[0].strides = __pyx_pybuffernd_support.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_support.diminfo[0].shape = __pyx_pybuffernd_support.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_SV.diminfo[0].strides = __pyx_pybuffernd_SV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SV.diminfo[0].shape = __pyx_pybuffernd_SV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_SV.diminfo[1].strides = __pyx_pybuffernd_SV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_SV.diminfo[1].shape = __pyx_pybuffernd_SV.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_nSV.diminfo[0].strides = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nSV.diminfo[0].shape = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sv_coef.diminfo[0].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sv_coef.diminfo[0].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sv_coef.diminfo[1].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sv_coef.diminfo[1].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercept.diminfo[0].strides = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercept.diminfo[0].shape = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_label.diminfo[0].strides = __pyx_pybuffernd_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_label.diminfo[0].shape = __pyx_pybuffernd_label.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probA.diminfo[0].strides = __pyx_pybuffernd_probA.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probA.diminfo[0].shape = __pyx_pybuffernd_probA.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probB.diminfo[0].strides = __pyx_pybuffernd_probB.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probB.diminfo[0].shape = __pyx_pybuffernd_probB.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/libsvm.pyx":426 + /* "sklearn/svm/libsvm.pyx":431 * * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __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_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __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 = 426; __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 = 431; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __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 = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 431; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __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_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -5074,40 +5074,40 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm.pyx":428 + /* "sklearn/svm/libsvm.pyx":433 * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) * * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) # <<<<<<<<<<<<<< * set_parameter(¶m, svm_type, kernel_index, degree, gamma, * coef0, nu, cache_size, C, tol, epsilon, shrinking, */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __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 = 428; __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 = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_kernel)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_kernel)); __Pyx_GIVEREF(((PyObject *)__pyx_v_kernel)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __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_5)); __pyx_t_5 = 0; __pyx_v_kernel_index = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/svm/libsvm.pyx":429 + /* "sklearn/svm/libsvm.pyx":434 * * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) * set_parameter(¶m, svm_type, kernel_index, degree, gamma, # <<<<<<<<<<<<<< * coef0, nu, cache_size, C, tol, epsilon, shrinking, * probability, class_weight.shape[0], class_weight_label.data, */ - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":432 + /* "sklearn/svm/libsvm.pyx":437 * coef0, nu, cache_size, C, tol, epsilon, shrinking, * probability, class_weight.shape[0], class_weight_label.data, * class_weight.data, max_iter) # <<<<<<<<<<<<<< @@ -5116,7 +5116,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED */ set_parameter((&__pyx_v_param), __pyx_v_svm_type, __pyx_t_7, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_nu, __pyx_v_cache_size, __pyx_v_C, __pyx_v_tol, __pyx_v_epsilon, __pyx_v_shrinking, __pyx_v_probability, ((int)(__pyx_v_class_weight->dimensions[0])), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, __pyx_v_max_iter); - /* "sklearn/svm/libsvm.pyx":437 + /* "sklearn/svm/libsvm.pyx":442 * support.data, support.shape, sv_coef.strides, * sv_coef.data, intercept.data, nSV.data, * label.data, probA.data, probB.data) # <<<<<<<<<<<<<< @@ -5125,7 +5125,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED */ __pyx_v_model = set_model((&__pyx_v_param), ((int)(__pyx_v_nSV->dimensions[0])), __pyx_v_SV->data, __pyx_v_SV->dimensions, __pyx_v_support->data, __pyx_v_support->dimensions, __pyx_v_sv_coef->strides, __pyx_v_sv_coef->data, __pyx_v_intercept->data, __pyx_v_nSV->data, __pyx_v_label->data, __pyx_v_probA->data, __pyx_v_probB->data); - /* "sklearn/svm/libsvm.pyx":439 + /* "sklearn/svm/libsvm.pyx":444 * label.data, probA.data, probB.data) * * if svm_type > 1: # <<<<<<<<<<<<<< @@ -5135,7 +5135,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED __pyx_t_8 = (__pyx_v_svm_type > 1); if (__pyx_t_8) { - /* "sklearn/svm/libsvm.pyx":440 + /* "sklearn/svm/libsvm.pyx":445 * * if svm_type > 1: * n_class = 1 # <<<<<<<<<<<<<< @@ -5147,7 +5147,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED } /*else*/ { - /* "sklearn/svm/libsvm.pyx":442 + /* "sklearn/svm/libsvm.pyx":447 * n_class = 1 * else: * n_class = get_nr(model) # <<<<<<<<<<<<<< @@ -5156,7 +5156,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED */ __pyx_v_n_class = get_nr(__pyx_v_model); - /* "sklearn/svm/libsvm.pyx":443 + /* "sklearn/svm/libsvm.pyx":448 * else: * n_class = get_nr(model) * n_class = n_class * (n_class - 1) / 2 # <<<<<<<<<<<<<< @@ -5167,23 +5167,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED } __pyx_L3:; - /* "sklearn/svm/libsvm.pyx":445 + /* "sklearn/svm/libsvm.pyx":450 * n_class = n_class * (n_class - 1) / 2 * * dec_values = np.empty((X.shape[0], n_class), dtype=np.float64) # <<<<<<<<<<<<<< * if copy_predict_values(X.data, model, X.shape, dec_values.data, n_class) < 0: * raise MemoryError("We've run out of of memory") */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -5191,26 +5191,26 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __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 = 450; __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)); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -5226,13 +5226,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED } } __pyx_pybuffernd_dec_values.diminfo[0].strides = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dec_values.diminfo[0].shape = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dec_values.diminfo[1].strides = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dec_values.diminfo[1].shape = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_9 = 0; __pyx_v_dec_values = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm.pyx":446 + /* "sklearn/svm/libsvm.pyx":451 * * dec_values = np.empty((X.shape[0], n_class), dtype=np.float64) * if copy_predict_values(X.data, model, X.shape, dec_values.data, n_class) < 0: # <<<<<<<<<<<<<< @@ -5242,23 +5242,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED __pyx_t_8 = (copy_predict_values(__pyx_v_X->data, __pyx_v_model, __pyx_v_X->dimensions, __pyx_v_dec_values->data, __pyx_v_n_class) < 0); if (__pyx_t_8) { - /* "sklearn/svm/libsvm.pyx":447 + /* "sklearn/svm/libsvm.pyx":452 * dec_values = np.empty((X.shape[0], n_class), dtype=np.float64) * if copy_predict_values(X.data, model, X.shape, dec_values.data, n_class) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * # free model and param * free_model(model) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __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[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; - /* "sklearn/svm/libsvm.pyx":449 + /* "sklearn/svm/libsvm.pyx":454 * raise MemoryError("We've run out of of memory") * # free model and param * free_model(model) # <<<<<<<<<<<<<< @@ -5267,7 +5267,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_6decision_function(CYTHON_UNUSED */ free_model(__pyx_v_model); - /* "sklearn/svm/libsvm.pyx":450 + /* "sklearn/svm/libsvm.pyx":455 * # free model and param * free_model(model) * return dec_values # <<<<<<<<<<<<<< @@ -5395,12 +5395,12 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_9cross_validation(PyObject *__py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("cross_validation", 0, 3, 18, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cross_validation", 0, 3, 18, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_fold)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("cross_validation", 0, 3, 18, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cross_validation", 0, 3, 18, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { @@ -5479,7 +5479,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_9cross_validation(PyObject *__py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cross_validation") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cross_validation") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5507,19 +5507,19 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_9cross_validation(PyObject *__py } __pyx_v_X = ((PyArrayObject *)values[0]); __pyx_v_Y = ((PyArrayObject *)values[1]); - __pyx_v_n_fold = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_n_fold == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_fold = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_n_fold == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_svm_type = values[3]; __pyx_v_kernel = ((PyObject*)values[4]); if (values[5]) { - __pyx_v_degree = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_degree = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_degree = ((int)3); } if (values[6]) { - __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":457 + /* "sklearn/svm/libsvm.pyx":462 * np.ndarray[np.float64_t, ndim=1, mode='c'] Y, * int n_fold, svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, # <<<<<<<<<<<<<< @@ -5529,20 +5529,20 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_9cross_validation(PyObject *__py __pyx_v_gamma = ((double)0.1); } if (values[7]) { - __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_coef0 = ((double)0.); } if (values[8]) { - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_tol = ((double)1e-3); } if (values[9]) { - __pyx_v_C = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":458 + /* "sklearn/svm/libsvm.pyx":463 * int n_fold, svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, * double C=1., double nu=0.5, double epsilon=0.1, # <<<<<<<<<<<<<< @@ -5552,32 +5552,32 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_9cross_validation(PyObject *__py __pyx_v_C = ((double)1.); } if (values[10]) { - __pyx_v_nu = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_nu = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_nu = ((double)0.5); } if (values[11]) { - __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_epsilon = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_epsilon = ((double)0.1); } __pyx_v_class_weight = ((PyArrayObject *)values[12]); __pyx_v_sample_weight = ((PyArrayObject *)values[13]); if (values[14]) { - __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[14]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[14]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_shrinking = ((int)0); } if (values[15]) { - __pyx_v_probability = __Pyx_PyInt_AsInt(values[15]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_probability = __Pyx_PyInt_AsInt(values[15]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_probability = ((int)0); } if (values[16]) { - __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/svm/libsvm.pyx":463 + /* "sklearn/svm/libsvm.pyx":468 * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), * int shrinking=0, int probability=0, double cache_size=100., # <<<<<<<<<<<<<< @@ -5587,24 +5587,24 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_9cross_validation(PyObject *__py __pyx_v_cache_size = ((double)100.); } if (values[17]) { - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[17]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[17]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_max_iter = ((int)-1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cross_validation", 0, 3, 18, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cross_validation", 0, 3, 18, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.libsvm.cross_validation", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __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 = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __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 = 461; __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 = 459; __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 = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_kernel), (&PyString_Type), 1, "kernel", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __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 = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(__pyx_self, __pyx_v_X, __pyx_v_Y, __pyx_v_n_fold, __pyx_v_svm_type, __pyx_v_kernel, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_tol, __pyx_v_C, __pyx_v_nu, __pyx_v_epsilon, __pyx_v_class_weight, __pyx_v_sample_weight, __pyx_v_shrinking, __pyx_v_probability, __pyx_v_cache_size, __pyx_v_max_iter); goto __pyx_L0; __pyx_L1_error:; @@ -5614,7 +5614,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_9cross_validation(PyObject *__py return __pyx_r; } -/* "sklearn/svm/libsvm.pyx":453 +/* "sklearn/svm/libsvm.pyx":458 * * * def cross_validation( # <<<<<<<<<<<<<< @@ -5625,7 +5625,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_9cross_validation(PyObject *__py static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_Y, int __pyx_v_n_fold, PyObject *__pyx_v_svm_type, PyObject *__pyx_v_kernel, int __pyx_v_degree, double __pyx_v_gamma, double __pyx_v_coef0, double __pyx_v_tol, double __pyx_v_C, double __pyx_v_nu, CYTHON_UNUSED double __pyx_v_epsilon, PyArrayObject *__pyx_v_class_weight, PyArrayObject *__pyx_v_sample_weight, int __pyx_v_shrinking, int __pyx_v_probability, double __pyx_v_cache_size, int __pyx_v_max_iter) { struct svm_parameter __pyx_v_param; struct svm_problem __pyx_v_problem; - char *__pyx_v_error_msg; + const char * __pyx_v_error_msg; PyObject *__pyx_v_kernel_index = NULL; PyArrayObject *__pyx_v_class_weight_label = 0; PyArrayObject *__pyx_v_target = 0; @@ -5689,70 +5689,70 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __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_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/libsvm.pyx":517 + /* "sklearn/svm/libsvm.pyx":522 * cdef np.npy_intp nr * * if len(sample_weight) == 0: # <<<<<<<<<<<<<< * sample_weight = np.ones(X.shape[0], dtype=np.float64) * else: */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_sample_weight)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_sample_weight)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (__pyx_t_1 == 0); if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":518 + /* "sklearn/svm/libsvm.pyx":523 * * if len(sample_weight) == 0: * sample_weight = np.ones(X.shape[0], dtype=np.float64) # <<<<<<<<<<<<<< * else: * assert sample_weight.shape[0] == X.shape[0], \ */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __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_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __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 = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __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_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __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_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -5768,7 +5768,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED } } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_sample_weight)); @@ -5778,7 +5778,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED } /*else*/ { - /* "sklearn/svm/libsvm.pyx":520 + /* "sklearn/svm/libsvm.pyx":525 * sample_weight = np.ones(X.shape[0], dtype=np.float64) * else: * assert sample_weight.shape[0] == X.shape[0], \ # <<<<<<<<<<<<<< @@ -5788,18 +5788,18 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_sample_weight->dimensions[0]) == (__pyx_v_X->dimensions[0])))) { - /* "sklearn/svm/libsvm.pyx":523 + /* "sklearn/svm/libsvm.pyx":528 * "sample_weight and X have incompatible shapes: " + \ * "sample_weight has %s samples while X has %s" % \ * (sample_weight.shape[0], X.shape[0]) # <<<<<<<<<<<<<< * * if X.shape[0] < n_fold: */ - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_sample_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_sample_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); @@ -5807,21 +5807,21 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED __Pyx_GIVEREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif } __pyx_L3:; - /* "sklearn/svm/libsvm.pyx":525 + /* "sklearn/svm/libsvm.pyx":530 * (sample_weight.shape[0], X.shape[0]) * * if X.shape[0] < n_fold: # <<<<<<<<<<<<<< @@ -5831,57 +5831,57 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED __pyx_t_2 = ((__pyx_v_X->dimensions[0]) < __pyx_v_n_fold); if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":526 + /* "sklearn/svm/libsvm.pyx":531 * * if X.shape[0] < n_fold: * raise ValueError("Number of samples is less than number of folds") # <<<<<<<<<<<<<< * * # set problem */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __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_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; - /* "sklearn/svm/libsvm.pyx":529 + /* "sklearn/svm/libsvm.pyx":534 * * # set problem * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) # <<<<<<<<<<<<<< * set_problem( * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__index); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __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 = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_kernel)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_kernel)); __Pyx_GIVEREF(((PyObject *)__pyx_v_kernel)); - __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_v_kernel_index = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/svm/libsvm.pyx":531 + /* "sklearn/svm/libsvm.pyx":536 * kernel_index = LIBSVM_KERNEL_TYPES.index(kernel) * set_problem( * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) # <<<<<<<<<<<<<< * if problem.x == NULL: * raise MemoryError("Seems we've run out of of memory") */ - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} set_problem((&__pyx_v_problem), __pyx_v_X->data, __pyx_v_Y->data, __pyx_v_sample_weight->data, __pyx_v_X->dimensions, __pyx_t_9); - /* "sklearn/svm/libsvm.pyx":532 + /* "sklearn/svm/libsvm.pyx":537 * set_problem( * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) * if problem.x == NULL: # <<<<<<<<<<<<<< @@ -5891,62 +5891,62 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED __pyx_t_2 = (__pyx_v_problem.x == NULL); if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":533 + /* "sklearn/svm/libsvm.pyx":538 * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) * if problem.x == NULL: * raise MemoryError("Seems we've run out of of memory") # <<<<<<<<<<<<<< * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) */ - __pyx_t_7 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "sklearn/svm/libsvm.pyx":535 + /* "sklearn/svm/libsvm.pyx":540 * raise MemoryError("Seems we've run out of of memory") * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * * # set parameters */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__arange); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__arange); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __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 = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 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 = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -5954,17 +5954,17 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/svm/libsvm.pyx":539 + /* "sklearn/svm/libsvm.pyx":544 * # set parameters * set_parameter( * ¶m, svm_type, kernel_index, degree, gamma, coef0, nu, cache_size, # <<<<<<<<<<<<<< * C, tol, tol, shrinking, probability, * class_weight.shape[0], class_weight_label.data, */ - __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_svm_type); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_svm_type); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyInt_AsInt(__pyx_v_kernel_index); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":542 + /* "sklearn/svm/libsvm.pyx":547 * C, tol, tol, shrinking, probability, * class_weight.shape[0], class_weight_label.data, * class_weight.data, max_iter) # <<<<<<<<<<<<<< @@ -5973,7 +5973,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED */ set_parameter((&__pyx_v_param), __pyx_t_9, __pyx_t_14, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_nu, __pyx_v_cache_size, __pyx_v_C, __pyx_v_tol, __pyx_v_tol, __pyx_v_shrinking, __pyx_v_probability, ((int)(__pyx_v_class_weight->dimensions[0])), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, __pyx_v_max_iter); - /* "sklearn/svm/libsvm.pyx":544 + /* "sklearn/svm/libsvm.pyx":549 * class_weight.data, max_iter) * * error_msg = svm_check_parameter(&problem, ¶m); # <<<<<<<<<<<<<< @@ -5982,7 +5982,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED */ __pyx_v_error_msg = svm_check_parameter((&__pyx_v_problem), (&__pyx_v_param)); - /* "sklearn/svm/libsvm.pyx":545 + /* "sklearn/svm/libsvm.pyx":550 * * error_msg = svm_check_parameter(&problem, ¶m); * if error_msg: # <<<<<<<<<<<<<< @@ -5992,64 +5992,64 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED __pyx_t_2 = (__pyx_v_error_msg != 0); if (__pyx_t_2) { - /* "sklearn/svm/libsvm.pyx":546 + /* "sklearn/svm/libsvm.pyx":551 * error_msg = svm_check_parameter(&problem, ¶m); * if error_msg: * raise ValueError(error_msg) # <<<<<<<<<<<<<< * * cdef np.ndarray[np.float64_t, ndim=1, mode='c'] target */ - __pyx_t_6 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __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)); __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 = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__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 = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "sklearn/svm/libsvm.pyx":549 + /* "sklearn/svm/libsvm.pyx":554 * * cdef np.ndarray[np.float64_t, ndim=1, mode='c'] target * target = np.empty((X.shape[0]), dtype=np.float64) # <<<<<<<<<<<<<< * svm_cross_validation(&problem, ¶m, n_fold, target.data) * */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __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 = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 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 = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -6065,13 +6065,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED } } __pyx_pybuffernd_target.diminfo[0].strides = __pyx_pybuffernd_target.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_target.diminfo[0].shape = __pyx_pybuffernd_target.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_15 = 0; __pyx_v_target = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm.pyx":550 + /* "sklearn/svm/libsvm.pyx":555 * cdef np.ndarray[np.float64_t, ndim=1, mode='c'] target * target = np.empty((X.shape[0]), dtype=np.float64) * svm_cross_validation(&problem, ¶m, n_fold, target.data) # <<<<<<<<<<<<<< @@ -6080,7 +6080,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED */ svm_cross_validation((&__pyx_v_problem), (&__pyx_v_param), __pyx_v_n_fold, ((double *)__pyx_v_target->data)); - /* "sklearn/svm/libsvm.pyx":552 + /* "sklearn/svm/libsvm.pyx":557 * svm_cross_validation(&problem, ¶m, n_fold, target.data) * * free(problem.x) # <<<<<<<<<<<<<< @@ -6089,7 +6089,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_8cross_validation(CYTHON_UNUSED */ free(__pyx_v_problem.x); - /* "sklearn/svm/libsvm.pyx":553 + /* "sklearn/svm/libsvm.pyx":558 * * free(problem.x) * return target # <<<<<<<<<<<<<< @@ -6148,7 +6148,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_11set_verbosity_wrap(PyObject *_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_verbosity_wrap (wrapper)", 0); assert(__pyx_arg_verbosity); { - __pyx_v_verbosity = __Pyx_PyInt_AsInt(__pyx_arg_verbosity); if (unlikely((__pyx_v_verbosity == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_verbosity = __Pyx_PyInt_AsInt(__pyx_arg_verbosity); if (unlikely((__pyx_v_verbosity == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6161,7 +6161,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_6libsvm_11set_verbosity_wrap(PyObject *_ return __pyx_r; } -/* "sklearn/svm/libsvm.pyx":556 +/* "sklearn/svm/libsvm.pyx":561 * * * def set_verbosity_wrap(int verbosity): # <<<<<<<<<<<<<< @@ -6174,7 +6174,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_10set_verbosity_wrap(CYTHON_UNUS __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_verbosity_wrap", 0); - /* "sklearn/svm/libsvm.pyx":560 + /* "sklearn/svm/libsvm.pyx":565 * Control verbosity of libsvm library * """ * set_verbosity(verbosity) # <<<<<<<<<<<<<< @@ -6188,8 +6188,8 @@ static PyObject *__pyx_pf_7sklearn_3svm_6libsvm_10set_verbosity_wrap(CYTHON_UNUS } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -7007,8 +7007,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -8268,8 +8268,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -8281,28 +8281,28 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/svm/libsvm.pyx":151 + /* "sklearn/svm/libsvm.pyx":156 * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) * if problem.x == NULL: * raise MemoryError("Seems we've run out of of memory") # <<<<<<<<<<<<<< * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "sklearn/svm/libsvm.pyx":165 + /* "sklearn/svm/libsvm.pyx":170 * if error_msg: * # for SVR: epsilon is called p in libsvm * error_repl = error_msg.replace("p < 0", "epsilon < 0") # <<<<<<<<<<<<<< * raise ValueError(error_repl) * */ - __pyx_k_tuple_9 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_9 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_s_7)); @@ -8312,14 +8312,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); - /* "sklearn/svm/libsvm.pyx":196 + /* "sklearn/svm/libsvm.pyx":201 * if kernel_index == 4: * # precomputed kernel * support_vectors = np.empty((0, 0), dtype=np.float64) # <<<<<<<<<<<<<< * else: * support_vectors = np.empty((SV_len, X.shape[1]), dtype=np.float64) */ - __pyx_k_tuple_10 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_10 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, __pyx_int_0); @@ -8328,133 +8328,133 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_10, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_10)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_k_tuple_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - /* "sklearn/svm/libsvm.pyx":221 + /* "sklearn/svm/libsvm.pyx":226 * copy_probB(probB.data, model, probB.shape) * else: * probA = np.empty(1, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(0, dtype=np.float64) * copy_probA(probA.data, model, probA.shape) */ - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "sklearn/svm/libsvm.pyx":222 + /* "sklearn/svm/libsvm.pyx":227 * else: * probA = np.empty(1, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * copy_probA(probA.data, model, probA.shape) * else: */ - __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); - /* "sklearn/svm/libsvm.pyx":225 + /* "sklearn/svm/libsvm.pyx":230 * copy_probA(probA.data, model, probA.shape) * else: * probA = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(0, dtype=np.float64) * */ - __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - /* "sklearn/svm/libsvm.pyx":226 + /* "sklearn/svm/libsvm.pyx":231 * else: * probA = np.empty(0, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * * # memory deallocation */ - __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); - /* "sklearn/svm/libsvm.pyx":316 + /* "sklearn/svm/libsvm.pyx":321 * dec_values = np.empty(X.shape[0]) * if copy_predict(X.data, model, X.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * free_model(model) * return dec_values */ - __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - /* "sklearn/svm/libsvm.pyx":388 + /* "sklearn/svm/libsvm.pyx":393 * dec_values = np.empty((X.shape[0], n_class), dtype=np.float64) * if copy_predict_proba(X.data, model, X.shape, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * # free model and param * free_model(model) */ - __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_26); __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); - /* "sklearn/svm/libsvm.pyx":447 + /* "sklearn/svm/libsvm.pyx":452 * dec_values = np.empty((X.shape[0], n_class), dtype=np.float64) * if copy_predict_values(X.data, model, X.shape, dec_values.data, n_class) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * # free model and param * free_model(model) */ - __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_31); __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); - /* "sklearn/svm/libsvm.pyx":526 + /* "sklearn/svm/libsvm.pyx":531 * * if X.shape[0] < n_fold: * raise ValueError("Number of samples is less than number of folds") # <<<<<<<<<<<<<< * * # set problem */ - __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_35); __Pyx_INCREF(((PyObject *)__pyx_kp_s_34)); PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_34)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); - /* "sklearn/svm/libsvm.pyx":533 + /* "sklearn/svm/libsvm.pyx":538 * &problem, X.data, Y.data, sample_weight.data, X.shape, kernel_index) * if problem.x == NULL: * raise MemoryError("Seems we've run out of of memory") # <<<<<<<<<<<<<< * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) */ - __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_36); __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_5)); @@ -8545,42 +8545,42 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_47)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48)); - /* "sklearn/svm/libsvm.pyx":55 + /* "sklearn/svm/libsvm.pyx":60 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_50); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50)); - /* "sklearn/svm/libsvm.pyx":57 + /* "sklearn/svm/libsvm.pyx":62 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=1, int probability=0, * double cache_size=100., */ - __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_51 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_51); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); - /* "sklearn/svm/libsvm.pyx":48 + /* "sklearn/svm/libsvm.pyx":53 * # Wrapper functions * * def fit( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2, mode='c'] X, * np.ndarray[np.float64_t, ndim=1, mode='c'] Y, */ - __pyx_k_tuple_52 = PyTuple_New(36); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_52 = PyTuple_New(36); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_52); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_n_s__X)); @@ -8691,72 +8691,72 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_52, 35, ((PyObject *)__pyx_n_s__probB)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__probB)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52)); - __pyx_k_codeobj_53 = (PyObject*)__Pyx_PyCode_New(17, 0, 36, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__fit, 48, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_53 = (PyObject*)__Pyx_PyCode_New(17, 0, 36, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__fit, 53, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":242 + /* "sklearn/svm/libsvm.pyx":247 * np.ndarray[np.float64_t, ndim=1, mode='c'] intercept, * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), * int svm_type=0, str kernel='rbf', int degree=3, */ - __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_56); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56)); - /* "sklearn/svm/libsvm.pyx":243 + /* "sklearn/svm/libsvm.pyx":248 * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), # <<<<<<<<<<<<<< * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, */ - __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_57); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); - /* "sklearn/svm/libsvm.pyx":248 + /* "sklearn/svm/libsvm.pyx":253 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_58 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_58); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_58, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58)); - /* "sklearn/svm/libsvm.pyx":250 + /* "sklearn/svm/libsvm.pyx":255 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=0, int probability=0, * double cache_size=100., */ - __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_59); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); - /* "sklearn/svm/libsvm.pyx":235 + /* "sklearn/svm/libsvm.pyx":240 * * * def predict(np.ndarray[np.float64_t, ndim=2, mode='c'] X, # <<<<<<<<<<<<<< * np.ndarray[np.int32_t, ndim=1, mode='c'] support, * np.ndarray[np.float64_t, ndim=2, mode='c'] SV, */ - __pyx_k_tuple_60 = PyTuple_New(29); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_60 = PyTuple_New(29); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_60); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_n_s__X)); @@ -8846,72 +8846,72 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_60, 28, ((PyObject *)__pyx_n_s__kernel_index)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__kernel_index)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60)); - __pyx_k_codeobj_61 = (PyObject*)__Pyx_PyCode_New(24, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__predict, 235, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_61 = (PyObject*)__Pyx_PyCode_New(24, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__predict, 240, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":329 + /* "sklearn/svm/libsvm.pyx":334 * np.ndarray[np.float64_t, ndim=1, mode='c'] intercept, * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), * int svm_type=0, str kernel='rbf', int degree=3, */ - __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_62); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); - /* "sklearn/svm/libsvm.pyx":330 + /* "sklearn/svm/libsvm.pyx":335 * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), # <<<<<<<<<<<<<< * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, */ - __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_63); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); - /* "sklearn/svm/libsvm.pyx":335 + /* "sklearn/svm/libsvm.pyx":340 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_k_tuple_64 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_64 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_64); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_64, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64)); - /* "sklearn/svm/libsvm.pyx":337 + /* "sklearn/svm/libsvm.pyx":342 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=0, int probability=0, * double cache_size=100., */ - __pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_65); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65)); - /* "sklearn/svm/libsvm.pyx":321 + /* "sklearn/svm/libsvm.pyx":326 * * * def predict_proba( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2, mode='c'] X, * np.ndarray[np.int32_t, ndim=1, mode='c'] support, */ - __pyx_k_tuple_66 = PyTuple_New(30); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_66 = PyTuple_New(30); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_66); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_n_s__X)); @@ -9004,72 +9004,72 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_66, 29, ((PyObject *)__pyx_n_s__n_class)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_class)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66)); - __pyx_k_codeobj_67 = (PyObject*)__Pyx_PyCode_New(24, 0, 30, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__predict_proba, 321, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_67 = (PyObject*)__Pyx_PyCode_New(24, 0, 30, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__predict_proba, 326, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":402 + /* "sklearn/svm/libsvm.pyx":407 * np.ndarray[np.float64_t, ndim=1, mode='c'] intercept, * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), * int svm_type=0, str kernel='rbf', int degree=3, */ - __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_68); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68)); - /* "sklearn/svm/libsvm.pyx":403 + /* "sklearn/svm/libsvm.pyx":408 * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), # <<<<<<<<<<<<<< * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, */ - __pyx_k_tuple_69 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_69 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_69); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69)); - /* "sklearn/svm/libsvm.pyx":408 + /* "sklearn/svm/libsvm.pyx":413 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_70); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70)); - /* "sklearn/svm/libsvm.pyx":410 + /* "sklearn/svm/libsvm.pyx":415 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=0, int probability=0, * double cache_size=100., */ - __pyx_k_tuple_71 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_71 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_71); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71)); - /* "sklearn/svm/libsvm.pyx":394 + /* "sklearn/svm/libsvm.pyx":399 * * * def decision_function( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2, mode='c'] X, * np.ndarray[np.int32_t, ndim=1, mode='c'] support, */ - __pyx_k_tuple_72 = PyTuple_New(30); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_72 = PyTuple_New(30); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_72); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_n_s__X)); @@ -9162,44 +9162,44 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_72, 29, ((PyObject *)__pyx_n_s__kernel_index)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__kernel_index)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72)); - __pyx_k_codeobj_73 = (PyObject*)__Pyx_PyCode_New(24, 0, 30, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__decision_function, 394, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_73 = (PyObject*)__Pyx_PyCode_New(24, 0, 30, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__decision_function, 399, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":460 + /* "sklearn/svm/libsvm.pyx":465 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_74); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74)); - /* "sklearn/svm/libsvm.pyx":462 + /* "sklearn/svm/libsvm.pyx":467 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=0, int probability=0, double cache_size=100., * int max_iter=-1): */ - __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_75 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_75); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75)); - /* "sklearn/svm/libsvm.pyx":453 + /* "sklearn/svm/libsvm.pyx":458 * * * def cross_validation( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2, mode='c'] X, * np.ndarray[np.float64_t, ndim=1, mode='c'] Y, */ - __pyx_k_tuple_76 = PyTuple_New(27); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_76 = PyTuple_New(27); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_76); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, ((PyObject *)__pyx_n_s__X)); @@ -9283,16 +9283,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_76, 26, ((PyObject *)__pyx_n_s__target)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__target)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76)); - __pyx_k_codeobj_77 = (PyObject*)__Pyx_PyCode_New(18, 0, 27, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__cross_validation, 453, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_77 = (PyObject*)__Pyx_PyCode_New(18, 0, 27, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__cross_validation, 458, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm.pyx":556 + /* "sklearn/svm/libsvm.pyx":561 * * * def set_verbosity_wrap(int verbosity): # <<<<<<<<<<<<<< * """ * Control verbosity of libsvm library */ - __pyx_k_tuple_78 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_78 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_78); __Pyx_INCREF(((PyObject *)__pyx_n_s__verbosity)); PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_n_s__verbosity)); @@ -9301,7 +9301,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_78, 1, ((PyObject *)__pyx_n_s__verbosity)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__verbosity)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78)); - __pyx_k_codeobj_79 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__set_verbosity_wrap, 556, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_79 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__set_verbosity_wrap, 561, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -9436,13 +9436,22 @@ PyMODINIT_FUNC PyInit_libsvm(void) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/svm/libsvm.pyx":42 + * ctypedef char* const_char_p "const char *" + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/svm/libsvm.pyx":47 * ################################################################################ * # Internal variables * LIBSVM_KERNEL_TYPES = ['linear', 'poly', 'rbf', 'sigmoid', 'precomputed'] # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__linear)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__linear)); @@ -9459,399 +9468,399 @@ PyMODINIT_FUNC PyInit_libsvm(void) __Pyx_INCREF(((PyObject *)__pyx_n_s__precomputed)); PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__precomputed)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__precomputed)); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__LIBSVM_KERNEL_TYPES, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":55 + /* "sklearn/svm/libsvm.pyx":60 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __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 = 55; __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_1 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":57 + /* "sklearn/svm/libsvm.pyx":62 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=1, int probability=0, * double cache_size=100., */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_51), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __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 = 57; __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 = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_2 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":48 + /* "sklearn/svm/libsvm.pyx":53 * # Wrapper functions * * def fit( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2, mode='c'] X, * np.ndarray[np.float64_t, ndim=1, mode='c'] Y, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_1fit, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_1fit, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fit, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fit, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":242 + /* "sklearn/svm/libsvm.pyx":247 * np.ndarray[np.float64_t, ndim=1, mode='c'] intercept, * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), * int svm_type=0, str kernel='rbf', int degree=3, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __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 = 242; __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 = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_16 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":243 + /* "sklearn/svm/libsvm.pyx":248 * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), # <<<<<<<<<<<<<< * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __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 = 243; __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 = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_17 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":248 + /* "sklearn/svm/libsvm.pyx":253 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __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 = 248; __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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_18 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":250 + /* "sklearn/svm/libsvm.pyx":255 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=0, int probability=0, * double cache_size=100., */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __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 = 250; __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 = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_19 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":235 + /* "sklearn/svm/libsvm.pyx":240 * * * def predict(np.ndarray[np.float64_t, ndim=2, mode='c'] X, # <<<<<<<<<<<<<< * np.ndarray[np.int32_t, ndim=1, mode='c'] support, * np.ndarray[np.float64_t, ndim=2, mode='c'] SV, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_3predict, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_3predict, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__predict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__predict, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":329 + /* "sklearn/svm/libsvm.pyx":334 * np.ndarray[np.float64_t, ndim=1, mode='c'] intercept, * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), * int svm_type=0, str kernel='rbf', int degree=3, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __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 = 329; __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 = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_22 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":330 + /* "sklearn/svm/libsvm.pyx":335 * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), # <<<<<<<<<<<<<< * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __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 = 330; __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 = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_23 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":335 + /* "sklearn/svm/libsvm.pyx":340 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __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 = 335; __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 = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_24 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":337 + /* "sklearn/svm/libsvm.pyx":342 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=0, int probability=0, * double cache_size=100., */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __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 = 337; __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 = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_25 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":321 + /* "sklearn/svm/libsvm.pyx":326 * * * def predict_proba( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2, mode='c'] X, * np.ndarray[np.int32_t, ndim=1, mode='c'] support, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_5predict_proba, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_5predict_proba, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__predict_proba, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__predict_proba, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":402 + /* "sklearn/svm/libsvm.pyx":407 * np.ndarray[np.float64_t, ndim=1, mode='c'] intercept, * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), * int svm_type=0, str kernel='rbf', int degree=3, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __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 = 402; __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 = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_27 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":403 + /* "sklearn/svm/libsvm.pyx":408 * np.ndarray[np.int32_t, ndim=1, mode='c'] label, * np.ndarray[np.float64_t, ndim=1, mode='c'] probA=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] probB=np.empty(0), # <<<<<<<<<<<<<< * int svm_type=0, str kernel='rbf', int degree=3, * double gamma=0.1, double coef0=0., double tol=1e-3, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __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 = 403; __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 = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_28 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":408 + /* "sklearn/svm/libsvm.pyx":413 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_70), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __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 = 408; __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 = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_29 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":410 + /* "sklearn/svm/libsvm.pyx":415 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=0, int probability=0, * double cache_size=100., */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_71), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_71), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __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 = 410; __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 = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_30 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":394 + /* "sklearn/svm/libsvm.pyx":399 * * * def decision_function( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2, mode='c'] X, * np.ndarray[np.int32_t, ndim=1, mode='c'] support, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_7decision_function, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_7decision_function, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__decision_function, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__decision_function, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":460 + /* "sklearn/svm/libsvm.pyx":465 * double C=1., double nu=0.5, double epsilon=0.1, * np.ndarray[np.float64_t, ndim=1, mode='c'] * class_weight=np.empty(0), # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __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 = 460; __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 = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_32 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":462 + /* "sklearn/svm/libsvm.pyx":467 * class_weight=np.empty(0), * np.ndarray[np.float64_t, ndim=1, mode='c'] * sample_weight=np.empty(0), # <<<<<<<<<<<<<< * int shrinking=0, int probability=0, double cache_size=100., * int max_iter=-1): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_75), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __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 = 462; __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 = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_k_33 = ((PyArrayObject *)__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":453 + /* "sklearn/svm/libsvm.pyx":458 * * * def cross_validation( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2, mode='c'] X, * np.ndarray[np.float64_t, ndim=1, mode='c'] Y, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_9cross_validation, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_9cross_validation, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cross_validation, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cross_validation, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm.pyx":556 + /* "sklearn/svm/libsvm.pyx":561 * * * def set_verbosity_wrap(int verbosity): # <<<<<<<<<<<<<< * """ * Control verbosity of libsvm library */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_11set_verbosity_wrap, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_6libsvm_11set_verbosity_wrap, NULL, __pyx_n_s_55); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_verbosity_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_verbosity_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/svm/libsvm.pyx":1 diff --git a/sklearn/svm/libsvm.pyx b/sklearn/svm/libsvm.pyx index a9f862f415cff..39eebb175823c 100644 --- a/sklearn/svm/libsvm.pyx +++ b/sklearn/svm/libsvm.pyx @@ -36,6 +36,11 @@ cimport numpy as np cimport libsvm from libc.stdlib cimport free +cdef extern from *: + ctypedef char* const_char_p "const char *" + +np.import_array() + ################################################################################ # Internal variables @@ -130,7 +135,7 @@ def fit( cdef svm_parameter param cdef svm_problem problem cdef svm_model *model - cdef char *error_msg + cdef const_char_p error_msg cdef np.npy_intp SV_len cdef np.npy_intp nr @@ -510,7 +515,7 @@ def cross_validation( cdef svm_parameter param cdef svm_problem problem cdef svm_model *model - cdef char *error_msg + cdef const_char_p error_msg cdef np.npy_intp SV_len cdef np.npy_intp nr diff --git a/sklearn/svm/libsvm_sparse.c b/sklearn/svm/libsvm_sparse.c index 601c2744c5f3a..12bc140398377 100644 --- a/sklearn/svm/libsvm_sparse.c +++ b/sklearn/svm/libsvm_sparse.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.2 on Tue Dec 11 20:11:39 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:52 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -990,7 +990,7 @@ static char __pyx_k_16[] = "Non-native byte order not supported"; static char __pyx_k_18[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_19[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_22[] = "Format string allocated too short."; -static char __pyx_k_26[] = "/home/andy/checkout/scikit-learn/sklearn/svm/libsvm_sparse.pyx"; +static char __pyx_k_26[] = "/scratch/apps/src/scikit-learn/sklearn/svm/libsvm_sparse.pyx"; static char __pyx_k_27[] = "sklearn.svm.libsvm_sparse"; static char __pyx_k_30[] = "libsvm_sparse_predict"; static char __pyx_k_33[] = "libsvm_sparse_predict_proba"; @@ -1252,101 +1252,101 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_1libsvm_sparse_train(PyO case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__indptr)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__svm_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kernel_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__degree)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gamma)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coef0)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 10: if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 11: if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 12: if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__class_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 13: if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 14: if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nu)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 15: if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cache_size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 16: if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 17: if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shrinking)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 18: if (likely((values[18] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__probability)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 18); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 18); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 19: if (likely((values[19] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_iter)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 19); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, 19); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "libsvm_sparse_train") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "libsvm_sparse_train") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 20) { goto __pyx_L5_argtuple_error; @@ -1372,41 +1372,41 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_1libsvm_sparse_train(PyO values[18] = PyTuple_GET_ITEM(__pyx_args, 18); values[19] = PyTuple_GET_ITEM(__pyx_args, 19); } - __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 = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __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 = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_values = ((PyArrayObject *)values[1]); __pyx_v_indices = ((PyArrayObject *)values[2]); __pyx_v_indptr = ((PyArrayObject *)values[3]); __pyx_v_Y = ((PyArrayObject *)values[4]); - __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_kernel_type = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_kernel_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_degree = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_kernel_type = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_kernel_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_degree = __Pyx_PyInt_AsInt(values[7]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_class_weight = ((PyArrayObject *)values[12]); __pyx_v_sample_weight = ((PyArrayObject *)values[13]); - __pyx_v_nu = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_p = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[17]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_probability = __Pyx_PyInt_AsInt(values[18]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[19]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_nu = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_cache_size = __pyx_PyFloat_AsDouble(values[15]); if (unlikely((__pyx_v_cache_size == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[17]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_probability = __Pyx_PyInt_AsInt(values[18]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[19]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_train", 1, 20, 20, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.libsvm_sparse.libsvm_sparse_train", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indptr), __pyx_ptype_5numpy_ndarray, 1, "indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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 = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indices), __pyx_ptype_5numpy_ndarray, 1, "indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_indptr), __pyx_ptype_5numpy_ndarray, 1, "indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __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 = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __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 = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(__pyx_self, __pyx_v_n_features, __pyx_v_values, __pyx_v_indices, __pyx_v_indptr, __pyx_v_Y, __pyx_v_svm_type, __pyx_v_kernel_type, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_eps, __pyx_v_C, __pyx_v_class_weight, __pyx_v_sample_weight, __pyx_v_nu, __pyx_v_cache_size, __pyx_v_p, __pyx_v_shrinking, __pyx_v_probability, __pyx_v_max_iter); goto __pyx_L0; __pyx_L1_error:; @@ -1416,7 +1416,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_1libsvm_sparse_train(PyO return __pyx_r; } -/* "sklearn/svm/libsvm_sparse.pyx":61 +/* "sklearn/svm/libsvm_sparse.pyx":66 * * * def libsvm_sparse_train ( int n_features, # <<<<<<<<<<<<<< @@ -1428,7 +1428,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH struct svm_parameter *__pyx_v_param; struct svm_csr_problem *__pyx_v_problem; struct svm_csr_model *__pyx_v_model; - char *__pyx_v_error_msg; + const char* __pyx_v_error_msg; PyArrayObject *__pyx_v_class_weight_label = 0; int __pyx_v_fit_status; npy_intp __pyx_v_SV_len; @@ -1510,80 +1510,80 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_indices.diminfo[0].strides = __pyx_pybuffernd_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indices.diminfo[0].shape = __pyx_pybuffernd_indices.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_indptr.diminfo[0].strides = __pyx_pybuffernd_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indptr.diminfo[0].shape = __pyx_pybuffernd_indptr.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Y.rcbuffer->pybuffer, (PyObject*)__pyx_v_Y, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __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_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __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_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/libsvm_sparse.pyx":100 - * cdef char *error_msg + /* "sklearn/svm/libsvm_sparse.pyx":105 + * cdef const_char_p error_msg * * if len(sample_weight) == 0: # <<<<<<<<<<<<<< * sample_weight = np.ones(Y.shape[0], dtype=np.float64) * else: */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_sample_weight)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_sample_weight)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = (__pyx_t_1 == 0); if (__pyx_t_2) { - /* "sklearn/svm/libsvm_sparse.pyx":101 + /* "sklearn/svm/libsvm_sparse.pyx":106 * * if len(sample_weight) == 0: * sample_weight = np.ones(Y.shape[0], dtype=np.float64) # <<<<<<<<<<<<<< * else: * assert sample_weight.shape[0] == indptr.shape[0] - 1, \ */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __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 = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -1599,7 +1599,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH } } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_sample_weight)); @@ -1609,7 +1609,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH } /*else*/ { - /* "sklearn/svm/libsvm_sparse.pyx":103 + /* "sklearn/svm/libsvm_sparse.pyx":108 * sample_weight = np.ones(Y.shape[0], dtype=np.float64) * else: * assert sample_weight.shape[0] == indptr.shape[0] - 1, \ # <<<<<<<<<<<<<< @@ -1619,18 +1619,18 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_sample_weight->dimensions[0]) == ((__pyx_v_indptr->dimensions[0]) - 1)))) { - /* "sklearn/svm/libsvm_sparse.pyx":106 + /* "sklearn/svm/libsvm_sparse.pyx":111 * "sample_weight and X have incompatible shapes: " + \ * "sample_weight has %s samples while X has %s" % \ * (sample_weight.shape[0], indptr.shape[0] - 1) # <<<<<<<<<<<<<< * * # we should never end up here with a precomputed kernel matrix, */ - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_sample_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_sample_weight->dimensions[0])); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyInt_FromLong(((__pyx_v_indptr->dimensions[0]) - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(((__pyx_v_indptr->dimensions[0]) - 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); @@ -1638,21 +1638,21 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH __Pyx_GIVEREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif } __pyx_L3:; - /* "sklearn/svm/libsvm_sparse.pyx":110 + /* "sklearn/svm/libsvm_sparse.pyx":115 * # we should never end up here with a precomputed kernel matrix, * # as this is always dense. * assert(kernel_type != 4) # <<<<<<<<<<<<<< @@ -1662,11 +1662,11 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!(__pyx_v_kernel_type != 4))) { PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "sklearn/svm/libsvm_sparse.pyx":115 + /* "sklearn/svm/libsvm_sparse.pyx":120 * problem = csr_set_problem(values.data, indices.shape, indices.data, * indptr.shape, indptr.data, Y.data, * sample_weight.data, kernel_type) # <<<<<<<<<<<<<< @@ -1675,46 +1675,46 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ __pyx_v_problem = csr_set_problem(__pyx_v_values->data, __pyx_v_indices->dimensions, __pyx_v_indices->data, __pyx_v_indptr->dimensions, __pyx_v_indptr->data, __pyx_v_Y->data, __pyx_v_sample_weight->data, __pyx_v_kernel_type); - /* "sklearn/svm/libsvm_sparse.pyx":118 + /* "sklearn/svm/libsvm_sparse.pyx":123 * * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * * # set parameters */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__arange); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__arange); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __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); __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_13 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -1722,7 +1722,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":124 + /* "sklearn/svm/libsvm_sparse.pyx":129 * nu, cache_size, C, eps, p, shrinking, * probability, class_weight.shape[0], * class_weight_label.data, class_weight.data, max_iter) # <<<<<<<<<<<<<< @@ -1731,7 +1731,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ __pyx_v_param = set_parameter(__pyx_v_svm_type, __pyx_v_kernel_type, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_nu, __pyx_v_cache_size, __pyx_v_C, __pyx_v_eps, __pyx_v_p, __pyx_v_shrinking, __pyx_v_probability, ((int)(__pyx_v_class_weight->dimensions[0])), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, __pyx_v_max_iter); - /* "sklearn/svm/libsvm_sparse.pyx":127 + /* "sklearn/svm/libsvm_sparse.pyx":132 * * # check parameters * if (param == NULL or problem == NULL): # <<<<<<<<<<<<<< @@ -1747,23 +1747,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH } if (__pyx_t_15) { - /* "sklearn/svm/libsvm_sparse.pyx":128 + /* "sklearn/svm/libsvm_sparse.pyx":133 * # check parameters * if (param == NULL or problem == NULL): * raise MemoryError("Seems we've run out of of memory") # <<<<<<<<<<<<<< * error_msg = svm_csr_check_parameter(problem, param); * if error_msg: */ - __pyx_t_6 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; - /* "sklearn/svm/libsvm_sparse.pyx":129 + /* "sklearn/svm/libsvm_sparse.pyx":134 * if (param == NULL or problem == NULL): * raise MemoryError("Seems we've run out of of memory") * error_msg = svm_csr_check_parameter(problem, param); # <<<<<<<<<<<<<< @@ -1772,7 +1772,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ __pyx_v_error_msg = svm_csr_check_parameter(__pyx_v_problem, __pyx_v_param); - /* "sklearn/svm/libsvm_sparse.pyx":130 + /* "sklearn/svm/libsvm_sparse.pyx":135 * raise MemoryError("Seems we've run out of of memory") * error_msg = svm_csr_check_parameter(problem, param); * if error_msg: # <<<<<<<<<<<<<< @@ -1782,7 +1782,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH __pyx_t_15 = (__pyx_v_error_msg != 0); if (__pyx_t_15) { - /* "sklearn/svm/libsvm_sparse.pyx":131 + /* "sklearn/svm/libsvm_sparse.pyx":136 * error_msg = svm_csr_check_parameter(problem, param); * if error_msg: * free_problem(problem) # <<<<<<<<<<<<<< @@ -1791,7 +1791,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ free_problem(__pyx_v_problem); - /* "sklearn/svm/libsvm_sparse.pyx":132 + /* "sklearn/svm/libsvm_sparse.pyx":137 * if error_msg: * free_problem(problem) * free_param(param) # <<<<<<<<<<<<<< @@ -1800,31 +1800,31 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ free_param(__pyx_v_param); - /* "sklearn/svm/libsvm_sparse.pyx":133 + /* "sklearn/svm/libsvm_sparse.pyx":138 * free_problem(problem) * free_param(param) * raise ValueError(error_msg) # <<<<<<<<<<<<<< * * # call svm_train, this does the real work */ - __pyx_t_6 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_FromString(__pyx_v_error_msg); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __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 = 138; __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)); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 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 = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "sklearn/svm/libsvm_sparse.pyx":136 + /* "sklearn/svm/libsvm_sparse.pyx":141 * * # call svm_train, this does the real work * cdef int fit_status = 0 # <<<<<<<<<<<<<< @@ -1833,7 +1833,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ __pyx_v_fit_status = 0; - /* "sklearn/svm/libsvm_sparse.pyx":137 + /* "sklearn/svm/libsvm_sparse.pyx":142 * # call svm_train, this does the real work * cdef int fit_status = 0 * model = svm_csr_train(problem, param, &fit_status) # <<<<<<<<<<<<<< @@ -1842,7 +1842,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ __pyx_v_model = svm_csr_train(__pyx_v_problem, __pyx_v_param, (&__pyx_v_fit_status)); - /* "sklearn/svm/libsvm_sparse.pyx":139 + /* "sklearn/svm/libsvm_sparse.pyx":144 * model = svm_csr_train(problem, param, &fit_status) * * cdef np.npy_intp SV_len = get_l(model) # <<<<<<<<<<<<<< @@ -1851,7 +1851,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ __pyx_v_SV_len = get_l(__pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":140 + /* "sklearn/svm/libsvm_sparse.pyx":145 * * cdef np.npy_intp SV_len = get_l(model) * cdef np.npy_intp n_class = get_nr(model) # <<<<<<<<<<<<<< @@ -1860,44 +1860,44 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ __pyx_v_n_class = get_nr(__pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":146 + /* "sklearn/svm/libsvm_sparse.pyx":151 * # it would not erase previous information * cdef np.ndarray sv_coef_data * sv_coef_data = np.empty((n_class-1)*SV_len, dtype=np.float64) # <<<<<<<<<<<<<< * copy_sv_coef (sv_coef_data.data, model) * */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong(((__pyx_v_n_class - 1) * __pyx_v_SV_len)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(((__pyx_v_n_class - 1) * __pyx_v_SV_len)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 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 = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_sv_coef_data = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":147 + /* "sklearn/svm/libsvm_sparse.pyx":152 * cdef np.ndarray sv_coef_data * sv_coef_data = np.empty((n_class-1)*SV_len, dtype=np.float64) * copy_sv_coef (sv_coef_data.data, model) # <<<<<<<<<<<<<< @@ -1906,44 +1906,44 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ copy_sv_coef(__pyx_v_sv_coef_data->data, __pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":152 + /* "sklearn/svm/libsvm_sparse.pyx":157 * # the intercept is just model.rho but with sign changed * cdef np.ndarray intercept * intercept = np.empty(n_class*(n_class-1)/2, dtype=np.float64) # <<<<<<<<<<<<<< * copy_intercept (intercept.data, model, intercept.shape) * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__Pyx_div_long((__pyx_v_n_class * (__pyx_v_n_class - 1)), 2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__Pyx_div_long((__pyx_v_n_class * (__pyx_v_n_class - 1)), 2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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 = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_intercept = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":153 + /* "sklearn/svm/libsvm_sparse.pyx":158 * cdef np.ndarray intercept * intercept = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * copy_intercept (intercept.data, model, intercept.shape) # <<<<<<<<<<<<<< @@ -1952,7 +1952,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ copy_intercept(__pyx_v_intercept->data, __pyx_v_model, __pyx_v_intercept->dimensions); - /* "sklearn/svm/libsvm_sparse.pyx":159 + /* "sklearn/svm/libsvm_sparse.pyx":164 * # TODO: custom kernel * cdef np.npy_intp nonzero_SV * nonzero_SV = get_nonzero_SV (model) # <<<<<<<<<<<<<< @@ -1961,118 +1961,118 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ __pyx_v_nonzero_SV = get_nonzero_SV(__pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":162 + /* "sklearn/svm/libsvm_sparse.pyx":167 * * cdef np.ndarray SV_data, SV_indices, SV_indptr * SV_data = np.empty(nonzero_SV, dtype=np.float64) # <<<<<<<<<<<<<< * SV_indices = np.empty(nonzero_SV, dtype=np.int32) * SV_indptr = np.empty(SV_len + 1, dtype=np.int32) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __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_PyInt_to_py_Py_intptr_t(__pyx_v_nonzero_SV); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_nonzero_SV); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __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_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __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_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_SV_data = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":163 + /* "sklearn/svm/libsvm_sparse.pyx":168 * cdef np.ndarray SV_data, SV_indices, SV_indptr * SV_data = np.empty(nonzero_SV, dtype=np.float64) * SV_indices = np.empty(nonzero_SV, dtype=np.int32) # <<<<<<<<<<<<<< * SV_indptr = np.empty(SV_len + 1, dtype=np.int32) * csr_copy_SV(SV_data.data, SV_indices.shape, SV_indices.data, */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_nonzero_SV); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_nonzero_SV); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __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); __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_SV_indices = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":164 + /* "sklearn/svm/libsvm_sparse.pyx":169 * SV_data = np.empty(nonzero_SV, dtype=np.float64) * SV_indices = np.empty(nonzero_SV, dtype=np.int32) * SV_indptr = np.empty(SV_len + 1, dtype=np.int32) # <<<<<<<<<<<<<< * csr_copy_SV(SV_data.data, SV_indices.shape, SV_indices.data, * SV_indptr.shape, SV_indptr.data, model, n_features) */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyInt_FromLong((((npy_intp)__pyx_v_SV_len) + 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong((((npy_intp)__pyx_v_SV_len) + 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 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 = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_SV_indptr = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":166 + /* "sklearn/svm/libsvm_sparse.pyx":171 * SV_indptr = np.empty(SV_len + 1, dtype=np.int32) * csr_copy_SV(SV_data.data, SV_indices.shape, SV_indices.data, * SV_indptr.shape, SV_indptr.data, model, n_features) # <<<<<<<<<<<<<< @@ -2081,27 +2081,27 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ csr_copy_SV(__pyx_v_SV_data->data, __pyx_v_SV_indices->dimensions, __pyx_v_SV_indices->data, __pyx_v_SV_indptr->dimensions, __pyx_v_SV_indptr->data, __pyx_v_model, __pyx_v_n_features); - /* "sklearn/svm/libsvm_sparse.pyx":167 + /* "sklearn/svm/libsvm_sparse.pyx":172 * csr_copy_SV(SV_data.data, SV_indices.shape, SV_indices.data, * SV_indptr.shape, SV_indptr.data, model, n_features) * support_vectors_ = sparse.csr_matrix( # <<<<<<<<<<<<<< * (SV_data, SV_indices, SV_indptr), (SV_len, n_features)) * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sparse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sparse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":168 + /* "sklearn/svm/libsvm_sparse.pyx":173 * SV_indptr.shape, SV_indptr.data, model, n_features) * support_vectors_ = sparse.csr_matrix( * (SV_data, SV_indices, SV_indptr), (SV_len, n_features)) # <<<<<<<<<<<<<< * * # copy model.nSV */ - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_SV_data)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_SV_data)); @@ -2112,11 +2112,11 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH __Pyx_INCREF(((PyObject *)__pyx_v_SV_indptr)); PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_SV_indptr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_SV_indptr)); - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_SV_len); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_SV_len); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = PyInt_FromLong(__pyx_v_n_features); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_n_features); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __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 = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); @@ -2124,7 +2124,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH __Pyx_GIVEREF(__pyx_t_5); __pyx_t_7 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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)); @@ -2132,51 +2132,51 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_4 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_v_support_vectors_ = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":173 + /* "sklearn/svm/libsvm_sparse.pyx":178 * # TODO: do only in classification * cdef np.ndarray n_class_SV * n_class_SV = np.empty(n_class, dtype=np.int32) # <<<<<<<<<<<<<< * copy_nSV(n_class_SV.data, model) * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __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_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n_class_SV = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":174 + /* "sklearn/svm/libsvm_sparse.pyx":179 * cdef np.ndarray n_class_SV * n_class_SV = np.empty(n_class, dtype=np.int32) * copy_nSV(n_class_SV.data, model) # <<<<<<<<<<<<<< @@ -2185,44 +2185,44 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ copy_nSV(__pyx_v_n_class_SV->data, __pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":178 + /* "sklearn/svm/libsvm_sparse.pyx":183 * # # copy label * cdef np.ndarray label * label = np.empty((n_class), dtype=np.int32) # <<<<<<<<<<<<<< * copy_label(label.data, model) * */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __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 = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __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_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_label = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":179 + /* "sklearn/svm/libsvm_sparse.pyx":184 * cdef np.ndarray label * label = np.empty((n_class), dtype=np.int32) * copy_label(label.data, model) # <<<<<<<<<<<<<< @@ -2231,7 +2231,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ copy_label(__pyx_v_label->data, __pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":183 + /* "sklearn/svm/libsvm_sparse.pyx":188 * # # copy probabilities * cdef np.ndarray probA, probB * if probability != 0: # <<<<<<<<<<<<<< @@ -2241,7 +2241,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH __pyx_t_15 = (__pyx_v_probability != 0); if (__pyx_t_15) { - /* "sklearn/svm/libsvm_sparse.pyx":184 + /* "sklearn/svm/libsvm_sparse.pyx":189 * cdef np.ndarray probA, probB * if probability != 0: * if svm_type < 2: # SVC and NuSVC # <<<<<<<<<<<<<< @@ -2251,81 +2251,81 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH __pyx_t_15 = (__pyx_v_svm_type < 2); if (__pyx_t_15) { - /* "sklearn/svm/libsvm_sparse.pyx":185 + /* "sklearn/svm/libsvm_sparse.pyx":190 * if probability != 0: * if svm_type < 2: # SVC and NuSVC * probA = np.empty(n_class*(n_class-1)/2, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * copy_probB(probB.data, model, probB.shape) */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__Pyx_div_long((__pyx_v_n_class * (__pyx_v_n_class - 1)), 2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__Pyx_div_long((__pyx_v_n_class * (__pyx_v_n_class - 1)), 2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __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_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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 = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_probA = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":186 + /* "sklearn/svm/libsvm_sparse.pyx":191 * if svm_type < 2: # SVC and NuSVC * probA = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * probB = np.empty(n_class*(n_class-1)/2, dtype=np.float64) # <<<<<<<<<<<<<< * copy_probB(probB.data, model, probB.shape) * else: */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong(__Pyx_div_long((__pyx_v_n_class * (__pyx_v_n_class - 1)), 2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__Pyx_div_long((__pyx_v_n_class * (__pyx_v_n_class - 1)), 2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); 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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_probB = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":187 + /* "sklearn/svm/libsvm_sparse.pyx":192 * probA = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * probB = np.empty(n_class*(n_class-1)/2, dtype=np.float64) * copy_probB(probB.data, model, probB.shape) # <<<<<<<<<<<<<< @@ -2337,67 +2337,67 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH } /*else*/ { - /* "sklearn/svm/libsvm_sparse.pyx":189 + /* "sklearn/svm/libsvm_sparse.pyx":194 * copy_probB(probB.data, model, probB.shape) * else: * probA = np.empty(1, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(0, dtype=np.float64) * copy_probA(probA.data, model, probA.shape) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_probA = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":190 + /* "sklearn/svm/libsvm_sparse.pyx":195 * else: * probA = np.empty(1, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * copy_probA(probA.data, model, probA.shape) * else: */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_probB = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; } __pyx_L7:; - /* "sklearn/svm/libsvm_sparse.pyx":191 + /* "sklearn/svm/libsvm_sparse.pyx":196 * probA = np.empty(1, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) * copy_probA(probA.data, model, probA.shape) # <<<<<<<<<<<<<< @@ -2409,67 +2409,67 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH } /*else*/ { - /* "sklearn/svm/libsvm_sparse.pyx":193 + /* "sklearn/svm/libsvm_sparse.pyx":198 * copy_probA(probA.data, model, probA.shape) * else: * probA = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(0, dtype=np.float64) * */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __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_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __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_k_tuple_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_7), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_probA = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":194 + /* "sklearn/svm/libsvm_sparse.pyx":199 * else: * probA = np.empty(0, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * * svm_csr_free_and_destroy_model (&model) */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_8), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_8), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 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 = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_probB = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; } __pyx_L6:; - /* "sklearn/svm/libsvm_sparse.pyx":196 + /* "sklearn/svm/libsvm_sparse.pyx":201 * probB = np.empty(0, dtype=np.float64) * * svm_csr_free_and_destroy_model (&model) # <<<<<<<<<<<<<< @@ -2478,7 +2478,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ svm_csr_free_and_destroy_model((&__pyx_v_model)); - /* "sklearn/svm/libsvm_sparse.pyx":197 + /* "sklearn/svm/libsvm_sparse.pyx":202 * * svm_csr_free_and_destroy_model (&model) * free_problem(problem) # <<<<<<<<<<<<<< @@ -2487,7 +2487,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ free_problem(__pyx_v_problem); - /* "sklearn/svm/libsvm_sparse.pyx":198 + /* "sklearn/svm/libsvm_sparse.pyx":203 * svm_csr_free_and_destroy_model (&model) * free_problem(problem) * free_param(param) # <<<<<<<<<<<<<< @@ -2496,7 +2496,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ free_param(__pyx_v_param); - /* "sklearn/svm/libsvm_sparse.pyx":200 + /* "sklearn/svm/libsvm_sparse.pyx":205 * free_param(param) * * return (support_vectors_, sv_coef_data, intercept, label, n_class_SV, # <<<<<<<<<<<<<< @@ -2505,16 +2505,16 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_libsvm_sparse_train(CYTH */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/svm/libsvm_sparse.pyx":201 + /* "sklearn/svm/libsvm_sparse.pyx":206 * * return (support_vectors_, sv_coef_data, intercept, label, n_class_SV, * probA, probB, fit_status) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_fit_status); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_fit_status); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_support_vectors_); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_support_vectors_); @@ -2665,121 +2665,121 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_3libsvm_sparse_predict(P case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_indptr)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__SV_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__SV_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__SV_indptr)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sv_coef)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__svm_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kernel_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 10: if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__degree)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 11: if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gamma)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 12: if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coef0)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 13: if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 14: if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 15: if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__class_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 16: if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nu)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 17: if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 18: if (likely((values[18] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shrinking)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 18); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 18); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 19: if (likely((values[19] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__probability)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 19); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 19); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 20: if (likely((values[20] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nSV)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 20); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 20); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 21: if (likely((values[21] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 21); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 21); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 22: if (likely((values[22] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__probA)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 22); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 22); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 23: if (likely((values[23] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__probB)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 23); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, 23); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "libsvm_sparse_predict") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "libsvm_sparse_predict") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 24) { goto __pyx_L5_argtuple_error; @@ -2817,18 +2817,18 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_3libsvm_sparse_predict(P __pyx_v_SV_indptr = ((PyArrayObject *)values[5]); __pyx_v_sv_coef = ((PyArrayObject *)values[6]); __pyx_v_intercept = ((PyArrayObject *)values[7]); - __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_kernel_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_kernel_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_degree = __Pyx_PyInt_AsInt(values[10]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_kernel_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_kernel_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_degree = __Pyx_PyInt_AsInt(values[10]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_class_weight = ((PyArrayObject *)values[15]); - __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_p = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[18]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_probability = __Pyx_PyInt_AsInt(values[19]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[18]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_probability = __Pyx_PyInt_AsInt(values[19]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_nSV = ((PyArrayObject *)values[20]); __pyx_v_label = ((PyArrayObject *)values[21]); __pyx_v_probA = ((PyArrayObject *)values[22]); @@ -2836,25 +2836,25 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_3libsvm_sparse_predict(P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.libsvm_sparse.libsvm_sparse_predict", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_data), __pyx_ptype_5numpy_ndarray, 1, "T_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indices), __pyx_ptype_5numpy_ndarray, 1, "T_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indptr), __pyx_ptype_5numpy_ndarray, 1, "T_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_data), __pyx_ptype_5numpy_ndarray, 1, "SV_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_indices), __pyx_ptype_5numpy_ndarray, 1, "SV_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_indptr), __pyx_ptype_5numpy_ndarray, 1, "SV_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_data), __pyx_ptype_5numpy_ndarray, 1, "T_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indices), __pyx_ptype_5numpy_ndarray, 1, "T_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indptr), __pyx_ptype_5numpy_ndarray, 1, "T_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_data), __pyx_ptype_5numpy_ndarray, 1, "SV_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_indices), __pyx_ptype_5numpy_ndarray, 1, "SV_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_indptr), __pyx_ptype_5numpy_ndarray, 1, "SV_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(__pyx_self, __pyx_v_T_data, __pyx_v_T_indices, __pyx_v_T_indptr, __pyx_v_SV_data, __pyx_v_SV_indices, __pyx_v_SV_indptr, __pyx_v_sv_coef, __pyx_v_intercept, __pyx_v_svm_type, __pyx_v_kernel_type, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_eps, __pyx_v_C, __pyx_v_class_weight, __pyx_v_nu, __pyx_v_p, __pyx_v_shrinking, __pyx_v_probability, __pyx_v_nSV, __pyx_v_label, __pyx_v_probA, __pyx_v_probB); goto __pyx_L0; __pyx_L1_error:; @@ -2864,7 +2864,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_3libsvm_sparse_predict(P return __pyx_r; } -/* "sklearn/svm/libsvm_sparse.pyx":204 +/* "sklearn/svm/libsvm_sparse.pyx":209 * * * def libsvm_sparse_predict (np.ndarray[np.float64_t, ndim=1, mode='c'] T_data, # <<<<<<<<<<<<<< @@ -2987,110 +2987,110 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(C __pyx_pybuffernd_probB.rcbuffer = &__pyx_pybuffer_probB; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_T_data.diminfo[0].strides = __pyx_pybuffernd_T_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_T_data.diminfo[0].shape = __pyx_pybuffernd_T_data.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_T_indices.diminfo[0].strides = __pyx_pybuffernd_T_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_T_indices.diminfo[0].shape = __pyx_pybuffernd_T_indices.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_T_indptr.diminfo[0].strides = __pyx_pybuffernd_T_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_T_indptr.diminfo[0].shape = __pyx_pybuffernd_T_indptr.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_SV_data.diminfo[0].strides = __pyx_pybuffernd_SV_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SV_data.diminfo[0].shape = __pyx_pybuffernd_SV_data.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_SV_indices.diminfo[0].strides = __pyx_pybuffernd_SV_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SV_indices.diminfo[0].shape = __pyx_pybuffernd_SV_indices.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_SV_indptr.diminfo[0].strides = __pyx_pybuffernd_SV_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SV_indptr.diminfo[0].shape = __pyx_pybuffernd_SV_indptr.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sv_coef.diminfo[0].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sv_coef.diminfo[0].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercept.diminfo[0].strides = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercept.diminfo[0].shape = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_nSV.diminfo[0].strides = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nSV.diminfo[0].shape = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_label.diminfo[0].strides = __pyx_pybuffernd_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_label.diminfo[0].shape = __pyx_pybuffernd_label.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probA.diminfo[0].strides = __pyx_pybuffernd_probA.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probA.diminfo[0].shape = __pyx_pybuffernd_probA.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probB.diminfo[0].strides = __pyx_pybuffernd_probB.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probB.diminfo[0].shape = __pyx_pybuffernd_probB.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/libsvm_sparse.pyx":248 + /* "sklearn/svm/libsvm_sparse.pyx":253 * cdef svm_csr_model *model * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * param = set_parameter(svm_type, kernel_type, degree, gamma, * coef0, nu, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __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_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __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 = 248; __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 = 253; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __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 = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 253; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __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_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -3098,7 +3098,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(C __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":254 + /* "sklearn/svm/libsvm_sparse.pyx":259 * C, eps, p, shrinking, * probability, class_weight.shape[0], class_weight_label.data, * class_weight.data, -1) # <<<<<<<<<<<<<< @@ -3107,7 +3107,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(C */ __pyx_v_param = set_parameter(__pyx_v_svm_type, __pyx_v_kernel_type, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_nu, 100., __pyx_v_C, __pyx_v_eps, __pyx_v_p, __pyx_v_shrinking, __pyx_v_probability, ((int)(__pyx_v_class_weight->dimensions[0])), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, -1); - /* "sklearn/svm/libsvm_sparse.pyx":260 + /* "sklearn/svm/libsvm_sparse.pyx":265 * SV_indptr.shape, SV_indptr.data, * sv_coef.data, intercept.data, * nSV.data, label.data, probA.data, probB.data) # <<<<<<<<<<<<<< @@ -3116,30 +3116,30 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(C */ __pyx_v_model = csr_set_model(__pyx_v_param, ((int)(__pyx_v_nSV->dimensions[0])), __pyx_v_SV_data->data, __pyx_v_SV_indices->dimensions, __pyx_v_SV_indices->data, __pyx_v_SV_indptr->dimensions, __pyx_v_SV_indptr->data, __pyx_v_sv_coef->data, __pyx_v_intercept->data, __pyx_v_nSV->data, __pyx_v_label->data, __pyx_v_probA->data, __pyx_v_probB->data); - /* "sklearn/svm/libsvm_sparse.pyx":262 + /* "sklearn/svm/libsvm_sparse.pyx":267 * nSV.data, label.data, probA.data, probB.data) * #TODO: use check_model * dec_values = np.empty(T_indptr.shape[0]-1) # <<<<<<<<<<<<<< * if csr_copy_predict(T_data.shape, T_data.data, * T_indices.shape, T_indices.data, */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong(((__pyx_v_T_indptr->dimensions[0]) - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(((__pyx_v_T_indptr->dimensions[0]) - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __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 = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -3155,13 +3155,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(C } } __pyx_pybuffernd_dec_values.diminfo[0].strides = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dec_values.diminfo[0].shape = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = 0; __pyx_v_dec_values = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":266 + /* "sklearn/svm/libsvm_sparse.pyx":271 * T_indices.shape, T_indices.data, * T_indptr.shape, T_indptr.data, * model, dec_values.data) < 0: # <<<<<<<<<<<<<< @@ -3171,23 +3171,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(C __pyx_t_12 = (csr_copy_predict(__pyx_v_T_data->dimensions, __pyx_v_T_data->data, __pyx_v_T_indices->dimensions, __pyx_v_T_indices->data, __pyx_v_T_indptr->dimensions, __pyx_v_T_indptr->data, __pyx_v_model, __pyx_v_dec_values->data) < 0); if (__pyx_t_12) { - /* "sklearn/svm/libsvm_sparse.pyx":267 + /* "sklearn/svm/libsvm_sparse.pyx":272 * T_indptr.shape, T_indptr.data, * model, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * # free model and param * free_model_SV(model) */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __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_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/svm/libsvm_sparse.pyx":269 + /* "sklearn/svm/libsvm_sparse.pyx":274 * raise MemoryError("We've run out of of memory") * # free model and param * free_model_SV(model) # <<<<<<<<<<<<<< @@ -3196,7 +3196,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(C */ free_model_SV(__pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":270 + /* "sklearn/svm/libsvm_sparse.pyx":275 * # free model and param * free_model_SV(model) * free_model(model) # <<<<<<<<<<<<<< @@ -3205,7 +3205,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(C */ free_model(__pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":271 + /* "sklearn/svm/libsvm_sparse.pyx":276 * free_model_SV(model) * free_model(model) * free_param(param) # <<<<<<<<<<<<<< @@ -3214,7 +3214,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_2libsvm_sparse_predict(C */ free_param(__pyx_v_param); - /* "sklearn/svm/libsvm_sparse.pyx":272 + /* "sklearn/svm/libsvm_sparse.pyx":277 * free_model(model) * free_param(param) * return dec_values # <<<<<<<<<<<<<< @@ -3353,121 +3353,121 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_5libsvm_sparse_predict_p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T_indptr)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__SV_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__SV_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__SV_indptr)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sv_coef)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__svm_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__kernel_type)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 10: if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__degree)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 11: if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gamma)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 12: if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coef0)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 13: if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 14: if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 15: if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__class_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 16: if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nu)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 17: if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 18: if (likely((values[18] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shrinking)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 18); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 18); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 19: if (likely((values[19] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__probability)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 19); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 19); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 20: if (likely((values[20] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nSV)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 20); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 20); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 21: if (likely((values[21] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 21); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 21); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 22: if (likely((values[22] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__probA)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 22); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 22); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 23: if (likely((values[23] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__probB)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 23); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, 23); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "libsvm_sparse_predict_proba") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "libsvm_sparse_predict_proba") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 24) { goto __pyx_L5_argtuple_error; @@ -3505,18 +3505,18 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_5libsvm_sparse_predict_p __pyx_v_SV_indptr = ((PyArrayObject *)values[5]); __pyx_v_sv_coef = ((PyArrayObject *)values[6]); __pyx_v_intercept = ((PyArrayObject *)values[7]); - __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_kernel_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_kernel_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_degree = __Pyx_PyInt_AsInt(values[10]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_svm_type = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_svm_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_kernel_type = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_kernel_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_degree = __Pyx_PyInt_AsInt(values[10]); if (unlikely((__pyx_v_degree == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_gamma = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_gamma == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_coef0 = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_coef0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_class_weight = ((PyArrayObject *)values[15]); - __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_p = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[18]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_probability = __Pyx_PyInt_AsInt(values[19]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_nu = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_nu == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shrinking = __Pyx_PyInt_AsInt(values[18]); if (unlikely((__pyx_v_shrinking == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_probability = __Pyx_PyInt_AsInt(values[19]); if (unlikely((__pyx_v_probability == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_nSV = ((PyArrayObject *)values[20]); __pyx_v_label = ((PyArrayObject *)values[21]); __pyx_v_probA = ((PyArrayObject *)values[22]); @@ -3524,25 +3524,25 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_5libsvm_sparse_predict_p } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("libsvm_sparse_predict_proba", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.svm.libsvm_sparse.libsvm_sparse_predict_proba", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_data), __pyx_ptype_5numpy_ndarray, 1, "T_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indices), __pyx_ptype_5numpy_ndarray, 1, "T_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indptr), __pyx_ptype_5numpy_ndarray, 1, "T_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_data), __pyx_ptype_5numpy_ndarray, 1, "SV_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_indices), __pyx_ptype_5numpy_ndarray, 1, "SV_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_indptr), __pyx_ptype_5numpy_ndarray, 1, "SV_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_data), __pyx_ptype_5numpy_ndarray, 1, "T_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indices), __pyx_ptype_5numpy_ndarray, 1, "T_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T_indptr), __pyx_ptype_5numpy_ndarray, 1, "T_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_data), __pyx_ptype_5numpy_ndarray, 1, "SV_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_indices), __pyx_ptype_5numpy_ndarray, 1, "SV_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_SV_indptr), __pyx_ptype_5numpy_ndarray, 1, "SV_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sv_coef), __pyx_ptype_5numpy_ndarray, 1, "sv_coef", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercept), __pyx_ptype_5numpy_ndarray, 1, "intercept", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_class_weight), __pyx_ptype_5numpy_ndarray, 1, "class_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nSV), __pyx_ptype_5numpy_ndarray, 1, "nSV", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_label), __pyx_ptype_5numpy_ndarray, 1, "label", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probA), __pyx_ptype_5numpy_ndarray, 1, "probA", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_probB), __pyx_ptype_5numpy_ndarray, 1, "probB", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_proba(__pyx_self, __pyx_v_T_data, __pyx_v_T_indices, __pyx_v_T_indptr, __pyx_v_SV_data, __pyx_v_SV_indices, __pyx_v_SV_indptr, __pyx_v_sv_coef, __pyx_v_intercept, __pyx_v_svm_type, __pyx_v_kernel_type, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_eps, __pyx_v_C, __pyx_v_class_weight, __pyx_v_nu, __pyx_v_p, __pyx_v_shrinking, __pyx_v_probability, __pyx_v_nSV, __pyx_v_label, __pyx_v_probA, __pyx_v_probB); goto __pyx_L0; __pyx_L1_error:; @@ -3552,7 +3552,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_5libsvm_sparse_predict_p return __pyx_r; } -/* "sklearn/svm/libsvm_sparse.pyx":277 +/* "sklearn/svm/libsvm_sparse.pyx":282 * * * def libsvm_sparse_predict_proba( # <<<<<<<<<<<<<< @@ -3676,110 +3676,110 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p __pyx_pybuffernd_probB.rcbuffer = &__pyx_pybuffer_probB; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_T_data.diminfo[0].strides = __pyx_pybuffernd_T_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_T_data.diminfo[0].shape = __pyx_pybuffernd_T_data.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_T_indices.diminfo[0].strides = __pyx_pybuffernd_T_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_T_indices.diminfo[0].shape = __pyx_pybuffernd_T_indices.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_T_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_T_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_T_indptr.diminfo[0].strides = __pyx_pybuffernd_T_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_T_indptr.diminfo[0].shape = __pyx_pybuffernd_T_indptr.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_data, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_SV_data.diminfo[0].strides = __pyx_pybuffernd_SV_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SV_data.diminfo[0].shape = __pyx_pybuffernd_SV_data.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_SV_indices.diminfo[0].strides = __pyx_pybuffernd_SV_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SV_indices.diminfo[0].shape = __pyx_pybuffernd_SV_indices.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SV_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_SV_indptr, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_SV_indptr.diminfo[0].strides = __pyx_pybuffernd_SV_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SV_indptr.diminfo[0].shape = __pyx_pybuffernd_SV_indptr.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sv_coef.rcbuffer->pybuffer, (PyObject*)__pyx_v_sv_coef, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sv_coef.diminfo[0].strides = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sv_coef.diminfo[0].shape = __pyx_pybuffernd_sv_coef.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercept.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercept, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercept.diminfo[0].strides = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercept.diminfo[0].shape = __pyx_pybuffernd_intercept.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_class_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_class_weight, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_class_weight.diminfo[0].strides = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight.diminfo[0].shape = __pyx_pybuffernd_class_weight.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nSV.rcbuffer->pybuffer, (PyObject*)__pyx_v_nSV, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_nSV.diminfo[0].strides = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nSV.diminfo[0].shape = __pyx_pybuffernd_nSV.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_label.rcbuffer->pybuffer, (PyObject*)__pyx_v_label, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_label.diminfo[0].strides = __pyx_pybuffernd_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_label.diminfo[0].shape = __pyx_pybuffernd_label.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probA.rcbuffer->pybuffer, (PyObject*)__pyx_v_probA, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probA.diminfo[0].strides = __pyx_pybuffernd_probA.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probA.diminfo[0].shape = __pyx_pybuffernd_probA.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probB.rcbuffer->pybuffer, (PyObject*)__pyx_v_probB, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_probB.diminfo[0].strides = __pyx_pybuffernd_probB.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probB.diminfo[0].shape = __pyx_pybuffernd_probB.rcbuffer->pybuffer.shape[0]; - /* "sklearn/svm/libsvm_sparse.pyx":302 + /* "sklearn/svm/libsvm_sparse.pyx":307 * cdef svm_csr_model *model * cdef np.ndarray[np.int32_t, ndim=1, mode='c'] \ * class_weight_label = np.arange(class_weight.shape[0], dtype=np.int32) # <<<<<<<<<<<<<< * param = set_parameter(svm_type, kernel_type, degree, gamma, * coef0, nu, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __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_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_class_weight->dimensions[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __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 = 302; __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 = 307; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __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 = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 307; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __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_class_weight_label.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_class_weight_label = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_class_weight_label.diminfo[0].strides = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_class_weight_label.diminfo[0].shape = __pyx_pybuffernd_class_weight_label.rcbuffer->pybuffer.shape[0]; } } @@ -3787,7 +3787,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p __pyx_v_class_weight_label = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":308 + /* "sklearn/svm/libsvm_sparse.pyx":313 * C, eps, p, shrinking, * probability, class_weight.shape[0], class_weight_label.data, * class_weight.data, -1) # <<<<<<<<<<<<<< @@ -3796,7 +3796,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p */ __pyx_v_param = set_parameter(__pyx_v_svm_type, __pyx_v_kernel_type, __pyx_v_degree, __pyx_v_gamma, __pyx_v_coef0, __pyx_v_nu, 100., __pyx_v_C, __pyx_v_eps, __pyx_v_p, __pyx_v_shrinking, __pyx_v_probability, ((int)(__pyx_v_class_weight->dimensions[0])), __pyx_v_class_weight_label->data, __pyx_v_class_weight->data, -1); - /* "sklearn/svm/libsvm_sparse.pyx":314 + /* "sklearn/svm/libsvm_sparse.pyx":319 * SV_indptr.shape, SV_indptr.data, * sv_coef.data, intercept.data, * nSV.data, label.data, probA.data, probB.data) # <<<<<<<<<<<<<< @@ -3805,7 +3805,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p */ __pyx_v_model = csr_set_model(__pyx_v_param, ((int)(__pyx_v_nSV->dimensions[0])), __pyx_v_SV_data->data, __pyx_v_SV_indices->dimensions, __pyx_v_SV_indices->data, __pyx_v_SV_indptr->dimensions, __pyx_v_SV_indptr->data, __pyx_v_sv_coef->data, __pyx_v_intercept->data, __pyx_v_nSV->data, __pyx_v_label->data, __pyx_v_probA->data, __pyx_v_probB->data); - /* "sklearn/svm/libsvm_sparse.pyx":316 + /* "sklearn/svm/libsvm_sparse.pyx":321 * nSV.data, label.data, probA.data, probB.data) * #TODO: use check_model * cdef np.npy_intp n_class = get_nr(model) # <<<<<<<<<<<<<< @@ -3814,23 +3814,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p */ __pyx_v_n_class = get_nr(__pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":317 + /* "sklearn/svm/libsvm_sparse.pyx":322 * #TODO: use check_model * cdef np.npy_intp n_class = get_nr(model) * dec_values = np.empty((T_indptr.shape[0]-1, n_class), dtype=np.float64) # <<<<<<<<<<<<<< * if csr_copy_predict_proba(T_data.shape, T_data.data, * T_indices.shape, T_indices.data, */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyInt_FromLong(((__pyx_v_T_indptr->dimensions[0]) - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(((__pyx_v_T_indptr->dimensions[0]) - 1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_n_class); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); @@ -3838,26 +3838,26 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p __Pyx_GIVEREF(__pyx_t_3); __pyx_t_5 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __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 = 322; __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)); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -3873,13 +3873,13 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p } } __pyx_pybuffernd_dec_values.diminfo[0].strides = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dec_values.diminfo[0].shape = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dec_values.diminfo[1].strides = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dec_values.diminfo[1].shape = __pyx_pybuffernd_dec_values.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = 0; __pyx_v_dec_values = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":321 + /* "sklearn/svm/libsvm_sparse.pyx":326 * T_indices.shape, T_indices.data, * T_indptr.shape, T_indptr.data, * model, dec_values.data) < 0: # <<<<<<<<<<<<<< @@ -3889,23 +3889,23 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p __pyx_t_12 = (csr_copy_predict_proba(__pyx_v_T_data->dimensions, __pyx_v_T_data->data, __pyx_v_T_indices->dimensions, __pyx_v_T_indices->data, __pyx_v_T_indptr->dimensions, __pyx_v_T_indptr->data, __pyx_v_model, __pyx_v_dec_values->data) < 0); if (__pyx_t_12) { - /* "sklearn/svm/libsvm_sparse.pyx":322 + /* "sklearn/svm/libsvm_sparse.pyx":327 * T_indptr.shape, T_indptr.data, * model, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * # free model and param * free_model_SV(model) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __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[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/svm/libsvm_sparse.pyx":324 + /* "sklearn/svm/libsvm_sparse.pyx":329 * raise MemoryError("We've run out of of memory") * # free model and param * free_model_SV(model) # <<<<<<<<<<<<<< @@ -3914,7 +3914,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p */ free_model_SV(__pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":325 + /* "sklearn/svm/libsvm_sparse.pyx":330 * # free model and param * free_model_SV(model) * free_model(model) # <<<<<<<<<<<<<< @@ -3923,7 +3923,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p */ free_model(__pyx_v_model); - /* "sklearn/svm/libsvm_sparse.pyx":326 + /* "sklearn/svm/libsvm_sparse.pyx":331 * free_model_SV(model) * free_model(model) * free_param(param) # <<<<<<<<<<<<<< @@ -3932,7 +3932,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_4libsvm_sparse_predict_p */ free_param(__pyx_v_param); - /* "sklearn/svm/libsvm_sparse.pyx":327 + /* "sklearn/svm/libsvm_sparse.pyx":332 * free_model(model) * free_param(param) * return dec_values # <<<<<<<<<<<<<< @@ -4007,7 +4007,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_7set_verbosity_wrap(PyOb __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_verbosity_wrap (wrapper)", 0); assert(__pyx_arg_verbosity); { - __pyx_v_verbosity = __Pyx_PyInt_AsInt(__pyx_arg_verbosity); if (unlikely((__pyx_v_verbosity == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_verbosity = __Pyx_PyInt_AsInt(__pyx_arg_verbosity); if (unlikely((__pyx_v_verbosity == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4020,7 +4020,7 @@ static PyObject *__pyx_pw_7sklearn_3svm_13libsvm_sparse_7set_verbosity_wrap(PyOb return __pyx_r; } -/* "sklearn/svm/libsvm_sparse.pyx":331 +/* "sklearn/svm/libsvm_sparse.pyx":336 * * * def set_verbosity_wrap(int verbosity): # <<<<<<<<<<<<<< @@ -4033,7 +4033,7 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_6set_verbosity_wrap(CYTH __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_verbosity_wrap", 0); - /* "sklearn/svm/libsvm_sparse.pyx":335 + /* "sklearn/svm/libsvm_sparse.pyx":340 * Control verbosity of libsvm library * """ * set_verbosity(verbosity) # <<<<<<<<<<<<<< @@ -4047,8 +4047,8 @@ static PyObject *__pyx_pf_7sklearn_3svm_13libsvm_sparse_6set_verbosity_wrap(CYTH } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -4866,8 +4866,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -6123,8 +6123,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -6136,98 +6136,98 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/svm/libsvm_sparse.pyx":128 + /* "sklearn/svm/libsvm_sparse.pyx":133 * # check parameters * if (param == NULL or problem == NULL): * raise MemoryError("Seems we've run out of of memory") # <<<<<<<<<<<<<< * error_msg = svm_csr_check_parameter(problem, param); * if error_msg: */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "sklearn/svm/libsvm_sparse.pyx":189 + /* "sklearn/svm/libsvm_sparse.pyx":194 * copy_probB(probB.data, model, probB.shape) * else: * probA = np.empty(1, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(0, dtype=np.float64) * copy_probA(probA.data, model, probA.shape) */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "sklearn/svm/libsvm_sparse.pyx":190 + /* "sklearn/svm/libsvm_sparse.pyx":195 * else: * probA = np.empty(1, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * copy_probA(probA.data, model, probA.shape) * else: */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "sklearn/svm/libsvm_sparse.pyx":193 + /* "sklearn/svm/libsvm_sparse.pyx":198 * copy_probA(probA.data, model, probA.shape) * else: * probA = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * probB = np.empty(0, dtype=np.float64) * */ - __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - /* "sklearn/svm/libsvm_sparse.pyx":194 + /* "sklearn/svm/libsvm_sparse.pyx":199 * else: * probA = np.empty(0, dtype=np.float64) * probB = np.empty(0, dtype=np.float64) # <<<<<<<<<<<<<< * * svm_csr_free_and_destroy_model (&model) */ - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - /* "sklearn/svm/libsvm_sparse.pyx":267 + /* "sklearn/svm/libsvm_sparse.pyx":272 * T_indptr.shape, T_indptr.data, * model, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * # free model and param * free_model_SV(model) */ - __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "sklearn/svm/libsvm_sparse.pyx":322 + /* "sklearn/svm/libsvm_sparse.pyx":327 * T_indptr.shape, T_indptr.data, * model, dec_values.data) < 0: * raise MemoryError("We've run out of of memory") # <<<<<<<<<<<<<< * # free model and param * free_model_SV(model) */ - __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_s_9)); @@ -6318,14 +6318,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_22)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); - /* "sklearn/svm/libsvm_sparse.pyx":61 + /* "sklearn/svm/libsvm_sparse.pyx":66 * * * def libsvm_sparse_train ( int n_features, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] values, * np.ndarray[np.int32_t, ndim=1, mode='c'] indices, */ - __pyx_k_tuple_24 = PyTuple_New(39); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_24 = PyTuple_New(39); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_n_s__n_features)); @@ -6445,16 +6445,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_24, 38, ((PyObject *)__pyx_n_s__probB)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__probB)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - __pyx_k_codeobj_25 = (PyObject*)__Pyx_PyCode_New(20, 0, 39, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s__libsvm_sparse_train, 61, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_25 = (PyObject*)__Pyx_PyCode_New(20, 0, 39, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s__libsvm_sparse_train, 66, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm_sparse.pyx":204 + /* "sklearn/svm/libsvm_sparse.pyx":209 * * * def libsvm_sparse_predict (np.ndarray[np.float64_t, ndim=1, mode='c'] T_data, # <<<<<<<<<<<<<< * np.ndarray[np.int32_t, ndim=1, mode='c'] T_indices, * np.ndarray[np.int32_t, ndim=1, mode='c'] T_indptr, */ - __pyx_k_tuple_28 = PyTuple_New(28); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_28 = PyTuple_New(28); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_28); __Pyx_INCREF(((PyObject *)__pyx_n_s__T_data)); PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_n_s__T_data)); @@ -6541,16 +6541,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_28, 27, ((PyObject *)__pyx_n_s__class_weight_label)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__class_weight_label)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); - __pyx_k_codeobj_29 = (PyObject*)__Pyx_PyCode_New(24, 0, 28, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s_30, 204, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_29 = (PyObject*)__Pyx_PyCode_New(24, 0, 28, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s_30, 209, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm_sparse.pyx":277 + /* "sklearn/svm/libsvm_sparse.pyx":282 * * * def libsvm_sparse_predict_proba( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] T_data, * np.ndarray[np.int32_t, ndim=1, mode='c'] T_indices, */ - __pyx_k_tuple_31 = PyTuple_New(29); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_31 = PyTuple_New(29); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_31); __Pyx_INCREF(((PyObject *)__pyx_n_s__T_data)); PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_n_s__T_data)); @@ -6640,16 +6640,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_31, 28, ((PyObject *)__pyx_n_s__n_class)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_class)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); - __pyx_k_codeobj_32 = (PyObject*)__Pyx_PyCode_New(24, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s_33, 277, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_32 = (PyObject*)__Pyx_PyCode_New(24, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s_33, 282, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/svm/libsvm_sparse.pyx":331 + /* "sklearn/svm/libsvm_sparse.pyx":336 * * * def set_verbosity_wrap(int verbosity): # <<<<<<<<<<<<<< * """ * Control verbosity of libsvm library */ - __pyx_k_tuple_34 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_34 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_34); __Pyx_INCREF(((PyObject *)__pyx_n_s__verbosity)); PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_n_s__verbosity)); @@ -6658,7 +6658,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, ((PyObject *)__pyx_n_s__verbosity)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__verbosity)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); - __pyx_k_codeobj_35 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s__set_verbosity_wrap, 331, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_35 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_26, __pyx_n_s__set_verbosity_wrap, 336, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -6667,10 +6667,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 = 2; __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 = 2; __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 = 2; __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + 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_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; @@ -6697,17 +6697,17 @@ PyMODINIT_FUNC PyInit_libsvm_sparse(void) } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_libsvm_sparse(void)", 0); - if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED - if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -6722,29 +6722,29 @@ PyMODINIT_FUNC PyInit_libsvm_sparse(void) #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_m)) {__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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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.svm.libsvm_sparse")) { - if (unlikely(PyDict_SetItemString(modules, "sklearn.svm.libsvm_sparse", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyDict_SetItemString(modules, "sklearn.svm.libsvm_sparse", __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); #endif - if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_sklearn__svm__libsvm_sparse) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __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;}; } /*--- Builtin init code ---*/ - if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ - if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ @@ -6766,136 +6766,142 @@ PyMODINIT_FUNC PyInit_libsvm_sparse(void) /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "sklearn/svm/libsvm_sparse.pyx":2 - * + /* "sklearn/svm/libsvm_sparse.pyx":1 * import warnings # <<<<<<<<<<<<<< * import numpy as np * cimport numpy as np */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":3 - * + /* "sklearn/svm/libsvm_sparse.pyx":2 * import warnings * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * from scipy import sparse */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":5 + /* "sklearn/svm/libsvm_sparse.pyx":4 * import numpy as np * cimport numpy as np * from scipy import sparse # <<<<<<<<<<<<<< * from ..utils import ConvergenceWarning * */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__sparse)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__sparse)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sparse)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__scipy), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__scipy), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __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 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__sparse); if (__pyx_t_1 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__sparse); - if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sparse, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sparse, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __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; - /* "sklearn/svm/libsvm_sparse.pyx":6 + /* "sklearn/svm/libsvm_sparse.pyx":5 * cimport numpy as np * from scipy import sparse * from ..utils import ConvergenceWarning # <<<<<<<<<<<<<< * - * ################################################################################ + * cdef extern from *: */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__ConvergenceWarning)); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__ConvergenceWarning)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ConvergenceWarning)); - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__utils), ((PyObject *)__pyx_t_2), 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__utils), ((PyObject *)__pyx_t_2), 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __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 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ConvergenceWarning); if (__pyx_t_2 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__ConvergenceWarning); - if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ConvergenceWarning, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ConvergenceWarning, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __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; - /* "sklearn/svm/libsvm_sparse.pyx":61 + /* "sklearn/svm/libsvm_sparse.pyx":63 + * + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/svm/libsvm_sparse.pyx":66 * * * def libsvm_sparse_train ( int n_features, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] values, * np.ndarray[np.int32_t, ndim=1, mode='c'] indices, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_13libsvm_sparse_1libsvm_sparse_train, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_13libsvm_sparse_1libsvm_sparse_train, NULL, __pyx_n_s_27); 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); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__libsvm_sparse_train, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__libsvm_sparse_train, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":204 + /* "sklearn/svm/libsvm_sparse.pyx":209 * * * def libsvm_sparse_predict (np.ndarray[np.float64_t, ndim=1, mode='c'] T_data, # <<<<<<<<<<<<<< * np.ndarray[np.int32_t, ndim=1, mode='c'] T_indices, * np.ndarray[np.int32_t, ndim=1, mode='c'] T_indptr, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_13libsvm_sparse_3libsvm_sparse_predict, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_13libsvm_sparse_3libsvm_sparse_predict, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_30, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_30, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":277 + /* "sklearn/svm/libsvm_sparse.pyx":282 * * * def libsvm_sparse_predict_proba( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1, mode='c'] T_data, * np.ndarray[np.int32_t, ndim=1, mode='c'] T_indices, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_13libsvm_sparse_5libsvm_sparse_predict_proba, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_13libsvm_sparse_5libsvm_sparse_predict_proba, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_33, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_33, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":331 + /* "sklearn/svm/libsvm_sparse.pyx":336 * * * def set_verbosity_wrap(int verbosity): # <<<<<<<<<<<<<< * """ * Control verbosity of libsvm library */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_13libsvm_sparse_7set_verbosity_wrap, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_3svm_13libsvm_sparse_7set_verbosity_wrap, NULL, __pyx_n_s_27); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_verbosity_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_verbosity_wrap, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/svm/libsvm_sparse.pyx":2 - * + /* "sklearn/svm/libsvm_sparse.pyx":1 * import warnings # <<<<<<<<<<<<<< * import numpy as np * cimport numpy as np */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "numpy.pxd":975 diff --git a/sklearn/svm/libsvm_sparse.pyx b/sklearn/svm/libsvm_sparse.pyx index 06ce1bd702266..d589f515e7e4a 100644 --- a/sklearn/svm/libsvm_sparse.pyx +++ b/sklearn/svm/libsvm_sparse.pyx @@ -1,10 +1,12 @@ - import warnings import numpy as np cimport numpy as np from scipy import sparse from ..utils import ConvergenceWarning +cdef extern from *: + ctypedef char* const_char_p "const char*" + ################################################################################ # Includes @@ -58,6 +60,9 @@ cdef extern from "libsvm_sparse_helper.c": void set_verbosity(int) +np.import_array() + + def libsvm_sparse_train ( int n_features, np.ndarray[np.float64_t, ndim=1, mode='c'] values, np.ndarray[np.int32_t, ndim=1, mode='c'] indices, @@ -95,7 +100,7 @@ def libsvm_sparse_train ( int n_features, cdef svm_parameter *param cdef svm_csr_problem *problem cdef svm_csr_model *model - cdef char *error_msg + cdef const_char_p error_msg if len(sample_weight) == 0: sample_weight = np.ones(Y.shape[0], dtype=np.float64) diff --git a/sklearn/svm/src/libsvm/libsvm_sparse_helper.c b/sklearn/svm/src/libsvm/libsvm_sparse_helper.c index 885a0eb26933c..8dbfc99abc873 100644 --- a/sklearn/svm/src/libsvm/libsvm_sparse_helper.c +++ b/sklearn/svm/src/libsvm/libsvm_sparse_helper.c @@ -407,11 +407,6 @@ int free_model_SV(struct svm_csr_model *model) } -/* rely on built-in facility to control verbose output - * in the versions of libsvm >= 2.89 - */ -#if LIBSVM_VERSION && LIBSVM_VERSION >= 289 - /* borrowed from original libsvm code */ static void print_null(const char *s) {} @@ -424,14 +419,7 @@ static void print_string_stdout(const char *s) /* provide convenience wrapper */ void set_verbosity(int verbosity_flag){ if (verbosity_flag) -# if LIBSVM_VERSION < 291 - svm_print_string = &print_string_stdout; - else - svm_print_string = &print_null; -# else svm_set_print_string_function(&print_string_stdout); else svm_set_print_string_function(&print_null); -# endif } -#endif diff --git a/sklearn/tree/_tree.c b/sklearn/tree/_tree.c index 738cc0de6e294..3fc868438b141 100644 --- a/sklearn/tree/_tree.c +++ b/sklearn/tree/_tree.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.1 on Sat Jan 5 21:47:36 2013 */ +/* Generated by Cython 0.17.4 on Thu Jan 10 11:14:06 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -53,12 +53,15 @@ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) - #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) @@ -253,9 +256,9 @@ #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "pythread.h" -#include "string.h" -#include "math.h" #include "float.h" +#include "math.h" +#include "string.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -785,7 +788,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Criterion { }; -/* "sklearn/tree/_tree.pyx":1103 +/* "sklearn/tree/_tree.pyx":1093 * * * cdef class ClassificationCriterion(Criterion): # <<<<<<<<<<<<<< @@ -802,7 +805,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_ClassificationCriterion { }; -/* "sklearn/tree/_tree.pyx":1358 +/* "sklearn/tree/_tree.pyx":1348 * * * cdef class Gini(ClassificationCriterion): # <<<<<<<<<<<<<< @@ -814,7 +817,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Gini { }; -/* "sklearn/tree/_tree.pyx":1421 +/* "sklearn/tree/_tree.pyx":1411 * * * cdef class Entropy(ClassificationCriterion): # <<<<<<<<<<<<<< @@ -826,7 +829,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_Entropy { }; -/* "sklearn/tree/_tree.pyx":1472 +/* "sklearn/tree/_tree.pyx":1462 * * * cdef class RegressionCriterion(Criterion): # <<<<<<<<<<<<<< @@ -846,7 +849,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_RegressionCriterion { }; -/* "sklearn/tree/_tree.pyx":1772 +/* "sklearn/tree/_tree.pyx":1762 * * * cdef class MSE(RegressionCriterion): # <<<<<<<<<<<<<< @@ -859,7 +862,7 @@ struct __pyx_obj_7sklearn_4tree_5_tree_MSE { -/* "sklearn/tree/_tree.pyx":74 +/* "sklearn/tree/_tree.pyx":62 * # ============================================================================= * * cdef class Tree: # <<<<<<<<<<<<<< @@ -887,7 +890,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_4Tree__compute_feature static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_4Tree__compute_feature_importances_squared(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, int); -/* "sklearn/tree/_tree.pyx":1068 +/* "sklearn/tree/_tree.pyx":1058 * # ============================================================================= * * cdef class Criterion: # <<<<<<<<<<<<<< @@ -905,7 +908,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *__pyx_vtabptr_7sklearn_4tree_5_tree_Criterion; -/* "sklearn/tree/_tree.pyx":1472 +/* "sklearn/tree/_tree.pyx":1462 * * * cdef class RegressionCriterion(Criterion): # <<<<<<<<<<<<<< @@ -919,7 +922,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_RegressionCriterion { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_RegressionCriterion *__pyx_vtabptr_7sklearn_4tree_5_tree_RegressionCriterion; -/* "sklearn/tree/_tree.pyx":1772 +/* "sklearn/tree/_tree.pyx":1762 * * * cdef class MSE(RegressionCriterion): # <<<<<<<<<<<<<< @@ -933,7 +936,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_MSE { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_MSE *__pyx_vtabptr_7sklearn_4tree_5_tree_MSE; -/* "sklearn/tree/_tree.pyx":1103 +/* "sklearn/tree/_tree.pyx":1093 * * * cdef class ClassificationCriterion(Criterion): # <<<<<<<<<<<<<< @@ -947,7 +950,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_ClassificationCriterion { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_ClassificationCriterion *__pyx_vtabptr_7sklearn_4tree_5_tree_ClassificationCriterion; -/* "sklearn/tree/_tree.pyx":1358 +/* "sklearn/tree/_tree.pyx":1348 * * * cdef class Gini(ClassificationCriterion): # <<<<<<<<<<<<<< @@ -961,7 +964,7 @@ struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Gini { static struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Gini *__pyx_vtabptr_7sklearn_4tree_5_tree_Gini; -/* "sklearn/tree/_tree.pyx":1421 +/* "sklearn/tree/_tree.pyx":1411 * * * cdef class Entropy(ClassificationCriterion): # <<<<<<<<<<<<<< @@ -1451,6 +1454,12 @@ static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; /* Module declarations from 'cython' */ +/* Module declarations from 'libc.float' */ + +/* Module declarations from 'libc.math' */ + +/* Module declarations from 'libc.string' */ + /* Module declarations from 'sklearn.tree._tree' */ static PyTypeObject *__pyx_ptype_7sklearn_4tree_5_tree_Criterion = 0; static PyTypeObject *__pyx_ptype_7sklearn_4tree_5_tree_Tree = 0; @@ -1552,7 +1561,7 @@ 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_23[] = "/home/endw/workspace/sklearn/sklearn/tree/_tree.pyx"; +static char __pyx_k_23[] = "/scratch/apps/src/scikit-learn/sklearn/tree/_tree.pyx"; static char __pyx_k_24[] = "sklearn.tree._tree"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; @@ -1777,7 +1786,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9n_classes_1__get__(PyObje return __pyx_r; } -/* "sklearn/tree/_tree.pyx":172 +/* "sklearn/tree/_tree.pyx":160 * # Wrap for outside world * property n_classes: * def __get__(self): # <<<<<<<<<<<<<< @@ -1794,7 +1803,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":173 + /* "sklearn/tree/_tree.pyx":161 * property n_classes: * def __get__(self): * return intp_to_ndarray(self.n_classes, self.n_outputs) # <<<<<<<<<<<<<< @@ -1802,7 +1811,7 @@ 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_intp_to_ndarray(__pyx_v_self->n_classes, __pyx_v_self->n_outputs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->n_classes, __pyx_v_self->n_outputs)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1831,7 +1840,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13children_left_1__get__(P return __pyx_r; } -/* "sklearn/tree/_tree.pyx":176 +/* "sklearn/tree/_tree.pyx":164 * * property children_left: * def __get__(self): # <<<<<<<<<<<<<< @@ -1848,7 +1857,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":177 + /* "sklearn/tree/_tree.pyx":165 * property children_left: * def __get__(self): * return intp_to_ndarray(self.children_left, self.node_count) # <<<<<<<<<<<<<< @@ -1856,7 +1865,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_13children_left___get__(st * property children_right: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->children_left, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->children_left, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1885,7 +1894,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_14children_right_1__get__( return __pyx_r; } -/* "sklearn/tree/_tree.pyx":180 +/* "sklearn/tree/_tree.pyx":168 * * property children_right: * def __get__(self): # <<<<<<<<<<<<<< @@ -1902,7 +1911,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":181 + /* "sklearn/tree/_tree.pyx":169 * property children_right: * def __get__(self): * return intp_to_ndarray(self.children_right, self.node_count) # <<<<<<<<<<<<<< @@ -1910,7 +1919,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14children_right___get__(s * property feature: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->children_right, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->children_right, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1939,7 +1948,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_7feature_1__get__(PyObject return __pyx_r; } -/* "sklearn/tree/_tree.pyx":184 +/* "sklearn/tree/_tree.pyx":172 * * property feature: * def __get__(self): # <<<<<<<<<<<<<< @@ -1956,7 +1965,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":185 + /* "sklearn/tree/_tree.pyx":173 * property feature: * def __get__(self): * return intp_to_ndarray(self.feature, self.node_count) # <<<<<<<<<<<<<< @@ -1964,7 +1973,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_7feature___get__(struct __ * property threshold: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->feature, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->feature, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1993,7 +2002,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9threshold_1__get__(PyObje return __pyx_r; } -/* "sklearn/tree/_tree.pyx":188 +/* "sklearn/tree/_tree.pyx":176 * * property threshold: * def __get__(self): # <<<<<<<<<<<<<< @@ -2010,7 +2019,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":189 + /* "sklearn/tree/_tree.pyx":177 * property threshold: * def __get__(self): * return doublep_to_ndarray(self.threshold, self.node_count) # <<<<<<<<<<<<<< @@ -2018,7 +2027,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9threshold___get__(struct * property value: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->threshold, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->threshold, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2047,7 +2056,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_5value_1__get__(PyObject * return __pyx_r; } -/* "sklearn/tree/_tree.pyx":192 +/* "sklearn/tree/_tree.pyx":180 * * property value: * def __get__(self): # <<<<<<<<<<<<<< @@ -2065,7 +2074,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":195 + /* "sklearn/tree/_tree.pyx":183 * cdef np.npy_intp shape[3] * * shape[0] = self.node_count # <<<<<<<<<<<<<< @@ -2074,7 +2083,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_5value___get__(struct __py */ (__pyx_v_shape[0]) = ((npy_intp)__pyx_v_self->node_count); - /* "sklearn/tree/_tree.pyx":196 + /* "sklearn/tree/_tree.pyx":184 * * shape[0] = self.node_count * shape[1] = self.n_outputs # <<<<<<<<<<<<<< @@ -2083,7 +2092,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_5value___get__(struct __py */ (__pyx_v_shape[1]) = ((npy_intp)__pyx_v_self->n_outputs); - /* "sklearn/tree/_tree.pyx":197 + /* "sklearn/tree/_tree.pyx":185 * shape[0] = self.node_count * shape[1] = self.n_outputs * shape[2] = self.max_n_classes # <<<<<<<<<<<<<< @@ -2092,7 +2101,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_5value___get__(struct __py */ (__pyx_v_shape[2]) = ((npy_intp)__pyx_v_self->max_n_classes); - /* "sklearn/tree/_tree.pyx":199 + /* "sklearn/tree/_tree.pyx":187 * shape[2] = self.max_n_classes * * return np.PyArray_SimpleNewFromData( # <<<<<<<<<<<<<< @@ -2101,14 +2110,14 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_5value___get__(struct __py */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/tree/_tree.pyx":200 + /* "sklearn/tree/_tree.pyx":188 * * return np.PyArray_SimpleNewFromData( * 3, shape, np.NPY_DOUBLE, self.value) # <<<<<<<<<<<<<< * * property best_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 = 199; __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 = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2137,7 +2146,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_10best_error_1__get__(PyOb return __pyx_r; } -/* "sklearn/tree/_tree.pyx":203 +/* "sklearn/tree/_tree.pyx":191 * * property best_error: * def __get__(self): # <<<<<<<<<<<<<< @@ -2154,7 +2163,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10best_error___get__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":204 + /* "sklearn/tree/_tree.pyx":192 * property best_error: * def __get__(self): * return doublep_to_ndarray(self.best_error, self.node_count) # <<<<<<<<<<<<<< @@ -2162,7 +2171,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10best_error___get__(struc * property init_error: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->best_error, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->best_error, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2191,7 +2200,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_10init_error_1__get__(PyOb return __pyx_r; } -/* "sklearn/tree/_tree.pyx":207 +/* "sklearn/tree/_tree.pyx":195 * * property init_error: * def __get__(self): # <<<<<<<<<<<<<< @@ -2208,7 +2217,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10init_error___get__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":208 + /* "sklearn/tree/_tree.pyx":196 * property init_error: * def __get__(self): * return doublep_to_ndarray(self.init_error, self.node_count) # <<<<<<<<<<<<<< @@ -2216,7 +2225,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10init_error___get__(struc * property n_samples: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->init_error, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->init_error, __pyx_v_self->node_count)); 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); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2245,7 +2254,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9n_samples_1__get__(PyObje return __pyx_r; } -/* "sklearn/tree/_tree.pyx":211 +/* "sklearn/tree/_tree.pyx":199 * * property n_samples: * def __get__(self): # <<<<<<<<<<<<<< @@ -2262,7 +2271,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_samples___get__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); - /* "sklearn/tree/_tree.pyx":212 + /* "sklearn/tree/_tree.pyx":200 * property n_samples: * def __get__(self): * return intp_to_ndarray(self.n_samples, self.node_count) # <<<<<<<<<<<<<< @@ -2270,7 +2279,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_9n_samples___get__(struct * def __cinit__(self, int n_features, object n_classes, int n_outputs, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->n_samples, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->n_samples, __pyx_v_self->node_count)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2334,56 +2343,56 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_1__cinit__(PyObject *__pyx_v_sel case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_classes)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __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--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__criterion)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __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--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __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--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __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--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_density)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 10: if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__random_state)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __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 = 214; __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 = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 11) { goto __pyx_L5_argtuple_error; @@ -2400,27 +2409,27 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_1__cinit__(PyObject *__pyx_v_sel values[9] = PyTuple_GET_ITEM(__pyx_args, 9); values[10] = PyTuple_GET_ITEM(__pyx_args, 10); } - __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 = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __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 = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_n_classes = 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 = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __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 = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)values[3]); - __pyx_v_max_depth = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_max_depth == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_min_samples_split = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_min_samples_split == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_min_samples_leaf = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_min_samples_leaf == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_min_density = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_min_density == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_max_features = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_max_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_find_split_algorithm = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_find_split_algorithm == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_depth = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_max_depth == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_min_samples_split = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_min_samples_split == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_min_samples_leaf = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_min_samples_leaf == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_min_density = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_min_density == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_features = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_max_features == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_find_split_algorithm = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_find_split_algorithm == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_random_state = values[10]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 11, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __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_criterion), __pyx_ptype_7sklearn_4tree_5_tree_Criterion, 1, "criterion", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __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 = 203; __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_criterion, __pyx_v_max_depth, __pyx_v_min_samples_split, __pyx_v_min_samples_leaf, __pyx_v_min_density, __pyx_v_max_features, __pyx_v_find_split_algorithm, __pyx_v_random_state); goto __pyx_L0; __pyx_L1_error:; @@ -2430,7 +2439,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_4Tree_1__cinit__(PyObject *__pyx_v_sel return __pyx_r; } -/* "sklearn/tree/_tree.pyx":214 +/* "sklearn/tree/_tree.pyx":202 * return intp_to_ndarray(self.n_samples, self.node_count) * * def __cinit__(self, int n_features, object n_classes, int n_outputs, # <<<<<<<<<<<<<< @@ -2455,7 +2464,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "sklearn/tree/_tree.pyx":222 + /* "sklearn/tree/_tree.pyx":210 * cdef int k * * self.n_features = n_features # <<<<<<<<<<<<<< @@ -2464,7 +2473,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":223 + /* "sklearn/tree/_tree.pyx":211 * * self.n_features = n_features * self.n_outputs = n_outputs # <<<<<<<<<<<<<< @@ -2473,7 +2482,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":224 + /* "sklearn/tree/_tree.pyx":212 * self.n_features = n_features * self.n_outputs = n_outputs * self.n_classes = malloc(n_outputs * sizeof(int)) # <<<<<<<<<<<<<< @@ -2482,7 +2491,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->n_classes = ((int *)malloc((__pyx_v_n_outputs * (sizeof(int))))); - /* "sklearn/tree/_tree.pyx":226 + /* "sklearn/tree/_tree.pyx":214 * self.n_classes = malloc(n_outputs * sizeof(int)) * * if self.n_classes == NULL: # <<<<<<<<<<<<<< @@ -2492,44 +2501,44 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle __pyx_t_1 = (__pyx_v_self->n_classes == NULL); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":227 + /* "sklearn/tree/_tree.pyx":215 * * if self.n_classes == NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * self.max_n_classes = np.max(n_classes) */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":229 + /* "sklearn/tree/_tree.pyx":217 * raise MemoryError() * * self.max_n_classes = np.max(n_classes) # <<<<<<<<<<<<<< * self.value_stride = self.n_outputs * self.max_n_classes * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__max); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __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 = 229; __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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n_classes); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n_classes); __Pyx_GIVEREF(__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 = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __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_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __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":230 + /* "sklearn/tree/_tree.pyx":218 * * self.max_n_classes = np.max(n_classes) * self.value_stride = self.n_outputs * self.max_n_classes # <<<<<<<<<<<<<< @@ -2538,7 +2547,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->value_stride = (__pyx_v_self->n_outputs * __pyx_v_self->max_n_classes); - /* "sklearn/tree/_tree.pyx":232 + /* "sklearn/tree/_tree.pyx":220 * self.value_stride = self.n_outputs * self.max_n_classes * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< @@ -2548,21 +2557,21 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle __pyx_t_5 = __pyx_v_n_outputs; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":233 + /* "sklearn/tree/_tree.pyx":221 * * for k from 0 <= k < n_outputs: * self.n_classes[k] = n_classes[k] # <<<<<<<<<<<<<< * * # Parameters */ - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_n_classes, __pyx_v_k, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_n_classes, __pyx_v_k, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; (__pyx_v_self->n_classes[__pyx_v_k]) = __pyx_t_6; } - /* "sklearn/tree/_tree.pyx":236 + /* "sklearn/tree/_tree.pyx":224 * * # Parameters * self.criterion = criterion # <<<<<<<<<<<<<< @@ -2575,7 +2584,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle __Pyx_DECREF(((PyObject *)__pyx_v_self->criterion)); __pyx_v_self->criterion = __pyx_v_criterion; - /* "sklearn/tree/_tree.pyx":237 + /* "sklearn/tree/_tree.pyx":225 * # Parameters * self.criterion = criterion * self.max_depth = max_depth # <<<<<<<<<<<<<< @@ -2584,7 +2593,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":238 + /* "sklearn/tree/_tree.pyx":226 * self.criterion = criterion * self.max_depth = max_depth * self.min_samples_split = min_samples_split # <<<<<<<<<<<<<< @@ -2593,7 +2602,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":239 + /* "sklearn/tree/_tree.pyx":227 * self.max_depth = max_depth * self.min_samples_split = min_samples_split * self.min_samples_leaf = min_samples_leaf # <<<<<<<<<<<<<< @@ -2602,7 +2611,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":240 + /* "sklearn/tree/_tree.pyx":228 * self.min_samples_split = min_samples_split * self.min_samples_leaf = min_samples_leaf * self.min_density = min_density # <<<<<<<<<<<<<< @@ -2611,7 +2620,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->min_density = __pyx_v_min_density; - /* "sklearn/tree/_tree.pyx":241 + /* "sklearn/tree/_tree.pyx":229 * self.min_samples_leaf = min_samples_leaf * self.min_density = min_density * self.max_features = max_features # <<<<<<<<<<<<<< @@ -2620,7 +2629,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->max_features = __pyx_v_max_features; - /* "sklearn/tree/_tree.pyx":242 + /* "sklearn/tree/_tree.pyx":230 * self.min_density = min_density * self.max_features = max_features * self.find_split_algorithm = find_split_algorithm # <<<<<<<<<<<<<< @@ -2629,7 +2638,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->find_split_algorithm = __pyx_v_find_split_algorithm; - /* "sklearn/tree/_tree.pyx":243 + /* "sklearn/tree/_tree.pyx":231 * self.max_features = max_features * self.find_split_algorithm = find_split_algorithm * self.random_state = random_state # <<<<<<<<<<<<<< @@ -2642,7 +2651,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":246 + /* "sklearn/tree/_tree.pyx":234 * * # Inner structures * self.node_count = 0 # <<<<<<<<<<<<<< @@ -2651,7 +2660,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":247 + /* "sklearn/tree/_tree.pyx":235 * # Inner structures * self.node_count = 0 * self.capacity = 0 # <<<<<<<<<<<<<< @@ -2660,7 +2669,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->capacity = 0; - /* "sklearn/tree/_tree.pyx":249 + /* "sklearn/tree/_tree.pyx":237 * self.capacity = 0 * * self.children_left = NULL # <<<<<<<<<<<<<< @@ -2669,7 +2678,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->children_left = NULL; - /* "sklearn/tree/_tree.pyx":250 + /* "sklearn/tree/_tree.pyx":238 * * self.children_left = NULL * self.children_right = NULL # <<<<<<<<<<<<<< @@ -2678,7 +2687,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->children_right = NULL; - /* "sklearn/tree/_tree.pyx":251 + /* "sklearn/tree/_tree.pyx":239 * self.children_left = NULL * self.children_right = NULL * self.feature = NULL # <<<<<<<<<<<<<< @@ -2687,7 +2696,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->feature = NULL; - /* "sklearn/tree/_tree.pyx":252 + /* "sklearn/tree/_tree.pyx":240 * self.children_right = NULL * self.feature = NULL * self.threshold = NULL # <<<<<<<<<<<<<< @@ -2696,7 +2705,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->threshold = NULL; - /* "sklearn/tree/_tree.pyx":253 + /* "sklearn/tree/_tree.pyx":241 * self.feature = NULL * self.threshold = NULL * self.value = NULL # <<<<<<<<<<<<<< @@ -2705,7 +2714,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->value = NULL; - /* "sklearn/tree/_tree.pyx":254 + /* "sklearn/tree/_tree.pyx":242 * self.threshold = NULL * self.value = NULL * self.best_error = NULL # <<<<<<<<<<<<<< @@ -2714,7 +2723,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->best_error = NULL; - /* "sklearn/tree/_tree.pyx":255 + /* "sklearn/tree/_tree.pyx":243 * self.value = NULL * self.best_error = NULL * self.init_error = NULL # <<<<<<<<<<<<<< @@ -2723,7 +2732,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->init_error = NULL; - /* "sklearn/tree/_tree.pyx":256 + /* "sklearn/tree/_tree.pyx":244 * self.best_error = NULL * self.init_error = NULL * self.n_samples = NULL # <<<<<<<<<<<<<< @@ -2732,40 +2741,40 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree___cinit__(struct __pyx_obj_7skle */ __pyx_v_self->n_samples = NULL; - /* "sklearn/tree/_tree.pyx":258 + /* "sklearn/tree/_tree.pyx":246 * self.n_samples = NULL * * self.features = np.arange(n_features, dtype=np.int32) # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyInt_FromLong(__pyx_v_n_features); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_n_features); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __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 = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__int32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__int32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_8); __Pyx_GOTREF(__pyx_v_self->features); __Pyx_DECREF(((PyObject *)__pyx_v_self->features)); @@ -2796,7 +2805,7 @@ static void __pyx_pw_7sklearn_4tree_5_tree_4Tree_3__dealloc__(PyObject *__pyx_v_ __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":260 +/* "sklearn/tree/_tree.pyx":248 * self.features = np.arange(n_features, dtype=np.int32) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -2808,7 +2817,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "sklearn/tree/_tree.pyx":263 + /* "sklearn/tree/_tree.pyx":251 * """Destructor.""" * # Free all inner structures * free(self.n_classes) # <<<<<<<<<<<<<< @@ -2817,7 +2826,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":264 + /* "sklearn/tree/_tree.pyx":252 * # Free all inner structures * free(self.n_classes) * free(self.children_left) # <<<<<<<<<<<<<< @@ -2826,7 +2835,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 */ free(__pyx_v_self->children_left); - /* "sklearn/tree/_tree.pyx":265 + /* "sklearn/tree/_tree.pyx":253 * free(self.n_classes) * free(self.children_left) * free(self.children_right) # <<<<<<<<<<<<<< @@ -2835,7 +2844,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 */ free(__pyx_v_self->children_right); - /* "sklearn/tree/_tree.pyx":266 + /* "sklearn/tree/_tree.pyx":254 * free(self.children_left) * free(self.children_right) * free(self.feature) # <<<<<<<<<<<<<< @@ -2844,7 +2853,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 */ free(__pyx_v_self->feature); - /* "sklearn/tree/_tree.pyx":267 + /* "sklearn/tree/_tree.pyx":255 * free(self.children_right) * free(self.feature) * free(self.threshold) # <<<<<<<<<<<<<< @@ -2853,7 +2862,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 */ free(__pyx_v_self->threshold); - /* "sklearn/tree/_tree.pyx":268 + /* "sklearn/tree/_tree.pyx":256 * free(self.feature) * free(self.threshold) * free(self.value) # <<<<<<<<<<<<<< @@ -2862,7 +2871,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":269 + /* "sklearn/tree/_tree.pyx":257 * free(self.threshold) * free(self.value) * free(self.best_error) # <<<<<<<<<<<<<< @@ -2871,7 +2880,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 */ free(__pyx_v_self->best_error); - /* "sklearn/tree/_tree.pyx":270 + /* "sklearn/tree/_tree.pyx":258 * free(self.value) * free(self.best_error) * free(self.init_error) # <<<<<<<<<<<<<< @@ -2880,7 +2889,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_4Tree_2__dealloc__(struct __pyx_obj_7 */ free(__pyx_v_self->init_error); - /* "sklearn/tree/_tree.pyx":271 + /* "sklearn/tree/_tree.pyx":259 * free(self.best_error) * free(self.init_error) * free(self.n_samples) # <<<<<<<<<<<<<< @@ -2904,7 +2913,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_5__reduce__(PyObject *__py return __pyx_r; } -/* "sklearn/tree/_tree.pyx":273 +/* "sklearn/tree/_tree.pyx":261 * free(self.n_samples) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -2930,7 +2939,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":275 + /* "sklearn/tree/_tree.pyx":263 * def __reduce__(self): * """Reduce re-implementation, for pickling.""" * return (Tree, (self.n_features, # <<<<<<<<<<<<<< @@ -2938,97 +2947,97 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_4__reduce__(struct __pyx_o * self.n_outputs, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/tree/_tree.pyx":276 + /* "sklearn/tree/_tree.pyx":264 * """Reduce re-implementation, for pickling.""" * return (Tree, (self.n_features, * intp_to_ndarray(self.n_classes, self.n_outputs), # <<<<<<<<<<<<<< * self.n_outputs, * self.criterion, */ - __pyx_t_2 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->n_classes, __pyx_v_self->n_outputs)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->n_classes, __pyx_v_self->n_outputs)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/tree/_tree.pyx":277 + /* "sklearn/tree/_tree.pyx":265 * return (Tree, (self.n_features, * intp_to_ndarray(self.n_classes, self.n_outputs), * self.n_outputs, # <<<<<<<<<<<<<< * self.criterion, * self.max_depth, */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - /* "sklearn/tree/_tree.pyx":279 + /* "sklearn/tree/_tree.pyx":267 * self.n_outputs, * self.criterion, * self.max_depth, # <<<<<<<<<<<<<< * self.min_samples_split, * self.min_samples_leaf, */ - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->max_depth); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->max_depth); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - /* "sklearn/tree/_tree.pyx":280 + /* "sklearn/tree/_tree.pyx":268 * self.criterion, * self.max_depth, * self.min_samples_split, # <<<<<<<<<<<<<< * self.min_samples_leaf, * self.min_density, */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_self->min_samples_split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_self->min_samples_split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - /* "sklearn/tree/_tree.pyx":281 + /* "sklearn/tree/_tree.pyx":269 * self.max_depth, * self.min_samples_split, * self.min_samples_leaf, # <<<<<<<<<<<<<< * self.min_density, * self.max_features, */ - __pyx_t_6 = PyInt_FromLong(__pyx_v_self->min_samples_leaf); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyInt_FromLong(__pyx_v_self->min_samples_leaf); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - /* "sklearn/tree/_tree.pyx":282 + /* "sklearn/tree/_tree.pyx":270 * self.min_samples_split, * self.min_samples_leaf, * self.min_density, # <<<<<<<<<<<<<< * self.max_features, * self.find_split_algorithm, */ - __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->min_density); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->min_density); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - /* "sklearn/tree/_tree.pyx":283 + /* "sklearn/tree/_tree.pyx":271 * self.min_samples_leaf, * self.min_density, * self.max_features, # <<<<<<<<<<<<<< * self.find_split_algorithm, * self.random_state), self.__getstate__()) */ - __pyx_t_8 = PyInt_FromLong(__pyx_v_self->max_features); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyInt_FromLong(__pyx_v_self->max_features); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - /* "sklearn/tree/_tree.pyx":284 + /* "sklearn/tree/_tree.pyx":272 * self.min_density, * self.max_features, * self.find_split_algorithm, # <<<<<<<<<<<<<< * self.random_state), self.__getstate__()) * */ - __pyx_t_9 = PyInt_FromLong(__pyx_v_self->find_split_algorithm); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromLong(__pyx_v_self->find_split_algorithm); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - /* "sklearn/tree/_tree.pyx":285 + /* "sklearn/tree/_tree.pyx":273 * self.max_features, * self.find_split_algorithm, * self.random_state), self.__getstate__()) # <<<<<<<<<<<<<< * * def __getstate__(self): */ - __pyx_t_10 = PyTuple_New(11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -3063,12 +3072,12 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_4__reduce__(struct __pyx_o __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __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(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_Tree))); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_4tree_5_tree_Tree))); @@ -3116,7 +3125,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_7__getstate__(PyObject *__ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":287 +/* "sklearn/tree/_tree.pyx":275 * self.random_state), self.__getstate__()) * * def __getstate__(self): # <<<<<<<<<<<<<< @@ -3134,139 +3143,139 @@ 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":289 + /* "sklearn/tree/_tree.pyx":277 * def __getstate__(self): * """Getstate re-implementation, for pickling.""" * d = {} # <<<<<<<<<<<<<< * * d["node_count"] = self.node_count */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_v_d = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":291 + /* "sklearn/tree/_tree.pyx":279 * d = {} * * d["node_count"] = self.node_count # <<<<<<<<<<<<<< * d["capacity"] = self.capacity * d["children_left"] = intp_to_ndarray(self.children_left, self.capacity) */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->node_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->node_count); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __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 = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__node_count), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":292 + /* "sklearn/tree/_tree.pyx":280 * * d["node_count"] = self.node_count * d["capacity"] = self.capacity # <<<<<<<<<<<<<< * d["children_left"] = intp_to_ndarray(self.children_left, self.capacity) * d["children_right"] = intp_to_ndarray(self.children_right, self.capacity) */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->capacity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->capacity); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__capacity), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__capacity), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":293 + /* "sklearn/tree/_tree.pyx":281 * d["node_count"] = self.node_count * d["capacity"] = self.capacity * d["children_left"] = intp_to_ndarray(self.children_left, self.capacity) # <<<<<<<<<<<<<< * d["children_right"] = intp_to_ndarray(self.children_right, self.capacity) * d["feature"] = intp_to_ndarray(self.feature, self.capacity) */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->children_left, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->children_left, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__children_left), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__children_left), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":294 + /* "sklearn/tree/_tree.pyx":282 * d["capacity"] = self.capacity * d["children_left"] = intp_to_ndarray(self.children_left, self.capacity) * d["children_right"] = intp_to_ndarray(self.children_right, self.capacity) # <<<<<<<<<<<<<< * d["feature"] = intp_to_ndarray(self.feature, self.capacity) * d["threshold"] = doublep_to_ndarray(self.threshold, self.capacity) */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->children_right, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->children_right, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__children_right), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__children_right), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":295 + /* "sklearn/tree/_tree.pyx":283 * d["children_left"] = intp_to_ndarray(self.children_left, self.capacity) * d["children_right"] = intp_to_ndarray(self.children_right, self.capacity) * d["feature"] = intp_to_ndarray(self.feature, self.capacity) # <<<<<<<<<<<<<< * d["threshold"] = doublep_to_ndarray(self.threshold, self.capacity) * d["value"] = doublep_to_ndarray(self.value, self.capacity * self.value_stride) */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->feature, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->feature, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__feature), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__feature), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":296 + /* "sklearn/tree/_tree.pyx":284 * d["children_right"] = intp_to_ndarray(self.children_right, self.capacity) * d["feature"] = intp_to_ndarray(self.feature, self.capacity) * d["threshold"] = doublep_to_ndarray(self.threshold, self.capacity) # <<<<<<<<<<<<<< * d["value"] = doublep_to_ndarray(self.value, self.capacity * self.value_stride) * d["best_error"] = doublep_to_ndarray(self.best_error, self.capacity) */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->threshold, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->threshold, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__threshold), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__threshold), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":297 + /* "sklearn/tree/_tree.pyx":285 * d["feature"] = intp_to_ndarray(self.feature, self.capacity) * d["threshold"] = doublep_to_ndarray(self.threshold, self.capacity) * d["value"] = doublep_to_ndarray(self.value, self.capacity * self.value_stride) # <<<<<<<<<<<<<< * d["best_error"] = doublep_to_ndarray(self.best_error, self.capacity) * d["init_error"] = doublep_to_ndarray(self.init_error, self.capacity) */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->value, (__pyx_v_self->capacity * __pyx_v_self->value_stride))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->value, (__pyx_v_self->capacity * __pyx_v_self->value_stride))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__value), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__value), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":298 + /* "sklearn/tree/_tree.pyx":286 * d["threshold"] = doublep_to_ndarray(self.threshold, self.capacity) * d["value"] = doublep_to_ndarray(self.value, self.capacity * self.value_stride) * d["best_error"] = doublep_to_ndarray(self.best_error, self.capacity) # <<<<<<<<<<<<<< * d["init_error"] = doublep_to_ndarray(self.init_error, self.capacity) * d["n_samples"] = intp_to_ndarray(self.n_samples, self.capacity) */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->best_error, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->best_error, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__best_error), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__best_error), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":299 + /* "sklearn/tree/_tree.pyx":287 * d["value"] = doublep_to_ndarray(self.value, self.capacity * self.value_stride) * d["best_error"] = doublep_to_ndarray(self.best_error, self.capacity) * d["init_error"] = doublep_to_ndarray(self.init_error, self.capacity) # <<<<<<<<<<<<<< * d["n_samples"] = intp_to_ndarray(self.n_samples, self.capacity) * */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->init_error, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_doublep_to_ndarray(__pyx_v_self->init_error, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__init_error), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__init_error), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":300 + /* "sklearn/tree/_tree.pyx":288 * d["best_error"] = doublep_to_ndarray(self.best_error, self.capacity) * d["init_error"] = doublep_to_ndarray(self.init_error, self.capacity) * d["n_samples"] = intp_to_ndarray(self.n_samples, self.capacity) # <<<<<<<<<<<<<< * * return d */ - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->n_samples, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarray(__pyx_v_self->n_samples, __pyx_v_self->capacity)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__n_samples), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(((PyObject *)__pyx_v_d), ((PyObject *)__pyx_n_s__n_samples), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":302 + /* "sklearn/tree/_tree.pyx":290 * d["n_samples"] = intp_to_ndarray(self.n_samples, self.capacity) * * return d # <<<<<<<<<<<<<< @@ -3303,7 +3312,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_9__setstate__(PyObject *__ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":304 +/* "sklearn/tree/_tree.pyx":292 * return d * * def __setstate__(self, d): # <<<<<<<<<<<<<< @@ -3330,131 +3339,131 @@ 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":306 + /* "sklearn/tree/_tree.pyx":294 * def __setstate__(self, d): * """Setstate re-implementation, for unpickling.""" * self.resize(d["capacity"]) # <<<<<<<<<<<<<< * self.node_count = d["node_count"] * */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__capacity)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__capacity)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __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[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3.__pyx_n = 1; __pyx_t_3.capacity = __pyx_t_2; ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->resize(__pyx_v_self, &__pyx_t_3); - /* "sklearn/tree/_tree.pyx":307 + /* "sklearn/tree/_tree.pyx":295 * """Setstate re-implementation, for unpickling.""" * self.resize(d["capacity"]) * self.node_count = d["node_count"] # <<<<<<<<<<<<<< * * cdef int* children_left = ( d["children_left"]).data */ - __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 = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 295; __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[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __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":309 + /* "sklearn/tree/_tree.pyx":297 * self.node_count = d["node_count"] * * cdef int* children_left = ( d["children_left"]).data # <<<<<<<<<<<<<< * cdef int* children_right = ( d["children_right"]).data * cdef int* feature = ( d["feature"]).data */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__children_left)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__children_left)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_children_left = ((int *)((PyArrayObject *)__pyx_t_1)->data); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":310 + /* "sklearn/tree/_tree.pyx":298 * * cdef int* children_left = ( d["children_left"]).data * cdef int* children_right = ( d["children_right"]).data # <<<<<<<<<<<<<< * cdef int* feature = ( d["feature"]).data * cdef double* threshold = ( d["threshold"]).data */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__children_right)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__children_right)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_children_right = ((int *)((PyArrayObject *)__pyx_t_1)->data); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":311 + /* "sklearn/tree/_tree.pyx":299 * cdef int* children_left = ( d["children_left"]).data * cdef int* children_right = ( d["children_right"]).data * cdef int* feature = ( d["feature"]).data # <<<<<<<<<<<<<< * cdef double* threshold = ( d["threshold"]).data * cdef double* value = ( d["value"]).data */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__feature)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__feature)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_feature = ((int *)((PyArrayObject *)__pyx_t_1)->data); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":312 + /* "sklearn/tree/_tree.pyx":300 * cdef int* children_right = ( d["children_right"]).data * cdef int* feature = ( d["feature"]).data * cdef double* threshold = ( d["threshold"]).data # <<<<<<<<<<<<<< * cdef double* value = ( d["value"]).data * cdef double* best_error = ( d["best_error"]).data */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__threshold)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__threshold)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_threshold = ((double *)((PyArrayObject *)__pyx_t_1)->data); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":313 + /* "sklearn/tree/_tree.pyx":301 * cdef int* feature = ( d["feature"]).data * cdef double* threshold = ( d["threshold"]).data * cdef double* value = ( d["value"]).data # <<<<<<<<<<<<<< * cdef double* best_error = ( d["best_error"]).data * cdef double* init_error = ( d["init_error"]).data */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__value)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__value)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_value = ((double *)((PyArrayObject *)__pyx_t_1)->data); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":314 + /* "sklearn/tree/_tree.pyx":302 * cdef double* threshold = ( d["threshold"]).data * cdef double* value = ( d["value"]).data * cdef double* best_error = ( d["best_error"]).data # <<<<<<<<<<<<<< * cdef double* init_error = ( d["init_error"]).data * cdef int* n_samples = ( d["n_samples"]).data */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__best_error)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__best_error)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_best_error = ((double *)((PyArrayObject *)__pyx_t_1)->data); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":315 + /* "sklearn/tree/_tree.pyx":303 * cdef double* value = ( d["value"]).data * cdef double* best_error = ( d["best_error"]).data * cdef double* init_error = ( d["init_error"]).data # <<<<<<<<<<<<<< * cdef int* n_samples = ( d["n_samples"]).data * */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__init_error)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__init_error)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_init_error = ((double *)((PyArrayObject *)__pyx_t_1)->data); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":316 + /* "sklearn/tree/_tree.pyx":304 * cdef double* best_error = ( d["best_error"]).data * cdef double* init_error = ( d["init_error"]).data * cdef int* n_samples = ( d["n_samples"]).data # <<<<<<<<<<<<<< * * memcpy(self.children_left, children_left, self.capacity * sizeof(int)) */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__n_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_d, ((PyObject *)__pyx_n_s__n_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_n_samples = ((int *)((PyArrayObject *)__pyx_t_1)->data); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":318 + /* "sklearn/tree/_tree.pyx":306 * cdef int* n_samples = ( d["n_samples"]).data * * memcpy(self.children_left, children_left, self.capacity * sizeof(int)) # <<<<<<<<<<<<<< @@ -3463,7 +3472,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx */ memcpy(__pyx_v_self->children_left, __pyx_v_children_left, (__pyx_v_self->capacity * (sizeof(int)))); - /* "sklearn/tree/_tree.pyx":319 + /* "sklearn/tree/_tree.pyx":307 * * memcpy(self.children_left, children_left, self.capacity * sizeof(int)) * memcpy(self.children_right, children_right, self.capacity * sizeof(int)) # <<<<<<<<<<<<<< @@ -3472,7 +3481,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx */ memcpy(__pyx_v_self->children_right, __pyx_v_children_right, (__pyx_v_self->capacity * (sizeof(int)))); - /* "sklearn/tree/_tree.pyx":320 + /* "sklearn/tree/_tree.pyx":308 * memcpy(self.children_left, children_left, self.capacity * sizeof(int)) * memcpy(self.children_right, children_right, self.capacity * sizeof(int)) * memcpy(self.feature, feature, self.capacity * sizeof(int)) # <<<<<<<<<<<<<< @@ -3481,7 +3490,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx */ memcpy(__pyx_v_self->feature, __pyx_v_feature, (__pyx_v_self->capacity * (sizeof(int)))); - /* "sklearn/tree/_tree.pyx":321 + /* "sklearn/tree/_tree.pyx":309 * memcpy(self.children_right, children_right, self.capacity * sizeof(int)) * memcpy(self.feature, feature, self.capacity * sizeof(int)) * memcpy(self.threshold, threshold, self.capacity * sizeof(double)) # <<<<<<<<<<<<<< @@ -3490,7 +3499,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx */ memcpy(__pyx_v_self->threshold, __pyx_v_threshold, (__pyx_v_self->capacity * (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":322 + /* "sklearn/tree/_tree.pyx":310 * memcpy(self.feature, feature, self.capacity * sizeof(int)) * memcpy(self.threshold, threshold, self.capacity * sizeof(double)) * memcpy(self.value, value, self.capacity * self.value_stride * sizeof(double)) # <<<<<<<<<<<<<< @@ -3499,7 +3508,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx */ memcpy(__pyx_v_self->value, __pyx_v_value, ((__pyx_v_self->capacity * __pyx_v_self->value_stride) * (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":323 + /* "sklearn/tree/_tree.pyx":311 * memcpy(self.threshold, threshold, self.capacity * sizeof(double)) * memcpy(self.value, value, self.capacity * self.value_stride * sizeof(double)) * memcpy(self.best_error, best_error, self.capacity * sizeof(double)) # <<<<<<<<<<<<<< @@ -3508,7 +3517,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx */ memcpy(__pyx_v_self->best_error, __pyx_v_best_error, (__pyx_v_self->capacity * (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":324 + /* "sklearn/tree/_tree.pyx":312 * memcpy(self.value, value, self.capacity * self.value_stride * sizeof(double)) * memcpy(self.best_error, best_error, self.capacity * sizeof(double)) * memcpy(self.init_error, init_error, self.capacity * sizeof(double)) # <<<<<<<<<<<<<< @@ -3517,7 +3526,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx */ memcpy(__pyx_v_self->init_error, __pyx_v_init_error, (__pyx_v_self->capacity * (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":325 + /* "sklearn/tree/_tree.pyx":313 * memcpy(self.best_error, best_error, self.capacity * sizeof(double)) * memcpy(self.init_error, init_error, self.capacity * sizeof(double)) * memcpy(self.n_samples, n_samples, self.capacity * sizeof(int)) # <<<<<<<<<<<<<< @@ -3538,7 +3547,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_8__setstate__(struct __pyx return __pyx_r; } -/* "sklearn/tree/_tree.pyx":327 +/* "sklearn/tree/_tree.pyx":315 * memcpy(self.n_samples, n_samples, self.capacity * sizeof(int)) * * cdef void resize(self, int capacity=-1): # <<<<<<<<<<<<<< @@ -3576,7 +3585,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } } - /* "sklearn/tree/_tree.pyx":329 + /* "sklearn/tree/_tree.pyx":317 * cdef void resize(self, int capacity=-1): * """Resize all inner arrays to `capacity`, if < 0 double capacity.""" * if capacity == self.capacity: # <<<<<<<<<<<<<< @@ -3586,7 +3595,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_1 = (__pyx_v_capacity == __pyx_v_self->capacity); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":330 + /* "sklearn/tree/_tree.pyx":318 * """Resize all inner arrays to `capacity`, if < 0 double capacity.""" * if capacity == self.capacity: * return # <<<<<<<<<<<<<< @@ -3598,7 +3607,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":332 + /* "sklearn/tree/_tree.pyx":320 * return * * if capacity < 0: # <<<<<<<<<<<<<< @@ -3608,7 +3617,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_1 = (__pyx_v_capacity < 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":333 + /* "sklearn/tree/_tree.pyx":321 * * if capacity < 0: * if self.capacity <= 0: # <<<<<<<<<<<<<< @@ -3618,7 +3627,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_1 = (__pyx_v_self->capacity <= 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":334 + /* "sklearn/tree/_tree.pyx":322 * if capacity < 0: * if self.capacity <= 0: * capacity = 3 # default initial value # <<<<<<<<<<<<<< @@ -3630,7 +3639,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } /*else*/ { - /* "sklearn/tree/_tree.pyx":336 + /* "sklearn/tree/_tree.pyx":324 * capacity = 3 # default initial value * else: * capacity = 2 * self.capacity # <<<<<<<<<<<<<< @@ -3644,7 +3653,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":338 + /* "sklearn/tree/_tree.pyx":326 * capacity = 2 * self.capacity * * self.capacity = capacity # <<<<<<<<<<<<<< @@ -3653,7 +3662,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn */ __pyx_v_self->capacity = __pyx_v_capacity; - /* "sklearn/tree/_tree.pyx":340 + /* "sklearn/tree/_tree.pyx":328 * self.capacity = capacity * * cdef int* tmp_children_left = realloc(self.children_left, capacity * sizeof(int)) # <<<<<<<<<<<<<< @@ -3662,7 +3671,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn */ __pyx_v_tmp_children_left = ((int *)realloc(__pyx_v_self->children_left, (__pyx_v_capacity * (sizeof(int))))); - /* "sklearn/tree/_tree.pyx":341 + /* "sklearn/tree/_tree.pyx":329 * * cdef int* tmp_children_left = realloc(self.children_left, capacity * sizeof(int)) * if tmp_children_left != NULL: self.children_left = tmp_children_left # <<<<<<<<<<<<<< @@ -3676,7 +3685,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L6:; - /* "sklearn/tree/_tree.pyx":343 + /* "sklearn/tree/_tree.pyx":331 * if tmp_children_left != NULL: self.children_left = tmp_children_left * * cdef int* tmp_children_right = realloc(self.children_right, capacity * sizeof(int)) # <<<<<<<<<<<<<< @@ -3685,7 +3694,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn */ __pyx_v_tmp_children_right = ((int *)realloc(__pyx_v_self->children_right, (__pyx_v_capacity * (sizeof(int))))); - /* "sklearn/tree/_tree.pyx":344 + /* "sklearn/tree/_tree.pyx":332 * * cdef int* tmp_children_right = realloc(self.children_right, capacity * sizeof(int)) * if tmp_children_right != NULL: self.children_right = tmp_children_right # <<<<<<<<<<<<<< @@ -3699,7 +3708,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L7:; - /* "sklearn/tree/_tree.pyx":346 + /* "sklearn/tree/_tree.pyx":334 * if tmp_children_right != NULL: self.children_right = tmp_children_right * * cdef int* tmp_feature = realloc(self.feature, capacity * sizeof(int)) # <<<<<<<<<<<<<< @@ -3708,7 +3717,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn */ __pyx_v_tmp_feature = ((int *)realloc(__pyx_v_self->feature, (__pyx_v_capacity * (sizeof(int))))); - /* "sklearn/tree/_tree.pyx":347 + /* "sklearn/tree/_tree.pyx":335 * * cdef int* tmp_feature = realloc(self.feature, capacity * sizeof(int)) * if tmp_feature != NULL: self.feature = tmp_feature # <<<<<<<<<<<<<< @@ -3722,7 +3731,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L8:; - /* "sklearn/tree/_tree.pyx":349 + /* "sklearn/tree/_tree.pyx":337 * if tmp_feature != NULL: self.feature = tmp_feature * * cdef double* tmp_threshold = realloc(self.threshold, capacity * sizeof(double)) # <<<<<<<<<<<<<< @@ -3731,7 +3740,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn */ __pyx_v_tmp_threshold = ((double *)realloc(__pyx_v_self->threshold, (__pyx_v_capacity * (sizeof(double))))); - /* "sklearn/tree/_tree.pyx":350 + /* "sklearn/tree/_tree.pyx":338 * * cdef double* tmp_threshold = realloc(self.threshold, capacity * sizeof(double)) * if tmp_threshold != NULL: self.threshold = tmp_threshold # <<<<<<<<<<<<<< @@ -3745,7 +3754,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L9:; - /* "sklearn/tree/_tree.pyx":352 + /* "sklearn/tree/_tree.pyx":340 * if tmp_threshold != NULL: self.threshold = tmp_threshold * * cdef double* tmp_value = realloc(self.value, capacity * self.value_stride * sizeof(double)) # <<<<<<<<<<<<<< @@ -3754,7 +3763,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn */ __pyx_v_tmp_value = ((double *)realloc(__pyx_v_self->value, ((__pyx_v_capacity * __pyx_v_self->value_stride) * (sizeof(double))))); - /* "sklearn/tree/_tree.pyx":353 + /* "sklearn/tree/_tree.pyx":341 * * cdef double* tmp_value = realloc(self.value, capacity * self.value_stride * sizeof(double)) * if tmp_value != NULL: self.value = tmp_value # <<<<<<<<<<<<<< @@ -3768,7 +3777,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L10:; - /* "sklearn/tree/_tree.pyx":355 + /* "sklearn/tree/_tree.pyx":343 * if tmp_value != NULL: self.value = tmp_value * * cdef double* tmp_best_error = realloc(self.best_error, capacity * sizeof(double)) # <<<<<<<<<<<<<< @@ -3777,7 +3786,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn */ __pyx_v_tmp_best_error = ((double *)realloc(__pyx_v_self->best_error, (__pyx_v_capacity * (sizeof(double))))); - /* "sklearn/tree/_tree.pyx":356 + /* "sklearn/tree/_tree.pyx":344 * * cdef double* tmp_best_error = realloc(self.best_error, capacity * sizeof(double)) * if tmp_best_error != NULL: self.best_error = tmp_best_error # <<<<<<<<<<<<<< @@ -3791,7 +3800,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L11:; - /* "sklearn/tree/_tree.pyx":358 + /* "sklearn/tree/_tree.pyx":346 * if tmp_best_error != NULL: self.best_error = tmp_best_error * * cdef double* tmp_init_error = realloc(self.init_error, capacity * sizeof(double)) # <<<<<<<<<<<<<< @@ -3800,7 +3809,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn */ __pyx_v_tmp_init_error = ((double *)realloc(__pyx_v_self->init_error, (__pyx_v_capacity * (sizeof(double))))); - /* "sklearn/tree/_tree.pyx":359 + /* "sklearn/tree/_tree.pyx":347 * * cdef double* tmp_init_error = realloc(self.init_error, capacity * sizeof(double)) * if tmp_init_error != NULL: self.init_error = tmp_init_error # <<<<<<<<<<<<<< @@ -3814,7 +3823,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L12:; - /* "sklearn/tree/_tree.pyx":361 + /* "sklearn/tree/_tree.pyx":349 * if tmp_init_error != NULL: self.init_error = tmp_init_error * * cdef int* tmp_n_samples = realloc(self.n_samples, capacity * sizeof(int)) # <<<<<<<<<<<<<< @@ -3823,7 +3832,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn */ __pyx_v_tmp_n_samples = ((int *)realloc(__pyx_v_self->n_samples, (__pyx_v_capacity * (sizeof(int))))); - /* "sklearn/tree/_tree.pyx":362 + /* "sklearn/tree/_tree.pyx":350 * * cdef int* tmp_n_samples = realloc(self.n_samples, capacity * sizeof(int)) * if tmp_n_samples != NULL: self.n_samples = tmp_n_samples # <<<<<<<<<<<<<< @@ -3837,7 +3846,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } __pyx_L13:; - /* "sklearn/tree/_tree.pyx":364 + /* "sklearn/tree/_tree.pyx":352 * if tmp_n_samples != NULL: self.n_samples = tmp_n_samples * * if tmp_children_left == NULL or \ # <<<<<<<<<<<<<< @@ -3847,7 +3856,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_1 = (__pyx_v_tmp_children_left == NULL); if (!__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":365 + /* "sklearn/tree/_tree.pyx":353 * * if tmp_children_left == NULL or \ * tmp_children_right == NULL or \ # <<<<<<<<<<<<<< @@ -3857,7 +3866,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_2 = (__pyx_v_tmp_children_right == NULL); if (!__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":366 + /* "sklearn/tree/_tree.pyx":354 * if tmp_children_left == NULL or \ * tmp_children_right == NULL or \ * tmp_feature == NULL or \ # <<<<<<<<<<<<<< @@ -3867,7 +3876,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_3 = (__pyx_v_tmp_feature == NULL); if (!__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":367 + /* "sklearn/tree/_tree.pyx":355 * tmp_children_right == NULL or \ * tmp_feature == NULL or \ * tmp_threshold == NULL or \ # <<<<<<<<<<<<<< @@ -3877,7 +3886,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_4 = (__pyx_v_tmp_threshold == NULL); if (!__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":368 + /* "sklearn/tree/_tree.pyx":356 * tmp_feature == NULL or \ * tmp_threshold == NULL or \ * tmp_value == NULL or \ # <<<<<<<<<<<<<< @@ -3887,7 +3896,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_5 = (__pyx_v_tmp_value == NULL); if (!__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":369 + /* "sklearn/tree/_tree.pyx":357 * tmp_threshold == NULL or \ * tmp_value == NULL or \ * tmp_best_error == NULL or \ # <<<<<<<<<<<<<< @@ -3897,7 +3906,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_6 = (__pyx_v_tmp_best_error == NULL); if (!__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":370 + /* "sklearn/tree/_tree.pyx":358 * tmp_value == NULL or \ * tmp_best_error == NULL or \ * tmp_init_error == NULL or \ # <<<<<<<<<<<<<< @@ -3907,7 +3916,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_7 = (__pyx_v_tmp_init_error == NULL); if (!__pyx_t_7) { - /* "sklearn/tree/_tree.pyx":371 + /* "sklearn/tree/_tree.pyx":359 * tmp_best_error == NULL or \ * tmp_init_error == NULL or \ * tmp_n_samples == NULL: # <<<<<<<<<<<<<< @@ -3945,19 +3954,19 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn } if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":372 + /* "sklearn/tree/_tree.pyx":360 * tmp_init_error == NULL or \ * tmp_n_samples == NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * # if capacity smaller than node_count, adjust the counter */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L14; } __pyx_L14:; - /* "sklearn/tree/_tree.pyx":375 + /* "sklearn/tree/_tree.pyx":363 * * # if capacity smaller than node_count, adjust the counter * if capacity < self.node_count: # <<<<<<<<<<<<<< @@ -3967,7 +3976,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __pyx_t_2 = (__pyx_v_capacity < __pyx_v_self->node_count); if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":376 + /* "sklearn/tree/_tree.pyx":364 * # if capacity smaller than node_count, adjust the counter * if capacity < self.node_count: * self.node_count = capacity # <<<<<<<<<<<<<< @@ -3986,7 +3995,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":378 +/* "sklearn/tree/_tree.pyx":366 * self.node_count = capacity * * cpdef build(self, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -3997,7 +4006,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_resize(struct __pyx_obj_7sklearn static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11build(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_build *__pyx_optional_args) { - /* "sklearn/tree/_tree.pyx":379 + /* "sklearn/tree/_tree.pyx":367 * * cpdef build(self, np.ndarray X, np.ndarray y, * np.ndarray sample_mask=None, # <<<<<<<<<<<<<< @@ -4006,7 +4015,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl */ PyArrayObject *__pyx_v_sample_mask = ((PyArrayObject *)Py_None); - /* "sklearn/tree/_tree.pyx":380 + /* "sklearn/tree/_tree.pyx":368 * cpdef build(self, np.ndarray X, np.ndarray y, * np.ndarray sample_mask=None, * np.ndarray X_argsorted=None, # <<<<<<<<<<<<<< @@ -4015,7 +4024,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl */ PyArrayObject *__pyx_v_X_argsorted = ((PyArrayObject *)Py_None); - /* "sklearn/tree/_tree.pyx":381 + /* "sklearn/tree/_tree.pyx":369 * np.ndarray sample_mask=None, * np.ndarray X_argsorted=None, * np.ndarray sample_weight=None): # <<<<<<<<<<<<<< @@ -4061,7 +4070,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __Pyx_INCREF((PyObject *)__pyx_v_X_argsorted); __Pyx_INCREF((PyObject *)__pyx_v_sample_weight); - /* "sklearn/tree/_tree.pyx":378 + /* "sklearn/tree/_tree.pyx":366 * self.node_count = capacity * * cpdef build(self, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -4072,11 +4081,11 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__build); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__build); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __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_11build)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __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)); @@ -4093,7 +4102,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __Pyx_INCREF(((PyObject *)__pyx_v_sample_weight)); PyTuple_SET_ITEM(__pyx_t_2, 4, ((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 = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -4104,38 +4113,38 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/tree/_tree.pyx":393 + /* "sklearn/tree/_tree.pyx":381 * """ * # Check input before recursive partitioning * if X.dtype != DTYPE or not np.isfortran(X): # <<<<<<<<<<<<<< * X = np.asarray(X, dtype=DTYPE, order="F") * */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __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 = 393; __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 = 381; __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 = 393; __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 = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isfortran); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isfortran); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __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 = 393; __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 = 381; __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 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); __pyx_t_5 = __pyx_t_6; @@ -4144,36 +4153,36 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":394 + /* "sklearn/tree/_tree.pyx":382 * # Check input before recursive partitioning * if X.dtype != DTYPE or not np.isfortran(X): * X = np.asarray(X, dtype=DTYPE, order="F") # <<<<<<<<<<<<<< * * if y.dtype != DOUBLE or not y.flags.contiguous: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __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 = 394; __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 = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_X)); __pyx_v_X = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; @@ -4181,29 +4190,29 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":396 + /* "sklearn/tree/_tree.pyx":384 * X = np.asarray(X, dtype=DTYPE, order="F") * * if y.dtype != DOUBLE or not y.flags.contiguous: # <<<<<<<<<<<<<< * y = np.asarray(y, dtype=DOUBLE, order="C") * */ - __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_5) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__contiguous); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__contiguous); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = (!__pyx_t_4); __pyx_t_4 = __pyx_t_6; @@ -4212,36 +4221,36 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":397 + /* "sklearn/tree/_tree.pyx":385 * * if y.dtype != DOUBLE or not y.flags.contiguous: * y = np.asarray(y, dtype=DOUBLE, order="C") # <<<<<<<<<<<<<< * * if sample_weight is not None: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __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 = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __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(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_y)); __pyx_v_y = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; @@ -4249,7 +4258,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":399 + /* "sklearn/tree/_tree.pyx":387 * y = np.asarray(y, dtype=DOUBLE, order="C") * * if sample_weight is not None: # <<<<<<<<<<<<<< @@ -4259,29 +4268,29 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __pyx_t_4 = (((PyObject *)__pyx_v_sample_weight) != Py_None); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":400 + /* "sklearn/tree/_tree.pyx":388 * * 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_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_4) { - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s__flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_sample_weight), __pyx_n_s__flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__contiguous); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__contiguous); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = (!__pyx_t_5); __pyx_t_5 = __pyx_t_6; @@ -4290,60 +4299,60 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":401 + /* "sklearn/tree/_tree.pyx":389 * 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_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__asarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__asarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/tree/_tree.pyx":402 + /* "sklearn/tree/_tree.pyx":390 * if sample_weight.dtype != DOUBLE or not sample_weight.flags.contiguous: * sample_weight = np.asarray( * sample_weight, dtype=DOUBLE, order="C") # <<<<<<<<<<<<<< * * if sample_mask is None: */ - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_v_sample_weight)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sample_weight)); - /* "sklearn/tree/_tree.pyx":401 + /* "sklearn/tree/_tree.pyx":389 * 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_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - /* "sklearn/tree/_tree.pyx":402 + /* "sklearn/tree/_tree.pyx":390 * if sample_weight.dtype != DOUBLE or not sample_weight.flags.contiguous: * sample_weight = np.asarray( * sample_weight, dtype=DOUBLE, order="C") # <<<<<<<<<<<<<< * * if sample_mask is None: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DOUBLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__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 = 401; __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 = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_sample_weight)); __pyx_v_sample_weight = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -4354,7 +4363,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } __pyx_L5:; - /* "sklearn/tree/_tree.pyx":404 + /* "sklearn/tree/_tree.pyx":392 * sample_weight, dtype=DOUBLE, order="C") * * if sample_mask is None: # <<<<<<<<<<<<<< @@ -4364,39 +4373,39 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __pyx_t_5 = (((PyObject *)__pyx_v_sample_mask) == Py_None); if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":405 + /* "sklearn/tree/_tree.pyx":393 * * if sample_mask is None: * sample_mask = np_ones((X.shape[0],), dtype=np_bool) # <<<<<<<<<<<<<< * * if X_argsorted is None: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->dimensions[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __Pyx_GIVEREF(__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 = 405; __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 = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __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_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_sample_mask)); __pyx_v_sample_mask = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; @@ -4404,7 +4413,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } __pyx_L7:; - /* "sklearn/tree/_tree.pyx":407 + /* "sklearn/tree/_tree.pyx":395 * sample_mask = np_ones((X.shape[0],), dtype=np_bool) * * if X_argsorted is None: # <<<<<<<<<<<<<< @@ -4414,76 +4423,76 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __pyx_t_5 = (((PyObject *)__pyx_v_X_argsorted) == Py_None); if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":408 + /* "sklearn/tree/_tree.pyx":396 * * if X_argsorted is None: * X_argsorted = np.asfortranarray( # <<<<<<<<<<<<<< * np.argsort(X.T, axis=1).astype(np.int32).T) * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__asfortranarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__asfortranarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/tree/_tree.pyx":409 + /* "sklearn/tree/_tree.pyx":397 * if X_argsorted is None: * X_argsorted = np.asfortranarray( * np.argsort(X.T, axis=1).astype(np.int32).T) # <<<<<<<<<<<<<< * * # Pre-allocate some space */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __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 = 409; __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 = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__int32); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __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); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__T); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__T); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __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 = 408; __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 = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_X_argsorted)); __pyx_v_X_argsorted = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; @@ -4491,7 +4500,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } __pyx_L8:; - /* "sklearn/tree/_tree.pyx":416 + /* "sklearn/tree/_tree.pyx":404 * cdef double weighted_n_node_samples * * if self.max_depth <= 10: # <<<<<<<<<<<<<< @@ -4501,7 +4510,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __pyx_t_5 = (__pyx_v_self->max_depth <= 10.0); if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":417 + /* "sklearn/tree/_tree.pyx":405 * * if self.max_depth <= 10: * init_capacity = (2 ** ((self.max_depth) + 1)) - 1 # <<<<<<<<<<<<<< @@ -4513,7 +4522,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } /*else*/ { - /* "sklearn/tree/_tree.pyx":419 + /* "sklearn/tree/_tree.pyx":407 * init_capacity = (2 ** ((self.max_depth) + 1)) - 1 * else: * init_capacity = 2047 # <<<<<<<<<<<<<< @@ -4524,7 +4533,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } __pyx_L9:; - /* "sklearn/tree/_tree.pyx":421 + /* "sklearn/tree/_tree.pyx":409 * init_capacity = 2047 * * self.resize(init_capacity) # <<<<<<<<<<<<<< @@ -4535,7 +4544,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __pyx_t_9.capacity = __pyx_v_init_capacity; ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->resize(__pyx_v_self, &__pyx_t_9); - /* "sklearn/tree/_tree.pyx":422 + /* "sklearn/tree/_tree.pyx":410 * * self.resize(init_capacity) * cdef double* buffer_value = malloc(self.value_stride * sizeof(double)) # <<<<<<<<<<<<<< @@ -4544,32 +4553,32 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl */ __pyx_v_buffer_value = ((double *)malloc((__pyx_v_self->value_stride * (sizeof(double))))); - /* "sklearn/tree/_tree.pyx":424 + /* "sklearn/tree/_tree.pyx":412 * cdef double* buffer_value = malloc(self.value_stride * sizeof(double)) * * n_node_samples = np.sum(sample_mask) # <<<<<<<<<<<<<< * if sample_weight is not None: * weighted_n_node_samples = np.sum(sample_weight[sample_mask]) */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_v_sample_mask)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_sample_mask)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sample_mask)); - __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_n_node_samples = __pyx_t_10; - /* "sklearn/tree/_tree.pyx":425 + /* "sklearn/tree/_tree.pyx":413 * * n_node_samples = np.sum(sample_mask) * if sample_weight is not None: # <<<<<<<<<<<<<< @@ -4579,37 +4588,37 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __pyx_t_5 = (((PyObject *)__pyx_v_sample_weight) != Py_None); if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":426 + /* "sklearn/tree/_tree.pyx":414 * n_node_samples = np.sum(sample_mask) * if sample_weight is not None: * weighted_n_node_samples = np.sum(sample_weight[sample_mask]) # <<<<<<<<<<<<<< * else: * weighted_n_node_samples = n_node_samples */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__sum); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__sum); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_sample_weight), ((PyObject *)__pyx_v_sample_mask)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_sample_weight), ((PyObject *)__pyx_v_sample_mask)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __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 = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_weighted_n_node_samples = __pyx_t_11; goto __pyx_L10; } /*else*/ { - /* "sklearn/tree/_tree.pyx":428 + /* "sklearn/tree/_tree.pyx":416 * weighted_n_node_samples = np.sum(sample_weight[sample_mask]) * else: * weighted_n_node_samples = n_node_samples # <<<<<<<<<<<<<< @@ -4620,16 +4629,16 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl } __pyx_L10:; - /* "sklearn/tree/_tree.pyx":441 + /* "sklearn/tree/_tree.pyx":429 * -1, * False, * buffer_value) # <<<<<<<<<<<<<< * * # Compactify */ - ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->recursive_partition(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_X_argsorted), ((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_sample_weight), __pyx_v_sample_mask, __pyx_v_n_node_samples, __pyx_v_weighted_n_node_samples, 0, -1, 0, __pyx_v_buffer_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->recursive_partition(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_X_argsorted), ((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_sample_weight), __pyx_v_sample_mask, __pyx_v_n_node_samples, __pyx_v_weighted_n_node_samples, 0, -1, 0, __pyx_v_buffer_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/tree/_tree.pyx":444 + /* "sklearn/tree/_tree.pyx":432 * * # Compactify * self.resize(self.node_count) # <<<<<<<<<<<<<< @@ -4640,7 +4649,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_build(struct __pyx_obj_7skl __pyx_t_9.capacity = __pyx_v_self->node_count; ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->resize(__pyx_v_self, &__pyx_t_9); - /* "sklearn/tree/_tree.pyx":445 + /* "sklearn/tree/_tree.pyx":433 * # Compactify * self.resize(self.node_count) * free(buffer_value) # <<<<<<<<<<<<<< @@ -4686,7 +4695,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11build(PyObject *__pyx_v_ static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__sample_mask,&__pyx_n_s__X_argsorted,&__pyx_n_s__sample_weight,0}; PyObject* values[5] = {0,0,0,0,0}; - /* "sklearn/tree/_tree.pyx":379 + /* "sklearn/tree/_tree.pyx":367 * * cpdef build(self, np.ndarray X, np.ndarray y, * np.ndarray sample_mask=None, # <<<<<<<<<<<<<< @@ -4695,7 +4704,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11build(PyObject *__pyx_v_ */ values[2] = (PyObject *)((PyArrayObject *)Py_None); - /* "sklearn/tree/_tree.pyx":380 + /* "sklearn/tree/_tree.pyx":368 * cpdef build(self, np.ndarray X, np.ndarray y, * np.ndarray sample_mask=None, * np.ndarray X_argsorted=None, # <<<<<<<<<<<<<< @@ -4704,7 +4713,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11build(PyObject *__pyx_v_ */ values[3] = (PyObject *)((PyArrayObject *)Py_None); - /* "sklearn/tree/_tree.pyx":381 + /* "sklearn/tree/_tree.pyx":369 * np.ndarray sample_mask=None, * np.ndarray X_argsorted=None, * np.ndarray sample_weight=None): # <<<<<<<<<<<<<< @@ -4732,7 +4741,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11build(PyObject *__pyx_v_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("build", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -4751,7 +4760,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11build(PyObject *__pyx_v_ } } 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 = 378; __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 = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4772,17 +4781,17 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11build(PyObject *__pyx_v_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("build", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("build", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree.Tree.build", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __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 = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_mask), __pyx_ptype_5numpy_ndarray, 1, "sample_mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_argsorted), __pyx_ptype_5numpy_ndarray, 1, "X_argsorted", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __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 = 381; __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 = 366; __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 = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_mask), __pyx_ptype_5numpy_ndarray, 1, "sample_mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_argsorted), __pyx_ptype_5numpy_ndarray, 1, "X_argsorted", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __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 = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_10build(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), __pyx_v_X, __pyx_v_y, __pyx_v_sample_mask, __pyx_v_X_argsorted, __pyx_v_sample_weight); goto __pyx_L0; __pyx_L1_error:; @@ -4792,7 +4801,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_11build(PyObject *__pyx_v_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":378 +/* "sklearn/tree/_tree.pyx":366 * self.node_count = capacity * * cpdef build(self, np.ndarray X, np.ndarray y, # <<<<<<<<<<<<<< @@ -4814,7 +4823,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10build(struct __pyx_obj_7 __pyx_t_2.sample_mask = __pyx_v_sample_mask; __pyx_t_2.X_argsorted = __pyx_v_X_argsorted; __pyx_t_2.sample_weight = __pyx_v_sample_weight; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->build(__pyx_v_self, __pyx_v_X, __pyx_v_y, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->build(__pyx_v_self, __pyx_v_X, __pyx_v_y, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4832,7 +4841,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_10build(struct __pyx_obj_7 return __pyx_r; } -/* "sklearn/tree/_tree.pyx":447 +/* "sklearn/tree/_tree.pyx":435 * free(buffer_value) * * cdef void recursive_partition(self, # <<<<<<<<<<<<<< @@ -4875,8 +4884,8 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __Pyx_LocalBuf_ND __pyx_pybuffernd_y; __Pyx_Buffer __pyx_pybuffer_y; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; @@ -4919,36 +4928,38 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; { __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_F_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __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_F_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __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_X_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_argsorted, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_F_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_argsorted.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_argsorted, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_F_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_argsorted.diminfo[0].strides = __pyx_pybuffernd_X_argsorted.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_argsorted.diminfo[0].shape = __pyx_pybuffernd_X_argsorted.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X_argsorted.diminfo[1].strides = __pyx_pybuffernd_X_argsorted.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X_argsorted.diminfo[1].shape = __pyx_pybuffernd_X_argsorted.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 = 447; __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 = 435; __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]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DOUBLE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_DOUBLE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/tree/_tree.pyx":461 + /* "sklearn/tree/_tree.pyx":449 * """Recursive partition algorithm for the tree construction.""" * # Variables * cdef Criterion criterion = self.criterion # <<<<<<<<<<<<<< * * cdef DTYPE_t* X_ptr = X.data */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->criterion)); - __pyx_v_criterion = __pyx_v_self->criterion; + __pyx_t_1 = ((PyObject *)__pyx_v_self->criterion); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)__pyx_t_1); + __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":463 + /* "sklearn/tree/_tree.pyx":451 * cdef Criterion criterion = self.criterion * * cdef DTYPE_t* X_ptr = X.data # <<<<<<<<<<<<<< @@ -4957,7 +4968,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_X_ptr = ((__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *)__pyx_v_X->data); - /* "sklearn/tree/_tree.pyx":464 + /* "sklearn/tree/_tree.pyx":452 * * cdef DTYPE_t* X_ptr = X.data * cdef int* X_argsorted_ptr = X_argsorted.data # <<<<<<<<<<<<<< @@ -4966,7 +4977,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_X_argsorted_ptr = ((int *)__pyx_v_X_argsorted->data); - /* "sklearn/tree/_tree.pyx":465 + /* "sklearn/tree/_tree.pyx":453 * cdef DTYPE_t* X_ptr = X.data * cdef int* X_argsorted_ptr = X_argsorted.data * cdef DOUBLE_t* y_ptr = y.data # <<<<<<<<<<<<<< @@ -4975,7 +4986,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_y_ptr = ((__pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *)__pyx_v_y->data); - /* "sklearn/tree/_tree.pyx":466 + /* "sklearn/tree/_tree.pyx":454 * cdef int* X_argsorted_ptr = X_argsorted.data * cdef DOUBLE_t* y_ptr = y.data * cdef BOOL_t* sample_mask_ptr = sample_mask.data # <<<<<<<<<<<<<< @@ -4984,7 +4995,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_sample_mask_ptr = ((__pyx_t_7sklearn_4tree_5_tree_BOOL_t *)__pyx_v_sample_mask->data); - /* "sklearn/tree/_tree.pyx":468 + /* "sklearn/tree/_tree.pyx":456 * cdef BOOL_t* sample_mask_ptr = sample_mask.data * * cdef DOUBLE_t* sample_weight_ptr = NULL # <<<<<<<<<<<<<< @@ -4993,17 +5004,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_sample_weight_ptr = NULL; - /* "sklearn/tree/_tree.pyx":469 + /* "sklearn/tree/_tree.pyx":457 * * cdef DOUBLE_t* sample_weight_ptr = NULL * if sample_weight is not None: # <<<<<<<<<<<<<< * sample_weight_ptr = sample_weight.data * cdef DOUBLE_t w = 1.0 */ - __pyx_t_1 = (((PyObject *)__pyx_v_sample_weight) != Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (((PyObject *)__pyx_v_sample_weight) != Py_None); + if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":470 + /* "sklearn/tree/_tree.pyx":458 * cdef DOUBLE_t* sample_weight_ptr = NULL * if sample_weight is not None: * sample_weight_ptr = sample_weight.data # <<<<<<<<<<<<<< @@ -5015,7 +5026,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":471 + /* "sklearn/tree/_tree.pyx":459 * if sample_weight is not None: * sample_weight_ptr = sample_weight.data * cdef DOUBLE_t w = 1.0 # <<<<<<<<<<<<<< @@ -5024,46 +5035,46 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_w = 1.0; - /* "sklearn/tree/_tree.pyx":473 + /* "sklearn/tree/_tree.pyx":461 * cdef DOUBLE_t w = 1.0 * * cdef int X_stride = X.strides[1] / X.itemsize # <<<<<<<<<<<<<< * cdef int X_argsorted_stride = X_argsorted.strides[1] / X_argsorted.itemsize * cdef int y_stride = y.strides[0] / y.itemsize */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __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[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_X_stride = (((int)(__pyx_v_X->strides[1])) / ((int)__pyx_t_3)); - /* "sklearn/tree/_tree.pyx":474 + /* "sklearn/tree/_tree.pyx":462 * * cdef int X_stride = X.strides[1] / X.itemsize * cdef int X_argsorted_stride = X_argsorted.strides[1] / X_argsorted.itemsize # <<<<<<<<<<<<<< * cdef int y_stride = y.strides[0] / y.itemsize * */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_X_argsorted), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X_argsorted), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __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[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_X_argsorted_stride = (((int)(__pyx_v_X_argsorted->strides[1])) / ((int)__pyx_t_3)); - /* "sklearn/tree/_tree.pyx":475 + /* "sklearn/tree/_tree.pyx":463 * cdef int X_stride = X.strides[1] / X.itemsize * cdef int X_argsorted_stride = X_argsorted.strides[1] / X_argsorted.itemsize * cdef int y_stride = y.strides[0] / y.itemsize # <<<<<<<<<<<<<< * * cdef int n_total_samples = y.shape[0] */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __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[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_y_stride = (((int)(__pyx_v_y->strides[0])) / ((int)__pyx_t_3)); - /* "sklearn/tree/_tree.pyx":477 + /* "sklearn/tree/_tree.pyx":465 * cdef int y_stride = y.strides[0] / y.itemsize * * cdef int n_total_samples = y.shape[0] # <<<<<<<<<<<<<< @@ -5072,7 +5083,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_n_total_samples = (__pyx_v_y->dimensions[0]); - /* "sklearn/tree/_tree.pyx":486 + /* "sklearn/tree/_tree.pyx":474 * cdef np.ndarray sample_mask_left * cdef np.ndarray sample_mask_right * cdef BOOL_t* sample_mask_left_ptr = NULL # <<<<<<<<<<<<<< @@ -5081,7 +5092,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_sample_mask_left_ptr = NULL; - /* "sklearn/tree/_tree.pyx":487 + /* "sklearn/tree/_tree.pyx":475 * cdef np.ndarray sample_mask_right * cdef BOOL_t* sample_mask_left_ptr = NULL * cdef BOOL_t* sample_mask_right_ptr = NULL # <<<<<<<<<<<<<< @@ -5090,7 +5101,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_sample_mask_right_ptr = NULL; - /* "sklearn/tree/_tree.pyx":488 + /* "sklearn/tree/_tree.pyx":476 * cdef BOOL_t* sample_mask_left_ptr = NULL * cdef BOOL_t* sample_mask_right_ptr = NULL * cdef int n_node_samples_left = 0 # <<<<<<<<<<<<<< @@ -5099,7 +5110,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_n_node_samples_left = 0; - /* "sklearn/tree/_tree.pyx":489 + /* "sklearn/tree/_tree.pyx":477 * cdef BOOL_t* sample_mask_right_ptr = NULL * cdef int n_node_samples_left = 0 * cdef int n_node_samples_right = 0 # <<<<<<<<<<<<<< @@ -5108,7 +5119,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_n_node_samples_right = 0; - /* "sklearn/tree/_tree.pyx":490 + /* "sklearn/tree/_tree.pyx":478 * cdef int n_node_samples_left = 0 * cdef int n_node_samples_right = 0 * cdef double weighted_n_node_samples_left = 0.0 # <<<<<<<<<<<<<< @@ -5117,7 +5128,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_weighted_n_node_samples_left = 0.0; - /* "sklearn/tree/_tree.pyx":491 + /* "sklearn/tree/_tree.pyx":479 * cdef int n_node_samples_right = 0 * cdef double weighted_n_node_samples_left = 0.0 * cdef double weighted_n_node_samples_right = 0.0 # <<<<<<<<<<<<<< @@ -5126,69 +5137,69 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_weighted_n_node_samples_right = 0.0; - /* "sklearn/tree/_tree.pyx":494 + /* "sklearn/tree/_tree.pyx":482 * * # Count samples * if n_node_samples == 0: # <<<<<<<<<<<<<< * raise ValueError("Attempting to find a split " * "with an empty sample_mask.") */ - __pyx_t_1 = (__pyx_v_n_node_samples == 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_n_node_samples == 0); + if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":495 + /* "sklearn/tree/_tree.pyx":483 * # Count samples * if n_node_samples == 0: * raise ValueError("Attempting to find a split " # <<<<<<<<<<<<<< * "with an empty sample_mask.") * */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __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[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 483; __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 = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":498 + /* "sklearn/tree/_tree.pyx":486 * "with an empty sample_mask.") * * if weighted_n_node_samples < 0.0: # <<<<<<<<<<<<<< * raise ValueError("Attempting to find a split with a negative " * "weighted number of samples.") */ - __pyx_t_1 = (__pyx_v_weighted_n_node_samples < 0.0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_weighted_n_node_samples < 0.0); + if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":499 + /* "sklearn/tree/_tree.pyx":487 * * if weighted_n_node_samples < 0.0: * raise ValueError("Attempting to find a split with a negative " # <<<<<<<<<<<<<< * "weighted number of samples.") * */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 487; __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 = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "sklearn/tree/_tree.pyx":503 + /* "sklearn/tree/_tree.pyx":491 * * # Split samples * if depth < self.max_depth and \ # <<<<<<<<<<<<<< * n_node_samples >= self.min_samples_split and \ * n_node_samples >= 2 * self.min_samples_leaf: */ - __pyx_t_1 = (__pyx_v_depth < __pyx_v_self->max_depth); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_depth < __pyx_v_self->max_depth); + if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":504 + /* "sklearn/tree/_tree.pyx":492 * # Split samples * if depth < self.max_depth and \ * n_node_samples >= self.min_samples_split and \ # <<<<<<<<<<<<<< @@ -5198,7 +5209,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __pyx_t_4 = (__pyx_v_n_node_samples >= __pyx_v_self->min_samples_split); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":505 + /* "sklearn/tree/_tree.pyx":493 * if depth < self.max_depth and \ * n_node_samples >= self.min_samples_split and \ * n_node_samples >= 2 * self.min_samples_leaf: # <<<<<<<<<<<<<< @@ -5212,11 +5223,11 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } __pyx_t_4 = __pyx_t_6; } else { - __pyx_t_4 = __pyx_t_1; + __pyx_t_4 = __pyx_t_2; } if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":514 + /* "sklearn/tree/_tree.pyx":502 * weighted_n_node_samples, * n_total_samples, * &feature, &threshold, &best_error, &init_error) # <<<<<<<<<<<<<< @@ -5228,7 +5239,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } /*else*/ { - /* "sklearn/tree/_tree.pyx":517 + /* "sklearn/tree/_tree.pyx":505 * * else: * feature = -1 # <<<<<<<<<<<<<< @@ -5237,7 +5248,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_feature = -1; - /* "sklearn/tree/_tree.pyx":523 + /* "sklearn/tree/_tree.pyx":511 * n_node_samples, * weighted_n_node_samples, * n_total_samples) # <<<<<<<<<<<<<< @@ -5246,7 +5257,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->init(__pyx_v_criterion, __pyx_v_y_ptr, __pyx_v_y_stride, __pyx_v_sample_weight_ptr, __pyx_v_sample_mask_ptr, __pyx_v_n_node_samples, __pyx_v_weighted_n_node_samples, __pyx_v_n_total_samples); - /* "sklearn/tree/_tree.pyx":524 + /* "sklearn/tree/_tree.pyx":512 * weighted_n_node_samples, * n_total_samples) * init_error = criterion.eval() # <<<<<<<<<<<<<< @@ -5257,7 +5268,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } __pyx_L6:; - /* "sklearn/tree/_tree.pyx":526 + /* "sklearn/tree/_tree.pyx":514 * init_error = criterion.eval() * * criterion.init_value(buffer_value) # <<<<<<<<<<<<<< @@ -5266,7 +5277,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->init_value(__pyx_v_criterion, __pyx_v_buffer_value); - /* "sklearn/tree/_tree.pyx":529 + /* "sklearn/tree/_tree.pyx":517 * * # Current node is leaf * if feature == -1: # <<<<<<<<<<<<<< @@ -5276,7 +5287,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __pyx_t_4 = (__pyx_v_feature == -1); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":530 + /* "sklearn/tree/_tree.pyx":518 * # Current node is leaf * if feature == -1: * self.add_leaf(parent, is_left_child, buffer_value, init_error, n_node_samples) # <<<<<<<<<<<<<< @@ -5288,7 +5299,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } /*else*/ { - /* "sklearn/tree/_tree.pyx":535 + /* "sklearn/tree/_tree.pyx":523 * else: * # Sample mask is too sparse? * if 1. * n_node_samples / n_total_samples <= self.min_density: # <<<<<<<<<<<<<< @@ -5298,17 +5309,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __pyx_t_4 = (((1. * __pyx_v_n_node_samples) / __pyx_v_n_total_samples) <= __pyx_v_self->min_density); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":536 + /* "sklearn/tree/_tree.pyx":524 * # Sample mask is too sparse? * if 1. * n_node_samples / n_total_samples <= self.min_density: * X = X[sample_mask] # <<<<<<<<<<<<<< * X_argsorted = np.asfortranarray(np.argsort(X.T, axis=1).astype(np.int32).T) * y = y[sample_mask] */ - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_v_sample_mask)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_t_2); + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_v_sample_mask)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __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 = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); @@ -5323,75 +5334,75 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } } __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]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_X)); - __pyx_v_X = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_X = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":537 + /* "sklearn/tree/_tree.pyx":525 * if 1. * n_node_samples / n_total_samples <= self.min_density: * X = X[sample_mask] * X_argsorted = np.asfortranarray(np.argsort(X.T, axis=1).astype(np.int32).T) # <<<<<<<<<<<<<< * y = y[sample_mask] * if sample_weight is not None: */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asfortranarray); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asfortranarray); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__argsort); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_13, 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 = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__axis), __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_14 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_13, 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 = 525; __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_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __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 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_13 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__int32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__int32); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; - __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__T); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__T); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_15 = ((PyArrayObject *)__pyx_t_14); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -5407,23 +5418,23 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } } __pyx_pybuffernd_X_argsorted.diminfo[0].strides = __pyx_pybuffernd_X_argsorted.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_argsorted.diminfo[0].shape = __pyx_pybuffernd_X_argsorted.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X_argsorted.diminfo[1].strides = __pyx_pybuffernd_X_argsorted.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X_argsorted.diminfo[1].shape = __pyx_pybuffernd_X_argsorted.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_15 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_X_argsorted)); __pyx_v_X_argsorted = ((PyArrayObject *)__pyx_t_14); __pyx_t_14 = 0; - /* "sklearn/tree/_tree.pyx":538 + /* "sklearn/tree/_tree.pyx":526 * X = X[sample_mask] * X_argsorted = np.asfortranarray(np.argsort(X.T, axis=1).astype(np.int32).T) * y = y[sample_mask] # <<<<<<<<<<<<<< * if sample_weight is not None: * sample_weight = sample_weight[sample_mask] */ - __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_y), ((PyObject *)__pyx_v_sample_mask)); if (!__pyx_t_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_y), ((PyObject *)__pyx_v_sample_mask)); if (!__pyx_t_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_16 = ((PyArrayObject *)__pyx_t_14); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -5439,14 +5450,14 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } } __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]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_16 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_y)); __pyx_v_y = ((PyArrayObject *)__pyx_t_14); __pyx_t_14 = 0; - /* "sklearn/tree/_tree.pyx":539 + /* "sklearn/tree/_tree.pyx":527 * X_argsorted = np.asfortranarray(np.argsort(X.T, axis=1).astype(np.int32).T) * y = y[sample_mask] * if sample_weight is not None: # <<<<<<<<<<<<<< @@ -5456,16 +5467,16 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __pyx_t_4 = (((PyObject *)__pyx_v_sample_weight) != Py_None); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":540 + /* "sklearn/tree/_tree.pyx":528 * y = y[sample_mask] * if sample_weight is not None: * sample_weight = sample_weight[sample_mask] # <<<<<<<<<<<<<< * sample_weight_ptr = sample_weight.data * sample_mask = np_ones((n_node_samples, ), dtype=np_bool) */ - __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_sample_weight), ((PyObject *)__pyx_v_sample_mask)); if (!__pyx_t_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_sample_weight), ((PyObject *)__pyx_v_sample_mask)); if (!__pyx_t_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_14); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -5481,14 +5492,14 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_sample_weight)); __pyx_v_sample_weight = ((PyArrayObject *)__pyx_t_14); __pyx_t_14 = 0; - /* "sklearn/tree/_tree.pyx":541 + /* "sklearn/tree/_tree.pyx":529 * if sample_weight is not None: * sample_weight = sample_weight[sample_mask] * sample_weight_ptr = sample_weight.data # <<<<<<<<<<<<<< @@ -5500,44 +5511,44 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } __pyx_L9:; - /* "sklearn/tree/_tree.pyx":542 + /* "sklearn/tree/_tree.pyx":530 * sample_weight = sample_weight[sample_mask] * sample_weight_ptr = sample_weight.data * sample_mask = np_ones((n_node_samples, ), dtype=np_bool) # <<<<<<<<<<<<<< * * n_total_samples = n_node_samples */ - __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_ones); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_ones); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_13 = PyInt_FromLong(__pyx_v_n_node_samples); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyInt_FromLong(__pyx_v_n_node_samples); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_11)); __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_11)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 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 = 542; __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 = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_sample_mask)); - __pyx_v_sample_mask = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_sample_mask = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":544 + /* "sklearn/tree/_tree.pyx":532 * sample_mask = np_ones((n_node_samples, ), dtype=np_bool) * * n_total_samples = n_node_samples # <<<<<<<<<<<<<< @@ -5546,7 +5557,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_n_total_samples = __pyx_v_n_node_samples; - /* "sklearn/tree/_tree.pyx":546 + /* "sklearn/tree/_tree.pyx":534 * n_total_samples = n_node_samples * * X_ptr = X.data # <<<<<<<<<<<<<< @@ -5555,20 +5566,20 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_X_ptr = ((__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *)__pyx_v_X->data); - /* "sklearn/tree/_tree.pyx":547 + /* "sklearn/tree/_tree.pyx":535 * * X_ptr = X.data * X_stride = X.strides[1] / X.itemsize # <<<<<<<<<<<<<< * sample_mask_ptr = sample_mask.data * */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __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[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_X_stride = (((int)(__pyx_v_X->strides[1])) / ((int)__pyx_t_3)); - /* "sklearn/tree/_tree.pyx":548 + /* "sklearn/tree/_tree.pyx":536 * X_ptr = X.data * X_stride = X.strides[1] / X.itemsize * sample_mask_ptr = sample_mask.data # <<<<<<<<<<<<<< @@ -5580,7 +5591,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } __pyx_L8:; - /* "sklearn/tree/_tree.pyx":557 + /* "sklearn/tree/_tree.pyx":545 * * # Split * X_ptr = X_ptr + feature * X_stride # <<<<<<<<<<<<<< @@ -5589,79 +5600,79 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_X_ptr = (__pyx_v_X_ptr + (__pyx_v_feature * __pyx_v_X_stride)); - /* "sklearn/tree/_tree.pyx":559 + /* "sklearn/tree/_tree.pyx":547 * X_ptr = X_ptr + feature * X_stride * * sample_mask_left = np_zeros((n_total_samples, ), dtype=np_bool) # <<<<<<<<<<<<<< * sample_mask_right = np_zeros((n_total_samples, ), dtype=np_bool) * sample_mask_left_ptr = sample_mask_left.data */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = PyInt_FromLong(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = PyInt_FromLong(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_t_13)); __Pyx_GIVEREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_13)); - __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_14) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_sample_mask_left = ((PyArrayObject *)__pyx_t_14); __pyx_t_14 = 0; - /* "sklearn/tree/_tree.pyx":560 + /* "sklearn/tree/_tree.pyx":548 * * sample_mask_left = np_zeros((n_total_samples, ), dtype=np_bool) * sample_mask_right = np_zeros((n_total_samples, ), dtype=np_bool) # <<<<<<<<<<<<<< * sample_mask_left_ptr = sample_mask_left.data * sample_mask_right_ptr = sample_mask_right.data */ - __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_13 = PyInt_FromLong(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyInt_FromLong(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_11)); __Pyx_GIVEREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_11)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_13), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 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 = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_sample_mask_right = ((PyArrayObject *)__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 = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_sample_mask_right = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":561 + /* "sklearn/tree/_tree.pyx":549 * sample_mask_left = np_zeros((n_total_samples, ), dtype=np_bool) * sample_mask_right = np_zeros((n_total_samples, ), dtype=np_bool) * sample_mask_left_ptr = sample_mask_left.data # <<<<<<<<<<<<<< @@ -5670,7 +5681,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_sample_mask_left_ptr = ((__pyx_t_7sklearn_4tree_5_tree_BOOL_t *)__pyx_v_sample_mask_left->data); - /* "sklearn/tree/_tree.pyx":562 + /* "sklearn/tree/_tree.pyx":550 * sample_mask_right = np_zeros((n_total_samples, ), dtype=np_bool) * sample_mask_left_ptr = sample_mask_left.data * sample_mask_right_ptr = sample_mask_right.data # <<<<<<<<<<<<<< @@ -5679,7 +5690,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_sample_mask_right_ptr = ((__pyx_t_7sklearn_4tree_5_tree_BOOL_t *)__pyx_v_sample_mask_right->data); - /* "sklearn/tree/_tree.pyx":564 + /* "sklearn/tree/_tree.pyx":552 * sample_mask_right_ptr = sample_mask_right.data * * n_node_samples_left = 0 # <<<<<<<<<<<<<< @@ -5688,7 +5699,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_n_node_samples_left = 0; - /* "sklearn/tree/_tree.pyx":565 + /* "sklearn/tree/_tree.pyx":553 * * n_node_samples_left = 0 * n_node_samples_right = 0 # <<<<<<<<<<<<<< @@ -5697,7 +5708,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_n_node_samples_right = 0; - /* "sklearn/tree/_tree.pyx":566 + /* "sklearn/tree/_tree.pyx":554 * n_node_samples_left = 0 * n_node_samples_right = 0 * weighted_n_node_samples_left = 0.0 # <<<<<<<<<<<<<< @@ -5706,7 +5717,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_weighted_n_node_samples_left = 0.0; - /* "sklearn/tree/_tree.pyx":567 + /* "sklearn/tree/_tree.pyx":555 * n_node_samples_right = 0 * weighted_n_node_samples_left = 0.0 * weighted_n_node_samples_right = 0.0 # <<<<<<<<<<<<<< @@ -5715,7 +5726,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_weighted_n_node_samples_right = 0.0; - /* "sklearn/tree/_tree.pyx":569 + /* "sklearn/tree/_tree.pyx":557 * weighted_n_node_samples_right = 0.0 * * for i from 0 <= i < n_total_samples: # <<<<<<<<<<<<<< @@ -5725,7 +5736,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __pyx_t_3 = __pyx_v_n_total_samples; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) { - /* "sklearn/tree/_tree.pyx":570 + /* "sklearn/tree/_tree.pyx":558 * * for i from 0 <= i < n_total_samples: * if sample_mask_ptr[i]: # <<<<<<<<<<<<<< @@ -5734,7 +5745,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ if ((__pyx_v_sample_mask_ptr[__pyx_v_i])) { - /* "sklearn/tree/_tree.pyx":571 + /* "sklearn/tree/_tree.pyx":559 * for i from 0 <= i < n_total_samples: * if sample_mask_ptr[i]: * if sample_weight_ptr != NULL: # <<<<<<<<<<<<<< @@ -5744,7 +5755,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __pyx_t_4 = (__pyx_v_sample_weight_ptr != NULL); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":572 + /* "sklearn/tree/_tree.pyx":560 * if sample_mask_ptr[i]: * if sample_weight_ptr != NULL: * w = sample_weight_ptr[i] # <<<<<<<<<<<<<< @@ -5756,7 +5767,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } __pyx_L13:; - /* "sklearn/tree/_tree.pyx":573 + /* "sklearn/tree/_tree.pyx":561 * if sample_weight_ptr != NULL: * w = sample_weight_ptr[i] * if X_ptr[i] <= threshold: # <<<<<<<<<<<<<< @@ -5766,7 +5777,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __pyx_t_4 = ((__pyx_v_X_ptr[__pyx_v_i]) <= __pyx_v_threshold); if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":574 + /* "sklearn/tree/_tree.pyx":562 * w = sample_weight_ptr[i] * if X_ptr[i] <= threshold: * sample_mask_left_ptr[i] = 1 # <<<<<<<<<<<<<< @@ -5775,7 +5786,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ (__pyx_v_sample_mask_left_ptr[__pyx_v_i]) = 1; - /* "sklearn/tree/_tree.pyx":575 + /* "sklearn/tree/_tree.pyx":563 * if X_ptr[i] <= threshold: * sample_mask_left_ptr[i] = 1 * n_node_samples_left += 1 # <<<<<<<<<<<<<< @@ -5784,7 +5795,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_n_node_samples_left = (__pyx_v_n_node_samples_left + 1); - /* "sklearn/tree/_tree.pyx":576 + /* "sklearn/tree/_tree.pyx":564 * sample_mask_left_ptr[i] = 1 * n_node_samples_left += 1 * weighted_n_node_samples_left += w # <<<<<<<<<<<<<< @@ -5796,7 +5807,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx } /*else*/ { - /* "sklearn/tree/_tree.pyx":578 + /* "sklearn/tree/_tree.pyx":566 * weighted_n_node_samples_left += w * else: * sample_mask_right_ptr[i] = 1 # <<<<<<<<<<<<<< @@ -5805,7 +5816,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ (__pyx_v_sample_mask_right_ptr[__pyx_v_i]) = 1; - /* "sklearn/tree/_tree.pyx":579 + /* "sklearn/tree/_tree.pyx":567 * else: * sample_mask_right_ptr[i] = 1 * n_node_samples_right += 1 # <<<<<<<<<<<<<< @@ -5814,7 +5825,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_n_node_samples_right = (__pyx_v_n_node_samples_right + 1); - /* "sklearn/tree/_tree.pyx":580 + /* "sklearn/tree/_tree.pyx":568 * sample_mask_right_ptr[i] = 1 * n_node_samples_right += 1 * weighted_n_node_samples_right += w # <<<<<<<<<<<<<< @@ -5829,7 +5840,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __pyx_L12:; } - /* "sklearn/tree/_tree.pyx":584 + /* "sklearn/tree/_tree.pyx":572 * node_id = self.add_split_node(parent, is_left_child, feature, * threshold, buffer_value, best_error, * init_error, n_node_samples) # <<<<<<<<<<<<<< @@ -5838,29 +5849,29 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx */ __pyx_v_node_id = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->add_split_node(__pyx_v_self, __pyx_v_parent, __pyx_v_is_left_child, __pyx_v_feature, __pyx_v_threshold, __pyx_v_buffer_value, __pyx_v_best_error, __pyx_v_init_error, __pyx_v_n_node_samples); - /* "sklearn/tree/_tree.pyx":593 + /* "sklearn/tree/_tree.pyx":581 * weighted_n_node_samples_left, * depth + 1, node_id, * True, buffer_value) # <<<<<<<<<<<<<< * * # Right child recursion */ - ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->recursive_partition(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_X_argsorted), ((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_sample_weight), __pyx_v_sample_mask_left, __pyx_v_n_node_samples_left, __pyx_v_weighted_n_node_samples_left, (__pyx_v_depth + 1), __pyx_v_node_id, 1, __pyx_v_buffer_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->recursive_partition(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_X_argsorted), ((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_sample_weight), __pyx_v_sample_mask_left, __pyx_v_n_node_samples_left, __pyx_v_weighted_n_node_samples_left, (__pyx_v_depth + 1), __pyx_v_node_id, 1, __pyx_v_buffer_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/tree/_tree.pyx":602 + /* "sklearn/tree/_tree.pyx":590 * weighted_n_node_samples_right, * depth + 1, node_id, * False, buffer_value) # <<<<<<<<<<<<<< * * cdef int add_split_node(self, int parent, int is_left_child, int feature, */ - ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->recursive_partition(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_X_argsorted), ((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_sample_weight), __pyx_v_sample_mask_right, __pyx_v_n_node_samples_right, __pyx_v_weighted_n_node_samples_right, (__pyx_v_depth + 1), __pyx_v_node_id, 0, __pyx_v_buffer_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Tree *)__pyx_v_self->__pyx_vtab)->recursive_partition(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_X_argsorted), ((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_sample_weight), __pyx_v_sample_mask_right, __pyx_v_n_node_samples_right, __pyx_v_weighted_n_node_samples_right, (__pyx_v_depth + 1), __pyx_v_node_id, 0, __pyx_v_buffer_value); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L7:; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); @@ -5891,7 +5902,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_recursive_partition(struct __pyx __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":604 +/* "sklearn/tree/_tree.pyx":592 * False, buffer_value) * * cdef int add_split_node(self, int parent, int is_left_child, int feature, # <<<<<<<<<<<<<< @@ -5905,28 +5916,30 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("add_split_node", 0); - /* "sklearn/tree/_tree.pyx":610 + /* "sklearn/tree/_tree.pyx":598 * """Add a splitting node to the tree. The new node registers itself as * the child of its parent. """ * cdef int node_id = self.node_count # <<<<<<<<<<<<<< * * if node_id >= self.capacity: */ - __pyx_v_node_id = __pyx_v_self->node_count; + __pyx_t_1 = __pyx_v_self->node_count; + __pyx_v_node_id = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":612 + /* "sklearn/tree/_tree.pyx":600 * cdef int node_id = self.node_count * * if node_id >= self.capacity: # <<<<<<<<<<<<<< * self.resize() * */ - __pyx_t_1 = (__pyx_v_node_id >= __pyx_v_self->capacity); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_node_id >= __pyx_v_self->capacity); + if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":613 + /* "sklearn/tree/_tree.pyx":601 * * if node_id >= self.capacity: * self.resize() # <<<<<<<<<<<<<< @@ -5938,7 +5951,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":615 + /* "sklearn/tree/_tree.pyx":603 * self.resize() * * self.feature[node_id] = feature # <<<<<<<<<<<<<< @@ -5947,7 +5960,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 */ (__pyx_v_self->feature[__pyx_v_node_id]) = __pyx_v_feature; - /* "sklearn/tree/_tree.pyx":616 + /* "sklearn/tree/_tree.pyx":604 * * self.feature[node_id] = feature * self.threshold[node_id] = threshold # <<<<<<<<<<<<<< @@ -5956,7 +5969,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 */ (__pyx_v_self->threshold[__pyx_v_node_id]) = __pyx_v_threshold; - /* "sklearn/tree/_tree.pyx":618 + /* "sklearn/tree/_tree.pyx":606 * self.threshold[node_id] = threshold * * cdef int offset_node = node_id * self.value_stride # <<<<<<<<<<<<<< @@ -5965,7 +5978,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 */ __pyx_v_offset_node = (__pyx_v_node_id * __pyx_v_self->value_stride); - /* "sklearn/tree/_tree.pyx":619 + /* "sklearn/tree/_tree.pyx":607 * * cdef int offset_node = node_id * self.value_stride * memcpy(self.value + offset_node, value, self.value_stride * sizeof(double)) # <<<<<<<<<<<<<< @@ -5974,7 +5987,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 */ memcpy((__pyx_v_self->value + __pyx_v_offset_node), __pyx_v_value, (__pyx_v_self->value_stride * (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":621 + /* "sklearn/tree/_tree.pyx":609 * memcpy(self.value + offset_node, value, self.value_stride * sizeof(double)) * * self.init_error[node_id] = init_error # <<<<<<<<<<<<<< @@ -5983,7 +5996,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 */ (__pyx_v_self->init_error[__pyx_v_node_id]) = __pyx_v_init_error; - /* "sklearn/tree/_tree.pyx":622 + /* "sklearn/tree/_tree.pyx":610 * * self.init_error[node_id] = init_error * self.best_error[node_id] = best_error # <<<<<<<<<<<<<< @@ -5992,7 +6005,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 */ (__pyx_v_self->best_error[__pyx_v_node_id]) = __pyx_v_best_error; - /* "sklearn/tree/_tree.pyx":623 + /* "sklearn/tree/_tree.pyx":611 * self.init_error[node_id] = init_error * self.best_error[node_id] = best_error * self.n_samples[node_id] = n_samples # <<<<<<<<<<<<<< @@ -6001,17 +6014,17 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 */ (__pyx_v_self->n_samples[__pyx_v_node_id]) = __pyx_v_n_samples; - /* "sklearn/tree/_tree.pyx":626 + /* "sklearn/tree/_tree.pyx":614 * * # set as left or right child of parent * if parent > _TREE_LEAF: # <<<<<<<<<<<<<< * if is_left_child: * self.children_left[parent] = node_id */ - __pyx_t_1 = (__pyx_v_parent > __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_parent > __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF); + if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":627 + /* "sklearn/tree/_tree.pyx":615 * # set as left or right child of parent * if parent > _TREE_LEAF: * if is_left_child: # <<<<<<<<<<<<<< @@ -6020,7 +6033,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 */ if (__pyx_v_is_left_child) { - /* "sklearn/tree/_tree.pyx":628 + /* "sklearn/tree/_tree.pyx":616 * if parent > _TREE_LEAF: * if is_left_child: * self.children_left[parent] = node_id # <<<<<<<<<<<<<< @@ -6032,7 +6045,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 } /*else*/ { - /* "sklearn/tree/_tree.pyx":630 + /* "sklearn/tree/_tree.pyx":618 * self.children_left[parent] = node_id * else: * self.children_right[parent] = node_id # <<<<<<<<<<<<<< @@ -6046,7 +6059,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":632 + /* "sklearn/tree/_tree.pyx":620 * self.children_right[parent] = node_id * * self.node_count += 1 # <<<<<<<<<<<<<< @@ -6055,7 +6068,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 */ __pyx_v_self->node_count = (__pyx_v_self->node_count + 1); - /* "sklearn/tree/_tree.pyx":634 + /* "sklearn/tree/_tree.pyx":622 * self.node_count += 1 * * return node_id # <<<<<<<<<<<<<< @@ -6071,7 +6084,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_split_node(struct __pyx_obj_7 return __pyx_r; } -/* "sklearn/tree/_tree.pyx":636 +/* "sklearn/tree/_tree.pyx":624 * return node_id * * cdef int add_leaf(self, int parent, int is_left_child, double* value, # <<<<<<<<<<<<<< @@ -6085,28 +6098,30 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("add_leaf", 0); - /* "sklearn/tree/_tree.pyx":640 + /* "sklearn/tree/_tree.pyx":628 * """Add a leaf to the tree. The new node registers itself as the * child of its parent. """ * cdef int node_id = self.node_count # <<<<<<<<<<<<<< * * if node_id >= self.capacity: */ - __pyx_v_node_id = __pyx_v_self->node_count; + __pyx_t_1 = __pyx_v_self->node_count; + __pyx_v_node_id = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":642 + /* "sklearn/tree/_tree.pyx":630 * cdef int node_id = self.node_count * * if node_id >= self.capacity: # <<<<<<<<<<<<<< * self.resize() * */ - __pyx_t_1 = (__pyx_v_node_id >= __pyx_v_self->capacity); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_node_id >= __pyx_v_self->capacity); + if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":643 + /* "sklearn/tree/_tree.pyx":631 * * if node_id >= self.capacity: * self.resize() # <<<<<<<<<<<<<< @@ -6118,7 +6133,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":645 + /* "sklearn/tree/_tree.pyx":633 * self.resize() * * cdef int offset_node = node_id * self.n_outputs * self.max_n_classes # <<<<<<<<<<<<<< @@ -6127,7 +6142,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear */ __pyx_v_offset_node = ((__pyx_v_node_id * __pyx_v_self->n_outputs) * __pyx_v_self->max_n_classes); - /* "sklearn/tree/_tree.pyx":646 + /* "sklearn/tree/_tree.pyx":634 * * cdef int offset_node = node_id * self.n_outputs * self.max_n_classes * memcpy(self.value + offset_node, value, self.value_stride * sizeof(double)) # <<<<<<<<<<<<<< @@ -6136,7 +6151,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear */ memcpy((__pyx_v_self->value + __pyx_v_offset_node), __pyx_v_value, (__pyx_v_self->value_stride * (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":648 + /* "sklearn/tree/_tree.pyx":636 * memcpy(self.value + offset_node, value, self.value_stride * sizeof(double)) * * self.init_error[node_id] = error # <<<<<<<<<<<<<< @@ -6145,7 +6160,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear */ (__pyx_v_self->init_error[__pyx_v_node_id]) = __pyx_v_error; - /* "sklearn/tree/_tree.pyx":649 + /* "sklearn/tree/_tree.pyx":637 * * self.init_error[node_id] = error * self.best_error[node_id] = error # <<<<<<<<<<<<<< @@ -6154,7 +6169,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear */ (__pyx_v_self->best_error[__pyx_v_node_id]) = __pyx_v_error; - /* "sklearn/tree/_tree.pyx":650 + /* "sklearn/tree/_tree.pyx":638 * self.init_error[node_id] = error * self.best_error[node_id] = error * self.n_samples[node_id] = n_samples # <<<<<<<<<<<<<< @@ -6163,17 +6178,17 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear */ (__pyx_v_self->n_samples[__pyx_v_node_id]) = __pyx_v_n_samples; - /* "sklearn/tree/_tree.pyx":652 + /* "sklearn/tree/_tree.pyx":640 * self.n_samples[node_id] = n_samples * * if parent >= 0: # <<<<<<<<<<<<<< * if is_left_child: * self.children_left[parent] = node_id */ - __pyx_t_1 = (__pyx_v_parent >= 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_parent >= 0); + if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":653 + /* "sklearn/tree/_tree.pyx":641 * * if parent >= 0: * if is_left_child: # <<<<<<<<<<<<<< @@ -6182,7 +6197,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear */ if (__pyx_v_is_left_child) { - /* "sklearn/tree/_tree.pyx":654 + /* "sklearn/tree/_tree.pyx":642 * if parent >= 0: * if is_left_child: * self.children_left[parent] = node_id # <<<<<<<<<<<<<< @@ -6194,7 +6209,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear } /*else*/ { - /* "sklearn/tree/_tree.pyx":656 + /* "sklearn/tree/_tree.pyx":644 * self.children_left[parent] = node_id * else: * self.children_right[parent] = node_id # <<<<<<<<<<<<<< @@ -6208,7 +6223,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":658 + /* "sklearn/tree/_tree.pyx":646 * self.children_right[parent] = node_id * * self.children_left[node_id] = _TREE_LEAF # <<<<<<<<<<<<<< @@ -6217,7 +6232,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear */ (__pyx_v_self->children_left[__pyx_v_node_id]) = __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF; - /* "sklearn/tree/_tree.pyx":659 + /* "sklearn/tree/_tree.pyx":647 * * self.children_left[node_id] = _TREE_LEAF * self.children_right[node_id] = _TREE_LEAF # <<<<<<<<<<<<<< @@ -6226,7 +6241,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear */ (__pyx_v_self->children_right[__pyx_v_node_id]) = __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF; - /* "sklearn/tree/_tree.pyx":661 + /* "sklearn/tree/_tree.pyx":649 * self.children_right[node_id] = _TREE_LEAF * * self.node_count += 1 # <<<<<<<<<<<<<< @@ -6235,7 +6250,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear */ __pyx_v_self->node_count = (__pyx_v_self->node_count + 1); - /* "sklearn/tree/_tree.pyx":663 + /* "sklearn/tree/_tree.pyx":651 * self.node_count += 1 * * return node_id # <<<<<<<<<<<<<< @@ -6251,7 +6266,7 @@ static int __pyx_f_7sklearn_4tree_5_tree_4Tree_add_leaf(struct __pyx_obj_7sklear return __pyx_r; } -/* "sklearn/tree/_tree.pyx":665 +/* "sklearn/tree/_tree.pyx":653 * return node_id * * cdef void find_split(self, DTYPE_t* X_ptr, int X_stride, # <<<<<<<<<<<<<< @@ -6264,7 +6279,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_split(struct __pyx_obj_7skl int __pyx_t_1; __Pyx_RefNannySetupContext("find_split", 0); - /* "sklearn/tree/_tree.pyx":677 + /* "sklearn/tree/_tree.pyx":665 * double* _initial_error): * """Find the best dimension and threshold that minimises the error.""" * if self.find_split_algorithm == _TREE_SPLIT_BEST: # <<<<<<<<<<<<<< @@ -6274,7 +6289,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_split(struct __pyx_obj_7skl __pyx_t_1 = (__pyx_v_self->find_split_algorithm == __pyx_v_7sklearn_4tree_5_tree__TREE_SPLIT_BEST); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":686 + /* "sklearn/tree/_tree.pyx":674 * weighted_n_node_samples, * n_total_samples, _best_i, _best_t, * _best_error, _initial_error) # <<<<<<<<<<<<<< @@ -6285,7 +6300,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_split(struct __pyx_obj_7skl goto __pyx_L3; } - /* "sklearn/tree/_tree.pyx":688 + /* "sklearn/tree/_tree.pyx":676 * _best_error, _initial_error) * * elif self.find_split_algorithm == _TREE_SPLIT_RANDOM: # <<<<<<<<<<<<<< @@ -6295,7 +6310,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_split(struct __pyx_obj_7skl __pyx_t_1 = (__pyx_v_self->find_split_algorithm == __pyx_v_7sklearn_4tree_5_tree__TREE_SPLIT_RANDOM); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":697 + /* "sklearn/tree/_tree.pyx":685 * weighted_n_node_samples, * n_total_samples, _best_i, _best_t, * _best_error, _initial_error) # <<<<<<<<<<<<<< @@ -6310,7 +6325,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_split(struct __pyx_obj_7skl __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":699 +/* "sklearn/tree/_tree.pyx":687 * _best_error, _initial_error) * * cdef void find_best_split(self, DTYPE_t* X_ptr, int X_stride, # <<<<<<<<<<<<<< @@ -6344,15 +6359,15 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj __Pyx_LocalBuf_ND __pyx_pybuffernd_features; __Pyx_Buffer __pyx_pybuffer_features; __Pyx_RefNannyDeclarations - PyArrayObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - __pyx_t_5numpy_int32_t __pyx_t_9; + __pyx_t_5numpy_int32_t __pyx_t_8; + int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6362,35 +6377,39 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj __pyx_pybuffernd_features.data = NULL; __pyx_pybuffernd_features.rcbuffer = &__pyx_pybuffer_features; - /* "sklearn/tree/_tree.pyx":711 + /* "sklearn/tree/_tree.pyx":699 * """Implementation of `find_split` that looks for the best threshold.""" * # Variables declarations * cdef Criterion criterion = self.criterion # <<<<<<<<<<<<<< * cdef int n_features = self.n_features * cdef int max_features = self.max_features */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->criterion)); - __pyx_v_criterion = __pyx_v_self->criterion; + __pyx_t_1 = ((PyObject *)__pyx_v_self->criterion); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)__pyx_t_1); + __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":712 + /* "sklearn/tree/_tree.pyx":700 * # Variables declarations * cdef Criterion criterion = self.criterion * cdef int n_features = self.n_features # <<<<<<<<<<<<<< * cdef int max_features = self.max_features * cdef int visited_features = 0 */ - __pyx_v_n_features = __pyx_v_self->n_features; + __pyx_t_2 = __pyx_v_self->n_features; + __pyx_v_n_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":713 + /* "sklearn/tree/_tree.pyx":701 * cdef Criterion criterion = self.criterion * cdef int n_features = self.n_features * cdef int max_features = self.max_features # <<<<<<<<<<<<<< * cdef int visited_features = 0 * cdef int min_samples_leaf = self.min_samples_leaf */ - __pyx_v_max_features = __pyx_v_self->max_features; + __pyx_t_2 = __pyx_v_self->max_features; + __pyx_v_max_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":714 + /* "sklearn/tree/_tree.pyx":702 * cdef int n_features = self.n_features * cdef int max_features = self.max_features * cdef int visited_features = 0 # <<<<<<<<<<<<<< @@ -6399,26 +6418,29 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_visited_features = 0; - /* "sklearn/tree/_tree.pyx":715 + /* "sklearn/tree/_tree.pyx":703 * cdef int max_features = self.max_features * cdef int visited_features = 0 * cdef int min_samples_leaf = self.min_samples_leaf # <<<<<<<<<<<<<< * cdef object random_state = self.random_state * */ - __pyx_v_min_samples_leaf = __pyx_v_self->min_samples_leaf; + __pyx_t_2 = __pyx_v_self->min_samples_leaf; + __pyx_v_min_samples_leaf = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":716 + /* "sklearn/tree/_tree.pyx":704 * cdef int visited_features = 0 * cdef int min_samples_leaf = self.min_samples_leaf * cdef object random_state = self.random_state # <<<<<<<<<<<<<< * * cdef int i, a, b, best_i = -1 */ - __Pyx_INCREF(__pyx_v_self->random_state); - __pyx_v_random_state = __pyx_v_self->random_state; + __pyx_t_1 = __pyx_v_self->random_state; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_random_state = __pyx_t_1; + __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":718 + /* "sklearn/tree/_tree.pyx":706 * cdef object random_state = self.random_state * * cdef int i, a, b, best_i = -1 # <<<<<<<<<<<<<< @@ -6427,7 +6449,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_best_i = -1; - /* "sklearn/tree/_tree.pyx":719 + /* "sklearn/tree/_tree.pyx":707 * * cdef int i, a, b, best_i = -1 * cdef np.int32_t feature_idx = -1 # <<<<<<<<<<<<<< @@ -6436,7 +6458,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_feature_idx = -1; - /* "sklearn/tree/_tree.pyx":720 + /* "sklearn/tree/_tree.pyx":708 * cdef int i, a, b, best_i = -1 * cdef np.int32_t feature_idx = -1 * cdef int n_left = 0 # <<<<<<<<<<<<<< @@ -6445,7 +6467,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_n_left = 0; - /* "sklearn/tree/_tree.pyx":723 + /* "sklearn/tree/_tree.pyx":711 * * cdef double t, initial_error, error * cdef double best_error = INFINITY, best_t = INFINITY # <<<<<<<<<<<<<< @@ -6455,7 +6477,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj __pyx_v_best_error = __pyx_v_7sklearn_4tree_5_tree_INFINITY; __pyx_v_best_t = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":725 + /* "sklearn/tree/_tree.pyx":713 * cdef double best_error = INFINITY, best_t = INFINITY * * cdef DTYPE_t* X_i = NULL # <<<<<<<<<<<<<< @@ -6464,7 +6486,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_X_i = NULL; - /* "sklearn/tree/_tree.pyx":726 + /* "sklearn/tree/_tree.pyx":714 * * cdef DTYPE_t* X_i = NULL * cdef int* X_argsorted_i = NULL # <<<<<<<<<<<<<< @@ -6473,27 +6495,27 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_X_argsorted_i = NULL; - /* "sklearn/tree/_tree.pyx":729 + /* "sklearn/tree/_tree.pyx":717 * cdef DTYPE_t X_a, X_b * * cdef np.ndarray[np.int32_t, ndim=1, mode="c"] features = self.features # <<<<<<<<<<<<<< * * # Compute the initial criterion value in the node */ - __pyx_t_1 = ((PyArrayObject *)__pyx_v_self->features); + __pyx_t_1 = ((PyObject *)__pyx_v_self->features); + __Pyx_INCREF(__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_features.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_features.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_features = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_features.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_features.diminfo[0].strides = __pyx_pybuffernd_features.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_features.diminfo[0].shape = __pyx_pybuffernd_features.rcbuffer->pybuffer.shape[0]; } } + __pyx_v_features = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->features)); - __pyx_v_features = ((PyArrayObject *)__pyx_v_self->features); - /* "sklearn/tree/_tree.pyx":737 + /* "sklearn/tree/_tree.pyx":725 * n_node_samples, * weighted_n_node_samples, * n_total_samples) # <<<<<<<<<<<<<< @@ -6502,7 +6524,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->init(__pyx_v_criterion, __pyx_v_y_ptr, __pyx_v_y_stride, __pyx_v_sample_weight_ptr, __pyx_v_sample_mask_ptr, __pyx_v_n_node_samples, __pyx_v_weighted_n_node_samples, __pyx_v_n_total_samples); - /* "sklearn/tree/_tree.pyx":738 + /* "sklearn/tree/_tree.pyx":726 * weighted_n_node_samples, * n_total_samples) * initial_error = criterion.eval() # <<<<<<<<<<<<<< @@ -6511,17 +6533,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_initial_error = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->eval(__pyx_v_criterion); - /* "sklearn/tree/_tree.pyx":740 + /* "sklearn/tree/_tree.pyx":728 * initial_error = criterion.eval() * * if initial_error == 0: # break early if the node is pure # <<<<<<<<<<<<<< * _best_i[0] = best_i * _best_t[0] = best_t */ - __pyx_t_2 = (__pyx_v_initial_error == 0.0); - if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_initial_error == 0.0); + if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":741 + /* "sklearn/tree/_tree.pyx":729 * * if initial_error == 0: # break early if the node is pure * _best_i[0] = best_i # <<<<<<<<<<<<<< @@ -6530,7 +6552,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ (__pyx_v__best_i[0]) = __pyx_v_best_i; - /* "sklearn/tree/_tree.pyx":742 + /* "sklearn/tree/_tree.pyx":730 * if initial_error == 0: # break early if the node is pure * _best_i[0] = best_i * _best_t[0] = best_t # <<<<<<<<<<<<<< @@ -6539,7 +6561,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ (__pyx_v__best_t[0]) = __pyx_v_best_t; - /* "sklearn/tree/_tree.pyx":743 + /* "sklearn/tree/_tree.pyx":731 * _best_i[0] = best_i * _best_t[0] = best_t * _best_error[0] = initial_error # <<<<<<<<<<<<<< @@ -6548,7 +6570,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ (__pyx_v__best_error[0]) = __pyx_v_initial_error; - /* "sklearn/tree/_tree.pyx":744 + /* "sklearn/tree/_tree.pyx":732 * _best_t[0] = best_t * _best_error[0] = initial_error * _initial_error[0] = initial_error # <<<<<<<<<<<<<< @@ -6557,7 +6579,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ (__pyx_v__initial_error[0]) = __pyx_v_initial_error; - /* "sklearn/tree/_tree.pyx":746 + /* "sklearn/tree/_tree.pyx":734 * _initial_error[0] = initial_error * * return # <<<<<<<<<<<<<< @@ -6569,23 +6591,23 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":749 + /* "sklearn/tree/_tree.pyx":737 * * # Features to consider * if max_features < 0 or max_features >= n_features: # <<<<<<<<<<<<<< * max_features = n_features * else: */ - __pyx_t_2 = (__pyx_v_max_features < 0); - if (!__pyx_t_2) { - __pyx_t_3 = (__pyx_v_max_features >= __pyx_v_n_features); - __pyx_t_4 = __pyx_t_3; + __pyx_t_3 = (__pyx_v_max_features < 0); + if (!__pyx_t_3) { + __pyx_t_4 = (__pyx_v_max_features >= __pyx_v_n_features); + __pyx_t_5 = __pyx_t_4; } else { - __pyx_t_4 = __pyx_t_2; + __pyx_t_5 = __pyx_t_3; } - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":750 + /* "sklearn/tree/_tree.pyx":738 * # Features to consider * if max_features < 0 or max_features >= n_features: * max_features = n_features # <<<<<<<<<<<<<< @@ -6597,49 +6619,49 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } /*else*/ { - /* "sklearn/tree/_tree.pyx":752 + /* "sklearn/tree/_tree.pyx":740 * max_features = n_features * else: * random_state.shuffle(features) # <<<<<<<<<<<<<< * * # Look for the best split */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_random_state, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __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 = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_random_state, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_v_features)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_features)); __Pyx_GIVEREF(((PyObject *)__pyx_v_features)); - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":755 + /* "sklearn/tree/_tree.pyx":743 * * # Look for the best split * for feature_idx from 0 <= feature_idx < n_features: # <<<<<<<<<<<<<< * i = features[feature_idx] * */ - __pyx_t_8 = __pyx_v_n_features; - for (__pyx_v_feature_idx = 0; __pyx_v_feature_idx < __pyx_t_8; __pyx_v_feature_idx++) { + __pyx_t_2 = __pyx_v_n_features; + for (__pyx_v_feature_idx = 0; __pyx_v_feature_idx < __pyx_t_2; __pyx_v_feature_idx++) { - /* "sklearn/tree/_tree.pyx":756 + /* "sklearn/tree/_tree.pyx":744 * # Look for the best split * for feature_idx from 0 <= feature_idx < n_features: * i = features[feature_idx] # <<<<<<<<<<<<<< * * # Get i-th col of X and X_sorted */ - __pyx_t_9 = __pyx_v_feature_idx; - __pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_features.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_features.diminfo[0].strides)); + __pyx_t_8 = __pyx_v_feature_idx; + __pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_features.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_features.diminfo[0].strides)); - /* "sklearn/tree/_tree.pyx":759 + /* "sklearn/tree/_tree.pyx":747 * * # Get i-th col of X and X_sorted * X_i = X_ptr + X_stride * i # <<<<<<<<<<<<<< @@ -6648,7 +6670,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_X_i = (__pyx_v_X_ptr + (__pyx_v_X_stride * __pyx_v_i)); - /* "sklearn/tree/_tree.pyx":760 + /* "sklearn/tree/_tree.pyx":748 * # Get i-th col of X and X_sorted * X_i = X_ptr + X_stride * i * X_argsorted_i = X_argsorted_ptr + X_argsorted_stride * i # <<<<<<<<<<<<<< @@ -6657,7 +6679,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_X_argsorted_i = (__pyx_v_X_argsorted_ptr + (__pyx_v_X_argsorted_stride * __pyx_v_i)); - /* "sklearn/tree/_tree.pyx":763 + /* "sklearn/tree/_tree.pyx":751 * * # Reset the criterion for this feature * criterion.reset() # <<<<<<<<<<<<<< @@ -6666,7 +6688,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->reset(__pyx_v_criterion); - /* "sklearn/tree/_tree.pyx":766 + /* "sklearn/tree/_tree.pyx":754 * * # Index of smallest sample in X_argsorted_i that is in the sample mask * a = 0 # <<<<<<<<<<<<<< @@ -6675,7 +6697,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_a = 0; - /* "sklearn/tree/_tree.pyx":768 + /* "sklearn/tree/_tree.pyx":756 * a = 0 * * while sample_mask_ptr[X_argsorted_i[a]] == 0: # <<<<<<<<<<<<<< @@ -6683,10 +6705,10 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj * */ while (1) { - __pyx_t_4 = ((__pyx_v_sample_mask_ptr[(__pyx_v_X_argsorted_i[__pyx_v_a])]) == 0); - if (!__pyx_t_4) break; + __pyx_t_5 = ((__pyx_v_sample_mask_ptr[(__pyx_v_X_argsorted_i[__pyx_v_a])]) == 0); + if (!__pyx_t_5) break; - /* "sklearn/tree/_tree.pyx":769 + /* "sklearn/tree/_tree.pyx":757 * * while sample_mask_ptr[X_argsorted_i[a]] == 0: * a = a + 1 # <<<<<<<<<<<<<< @@ -6696,7 +6718,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj __pyx_v_a = (__pyx_v_a + 1); } - /* "sklearn/tree/_tree.pyx":773 + /* "sklearn/tree/_tree.pyx":761 * # Check that the feature is not constant * b = _smallest_sample_larger_than(a, X_i, X_argsorted_i, * sample_mask_ptr, n_total_samples) # <<<<<<<<<<<<<< @@ -6705,17 +6727,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_b = __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_than(__pyx_v_a, __pyx_v_X_i, __pyx_v_X_argsorted_i, __pyx_v_sample_mask_ptr, __pyx_v_n_total_samples); - /* "sklearn/tree/_tree.pyx":775 + /* "sklearn/tree/_tree.pyx":763 * sample_mask_ptr, n_total_samples) * * if b == -1: # <<<<<<<<<<<<<< * continue # Skip that feature and don't count it as visited * */ - __pyx_t_4 = (__pyx_v_b == -1); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_b == -1); + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":776 + /* "sklearn/tree/_tree.pyx":764 * * if b == -1: * continue # Skip that feature and don't count it as visited # <<<<<<<<<<<<<< @@ -6727,7 +6749,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } __pyx_L9:; - /* "sklearn/tree/_tree.pyx":779 + /* "sklearn/tree/_tree.pyx":767 * * # Consider splits between two consecutive samples * while True: # <<<<<<<<<<<<<< @@ -6737,7 +6759,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj while (1) { if (!1) break; - /* "sklearn/tree/_tree.pyx":782 + /* "sklearn/tree/_tree.pyx":770 * # Find the following larger sample * b = _smallest_sample_larger_than(a, X_i, X_argsorted_i, * sample_mask_ptr, n_total_samples) # <<<<<<<<<<<<<< @@ -6746,17 +6768,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_b = __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_than(__pyx_v_a, __pyx_v_X_i, __pyx_v_X_argsorted_i, __pyx_v_sample_mask_ptr, __pyx_v_n_total_samples); - /* "sklearn/tree/_tree.pyx":783 + /* "sklearn/tree/_tree.pyx":771 * b = _smallest_sample_larger_than(a, X_i, X_argsorted_i, * sample_mask_ptr, n_total_samples) * if b == -1: # <<<<<<<<<<<<<< * break * */ - __pyx_t_4 = (__pyx_v_b == -1); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_b == -1); + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":784 + /* "sklearn/tree/_tree.pyx":772 * sample_mask_ptr, n_total_samples) * if b == -1: * break # <<<<<<<<<<<<<< @@ -6768,31 +6790,31 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } __pyx_L12:; - /* "sklearn/tree/_tree.pyx":790 - * X_argsorted_i, - * sample_weight_ptr, - * sample_mask_ptr): # <<<<<<<<<<<<<< + /* "sklearn/tree/_tree.pyx":779 + * X_argsorted_i, + * sample_weight_ptr, + * sample_mask_ptr): # <<<<<<<<<<<<<< * a = b * continue */ - __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->update(__pyx_v_criterion, __pyx_v_a, __pyx_v_b, __pyx_v_y_ptr, __pyx_v_y_stride, __pyx_v_X_argsorted_i, __pyx_v_sample_weight_ptr, __pyx_v_sample_mask_ptr)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->update(__pyx_v_criterion, __pyx_v_a, __pyx_v_b, __pyx_v_y_ptr, __pyx_v_y_stride, __pyx_v_X_argsorted_i, __pyx_v_sample_weight_ptr, __pyx_v_sample_mask_ptr)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_2 = (!__pyx_t_4); - if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_t_5); + if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":791 - * sample_weight_ptr, - * sample_mask_ptr): + /* "sklearn/tree/_tree.pyx":780 + * sample_weight_ptr, + * sample_mask_ptr): * a = b # <<<<<<<<<<<<<< * continue * */ __pyx_v_a = __pyx_v_b; - /* "sklearn/tree/_tree.pyx":792 - * sample_mask_ptr): + /* "sklearn/tree/_tree.pyx":781 + * sample_mask_ptr): * a = b * continue # <<<<<<<<<<<<<< * @@ -6803,40 +6825,41 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } __pyx_L13:; - /* "sklearn/tree/_tree.pyx":795 + /* "sklearn/tree/_tree.pyx":784 * * # Only consider splits that respect min_leaf * n_left = criterion.n_left # <<<<<<<<<<<<<< * if (n_left < min_samples_leaf or * (n_node_samples - n_left) < min_samples_leaf): */ - __pyx_v_n_left = __pyx_v_criterion->n_left; + __pyx_t_9 = __pyx_v_criterion->n_left; + __pyx_v_n_left = __pyx_t_9; - /* "sklearn/tree/_tree.pyx":796 + /* "sklearn/tree/_tree.pyx":785 * # Only consider splits that respect min_leaf * n_left = criterion.n_left * if (n_left < min_samples_leaf or # <<<<<<<<<<<<<< * (n_node_samples - n_left) < min_samples_leaf): * a = b */ - __pyx_t_2 = (__pyx_v_n_left < __pyx_v_min_samples_leaf); - if (!__pyx_t_2) { + __pyx_t_3 = (__pyx_v_n_left < __pyx_v_min_samples_leaf); + if (!__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":797 + /* "sklearn/tree/_tree.pyx":786 * n_left = criterion.n_left * if (n_left < min_samples_leaf or * (n_node_samples - n_left) < min_samples_leaf): # <<<<<<<<<<<<<< * a = b * continue */ - __pyx_t_4 = ((__pyx_v_n_node_samples - __pyx_v_n_left) < __pyx_v_min_samples_leaf); - __pyx_t_3 = __pyx_t_4; + __pyx_t_5 = ((__pyx_v_n_node_samples - __pyx_v_n_left) < __pyx_v_min_samples_leaf); + __pyx_t_4 = __pyx_t_5; } else { - __pyx_t_3 = __pyx_t_2; + __pyx_t_4 = __pyx_t_3; } - if (__pyx_t_3) { + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":798 + /* "sklearn/tree/_tree.pyx":787 * if (n_left < min_samples_leaf or * (n_node_samples - n_left) < min_samples_leaf): * a = b # <<<<<<<<<<<<<< @@ -6845,7 +6868,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_a = __pyx_v_b; - /* "sklearn/tree/_tree.pyx":799 + /* "sklearn/tree/_tree.pyx":788 * (n_node_samples - n_left) < min_samples_leaf): * a = b * continue # <<<<<<<<<<<<<< @@ -6857,7 +6880,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } __pyx_L14:; - /* "sklearn/tree/_tree.pyx":801 + /* "sklearn/tree/_tree.pyx":790 * continue * * error = criterion.eval() # <<<<<<<<<<<<<< @@ -6866,17 +6889,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_error = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->eval(__pyx_v_criterion); - /* "sklearn/tree/_tree.pyx":803 + /* "sklearn/tree/_tree.pyx":792 * error = criterion.eval() * * if error < best_error: # <<<<<<<<<<<<<< * X_a = X_i[X_argsorted_i[a]] * X_b = X_i[X_argsorted_i[b]] */ - __pyx_t_3 = (__pyx_v_error < __pyx_v_best_error); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_error < __pyx_v_best_error); + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":804 + /* "sklearn/tree/_tree.pyx":793 * * if error < best_error: * X_a = X_i[X_argsorted_i[a]] # <<<<<<<<<<<<<< @@ -6885,7 +6908,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_X_a = (__pyx_v_X_i[(__pyx_v_X_argsorted_i[__pyx_v_a])]); - /* "sklearn/tree/_tree.pyx":805 + /* "sklearn/tree/_tree.pyx":794 * if error < best_error: * X_a = X_i[X_argsorted_i[a]] * X_b = X_i[X_argsorted_i[b]] # <<<<<<<<<<<<<< @@ -6894,7 +6917,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_X_b = (__pyx_v_X_i[(__pyx_v_X_argsorted_i[__pyx_v_b])]); - /* "sklearn/tree/_tree.pyx":807 + /* "sklearn/tree/_tree.pyx":796 * X_b = X_i[X_argsorted_i[b]] * * t = X_a + (X_b - X_a) / 2.0 # <<<<<<<<<<<<<< @@ -6903,17 +6926,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_t = (__pyx_v_X_a + ((__pyx_v_X_b - __pyx_v_X_a) / 2.0)); - /* "sklearn/tree/_tree.pyx":808 + /* "sklearn/tree/_tree.pyx":797 * * t = X_a + (X_b - X_a) / 2.0 * if t == X_b: # <<<<<<<<<<<<<< * t = X_a * */ - __pyx_t_3 = (__pyx_v_t == __pyx_v_X_b); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_t == __pyx_v_X_b); + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":809 + /* "sklearn/tree/_tree.pyx":798 * t = X_a + (X_b - X_a) / 2.0 * if t == X_b: * t = X_a # <<<<<<<<<<<<<< @@ -6925,7 +6948,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } __pyx_L16:; - /* "sklearn/tree/_tree.pyx":811 + /* "sklearn/tree/_tree.pyx":800 * t = X_a * * best_i = i # <<<<<<<<<<<<<< @@ -6934,7 +6957,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_best_i = __pyx_v_i; - /* "sklearn/tree/_tree.pyx":812 + /* "sklearn/tree/_tree.pyx":801 * * best_i = i * best_t = t # <<<<<<<<<<<<<< @@ -6943,7 +6966,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_best_t = __pyx_v_t; - /* "sklearn/tree/_tree.pyx":813 + /* "sklearn/tree/_tree.pyx":802 * best_i = i * best_t = t * best_error = error # <<<<<<<<<<<<<< @@ -6955,7 +6978,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } __pyx_L15:; - /* "sklearn/tree/_tree.pyx":816 + /* "sklearn/tree/_tree.pyx":805 * * # Proceed to the next interval * a = b # <<<<<<<<<<<<<< @@ -6967,7 +6990,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } __pyx_L11_break:; - /* "sklearn/tree/_tree.pyx":819 + /* "sklearn/tree/_tree.pyx":808 * * # Count one more visited feature * visited_features += 1 # <<<<<<<<<<<<<< @@ -6976,17 +6999,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ __pyx_v_visited_features = (__pyx_v_visited_features + 1); - /* "sklearn/tree/_tree.pyx":821 + /* "sklearn/tree/_tree.pyx":810 * visited_features += 1 * * if visited_features >= max_features: # <<<<<<<<<<<<<< * break * */ - __pyx_t_3 = (__pyx_v_visited_features >= __pyx_v_max_features); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_visited_features >= __pyx_v_max_features); + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":822 + /* "sklearn/tree/_tree.pyx":811 * * if visited_features >= max_features: * break # <<<<<<<<<<<<<< @@ -7001,7 +7024,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj } __pyx_L6_break:; - /* "sklearn/tree/_tree.pyx":824 + /* "sklearn/tree/_tree.pyx":813 * break * * _best_i[0] = best_i # <<<<<<<<<<<<<< @@ -7010,7 +7033,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ (__pyx_v__best_i[0]) = __pyx_v_best_i; - /* "sklearn/tree/_tree.pyx":825 + /* "sklearn/tree/_tree.pyx":814 * * _best_i[0] = best_i * _best_t[0] = best_t # <<<<<<<<<<<<<< @@ -7019,7 +7042,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ (__pyx_v__best_t[0]) = __pyx_v_best_t; - /* "sklearn/tree/_tree.pyx":826 + /* "sklearn/tree/_tree.pyx":815 * _best_i[0] = best_i * _best_t[0] = best_t * _best_error[0] = best_error # <<<<<<<<<<<<<< @@ -7028,7 +7051,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj */ (__pyx_v__best_error[0]) = __pyx_v_best_error; - /* "sklearn/tree/_tree.pyx":827 + /* "sklearn/tree/_tree.pyx":816 * _best_t[0] = best_t * _best_error[0] = best_error * _initial_error[0] = initial_error # <<<<<<<<<<<<<< @@ -7039,7 +7062,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; @@ -7057,7 +7080,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_best_split(struct __pyx_obj __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":829 +/* "sklearn/tree/_tree.pyx":818 * _initial_error[0] = initial_error * * cdef void find_random_split(self, DTYPE_t* X_ptr, int X_stride, # <<<<<<<<<<<<<< @@ -7093,16 +7116,16 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o __Pyx_LocalBuf_ND __pyx_pybuffernd_features; __Pyx_Buffer __pyx_pybuffer_features; __Pyx_RefNannyDeclarations - PyArrayObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - __pyx_t_5numpy_int32_t __pyx_t_9; - double __pyx_t_10; + __pyx_t_5numpy_int32_t __pyx_t_8; + double __pyx_t_9; + int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7112,35 +7135,39 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o __pyx_pybuffernd_features.data = NULL; __pyx_pybuffernd_features.rcbuffer = &__pyx_pybuffer_features; - /* "sklearn/tree/_tree.pyx":842 + /* "sklearn/tree/_tree.pyx":831 * among randomly drawn thresholds at each feature.""" * # Variables declarations * cdef Criterion criterion = self.criterion # <<<<<<<<<<<<<< * cdef int n_features = self.n_features * cdef int max_features = self.max_features */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->criterion)); - __pyx_v_criterion = __pyx_v_self->criterion; + __pyx_t_1 = ((PyObject *)__pyx_v_self->criterion); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_criterion = ((struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *)__pyx_t_1); + __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":843 + /* "sklearn/tree/_tree.pyx":832 * # Variables declarations * cdef Criterion criterion = self.criterion * cdef int n_features = self.n_features # <<<<<<<<<<<<<< * cdef int max_features = self.max_features * cdef int visited_features = 0 */ - __pyx_v_n_features = __pyx_v_self->n_features; + __pyx_t_2 = __pyx_v_self->n_features; + __pyx_v_n_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":844 + /* "sklearn/tree/_tree.pyx":833 * cdef Criterion criterion = self.criterion * cdef int n_features = self.n_features * cdef int max_features = self.max_features # <<<<<<<<<<<<<< * cdef int visited_features = 0 * cdef int min_samples_leaf = self.min_samples_leaf */ - __pyx_v_max_features = __pyx_v_self->max_features; + __pyx_t_2 = __pyx_v_self->max_features; + __pyx_v_max_features = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":845 + /* "sklearn/tree/_tree.pyx":834 * cdef int n_features = self.n_features * cdef int max_features = self.max_features * cdef int visited_features = 0 # <<<<<<<<<<<<<< @@ -7149,26 +7176,29 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_visited_features = 0; - /* "sklearn/tree/_tree.pyx":846 + /* "sklearn/tree/_tree.pyx":835 * cdef int max_features = self.max_features * cdef int visited_features = 0 * cdef int min_samples_leaf = self.min_samples_leaf # <<<<<<<<<<<<<< * cdef object random_state = self.random_state * */ - __pyx_v_min_samples_leaf = __pyx_v_self->min_samples_leaf; + __pyx_t_2 = __pyx_v_self->min_samples_leaf; + __pyx_v_min_samples_leaf = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":847 + /* "sklearn/tree/_tree.pyx":836 * cdef int visited_features = 0 * cdef int min_samples_leaf = self.min_samples_leaf * cdef object random_state = self.random_state # <<<<<<<<<<<<<< * * cdef int i, a, b, c, best_i = -1 */ - __Pyx_INCREF(__pyx_v_self->random_state); - __pyx_v_random_state = __pyx_v_self->random_state; + __pyx_t_1 = __pyx_v_self->random_state; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_random_state = __pyx_t_1; + __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":849 + /* "sklearn/tree/_tree.pyx":838 * cdef object random_state = self.random_state * * cdef int i, a, b, c, best_i = -1 # <<<<<<<<<<<<<< @@ -7177,7 +7207,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_best_i = -1; - /* "sklearn/tree/_tree.pyx":850 + /* "sklearn/tree/_tree.pyx":839 * * cdef int i, a, b, c, best_i = -1 * cdef np.int32_t feature_idx = -1 # <<<<<<<<<<<<<< @@ -7186,7 +7216,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_feature_idx = -1; - /* "sklearn/tree/_tree.pyx":851 + /* "sklearn/tree/_tree.pyx":840 * cdef int i, a, b, c, best_i = -1 * cdef np.int32_t feature_idx = -1 * cdef int n_left = 0 # <<<<<<<<<<<<<< @@ -7195,7 +7225,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_n_left = 0; - /* "sklearn/tree/_tree.pyx":855 + /* "sklearn/tree/_tree.pyx":844 * * cdef double t, initial_error, error * cdef double best_error = INFINITY, best_t = INFINITY # <<<<<<<<<<<<<< @@ -7205,7 +7235,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o __pyx_v_best_error = __pyx_v_7sklearn_4tree_5_tree_INFINITY; __pyx_v_best_t = __pyx_v_7sklearn_4tree_5_tree_INFINITY; - /* "sklearn/tree/_tree.pyx":857 + /* "sklearn/tree/_tree.pyx":846 * cdef double best_error = INFINITY, best_t = INFINITY * * cdef DTYPE_t* X_i = NULL # <<<<<<<<<<<<<< @@ -7214,7 +7244,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_X_i = NULL; - /* "sklearn/tree/_tree.pyx":858 + /* "sklearn/tree/_tree.pyx":847 * * cdef DTYPE_t* X_i = NULL * cdef int* X_argsorted_i = NULL # <<<<<<<<<<<<<< @@ -7223,27 +7253,27 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_X_argsorted_i = NULL; - /* "sklearn/tree/_tree.pyx":861 + /* "sklearn/tree/_tree.pyx":850 * cdef DTYPE_t X_a, X_b * * cdef np.ndarray[np.int32_t, ndim=1, mode="c"] features = self.features # <<<<<<<<<<<<<< * * # Compute the initial criterion value in the node */ - __pyx_t_1 = ((PyArrayObject *)__pyx_v_self->features); + __pyx_t_1 = ((PyObject *)__pyx_v_self->features); + __Pyx_INCREF(__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_features.rcbuffer->pybuffer, (PyObject*)__pyx_t_1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_features.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_features = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_features.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_features.diminfo[0].strides = __pyx_pybuffernd_features.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_features.diminfo[0].shape = __pyx_pybuffernd_features.rcbuffer->pybuffer.shape[0]; } } + __pyx_v_features = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(((PyObject *)__pyx_v_self->features)); - __pyx_v_features = ((PyArrayObject *)__pyx_v_self->features); - /* "sklearn/tree/_tree.pyx":869 + /* "sklearn/tree/_tree.pyx":858 * n_node_samples, * weighted_n_node_samples, * n_total_samples) # <<<<<<<<<<<<<< @@ -7252,7 +7282,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->init(__pyx_v_criterion, __pyx_v_y_ptr, __pyx_v_y_stride, __pyx_v_sample_weight_ptr, __pyx_v_sample_mask_ptr, __pyx_v_n_node_samples, __pyx_v_weighted_n_node_samples, __pyx_v_n_total_samples); - /* "sklearn/tree/_tree.pyx":870 + /* "sklearn/tree/_tree.pyx":859 * weighted_n_node_samples, * n_total_samples) * initial_error = criterion.eval() # <<<<<<<<<<<<<< @@ -7261,17 +7291,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_initial_error = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->eval(__pyx_v_criterion); - /* "sklearn/tree/_tree.pyx":872 + /* "sklearn/tree/_tree.pyx":861 * initial_error = criterion.eval() * * if initial_error == 0: # break early if the node is pure # <<<<<<<<<<<<<< * _best_i[0] = best_i * _best_t[0] = best_t */ - __pyx_t_2 = (__pyx_v_initial_error == 0.0); - if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_initial_error == 0.0); + if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":873 + /* "sklearn/tree/_tree.pyx":862 * * if initial_error == 0: # break early if the node is pure * _best_i[0] = best_i # <<<<<<<<<<<<<< @@ -7280,7 +7310,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ (__pyx_v__best_i[0]) = __pyx_v_best_i; - /* "sklearn/tree/_tree.pyx":874 + /* "sklearn/tree/_tree.pyx":863 * if initial_error == 0: # break early if the node is pure * _best_i[0] = best_i * _best_t[0] = best_t # <<<<<<<<<<<<<< @@ -7289,7 +7319,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ (__pyx_v__best_t[0]) = __pyx_v_best_t; - /* "sklearn/tree/_tree.pyx":875 + /* "sklearn/tree/_tree.pyx":864 * _best_i[0] = best_i * _best_t[0] = best_t * _best_error[0] = initial_error # <<<<<<<<<<<<<< @@ -7298,7 +7328,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ (__pyx_v__best_error[0]) = __pyx_v_initial_error; - /* "sklearn/tree/_tree.pyx":876 + /* "sklearn/tree/_tree.pyx":865 * _best_t[0] = best_t * _best_error[0] = initial_error * _initial_error[0] = initial_error # <<<<<<<<<<<<<< @@ -7307,7 +7337,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ (__pyx_v__initial_error[0]) = __pyx_v_initial_error; - /* "sklearn/tree/_tree.pyx":878 + /* "sklearn/tree/_tree.pyx":867 * _initial_error[0] = initial_error * * return # <<<<<<<<<<<<<< @@ -7319,23 +7349,23 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":881 + /* "sklearn/tree/_tree.pyx":870 * * # Features to consider * if max_features < 0 or max_features >= n_features: # <<<<<<<<<<<<<< * max_features = n_features * else: */ - __pyx_t_2 = (__pyx_v_max_features < 0); - if (!__pyx_t_2) { - __pyx_t_3 = (__pyx_v_max_features >= __pyx_v_n_features); - __pyx_t_4 = __pyx_t_3; + __pyx_t_3 = (__pyx_v_max_features < 0); + if (!__pyx_t_3) { + __pyx_t_4 = (__pyx_v_max_features >= __pyx_v_n_features); + __pyx_t_5 = __pyx_t_4; } else { - __pyx_t_4 = __pyx_t_2; + __pyx_t_5 = __pyx_t_3; } - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":882 + /* "sklearn/tree/_tree.pyx":871 * # Features to consider * if max_features < 0 or max_features >= n_features: * max_features = n_features # <<<<<<<<<<<<<< @@ -7347,49 +7377,49 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } /*else*/ { - /* "sklearn/tree/_tree.pyx":884 + /* "sklearn/tree/_tree.pyx":873 * max_features = n_features * else: * random_state.shuffle(features) # <<<<<<<<<<<<<< * * # Look for the best split */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_random_state, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __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 = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_random_state, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_v_features)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_features)); __Pyx_GIVEREF(((PyObject *)__pyx_v_features)); - __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":887 + /* "sklearn/tree/_tree.pyx":876 * * # Look for the best split * for feature_idx from 0 <= feature_idx < n_features: # <<<<<<<<<<<<<< * i = features[feature_idx] * */ - __pyx_t_8 = __pyx_v_n_features; - for (__pyx_v_feature_idx = 0; __pyx_v_feature_idx < __pyx_t_8; __pyx_v_feature_idx++) { + __pyx_t_2 = __pyx_v_n_features; + for (__pyx_v_feature_idx = 0; __pyx_v_feature_idx < __pyx_t_2; __pyx_v_feature_idx++) { - /* "sklearn/tree/_tree.pyx":888 + /* "sklearn/tree/_tree.pyx":877 * # Look for the best split * for feature_idx from 0 <= feature_idx < n_features: * i = features[feature_idx] # <<<<<<<<<<<<<< * * # Get i-th col of X and X_sorted */ - __pyx_t_9 = __pyx_v_feature_idx; - __pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_features.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_features.diminfo[0].strides)); + __pyx_t_8 = __pyx_v_feature_idx; + __pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_features.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_features.diminfo[0].strides)); - /* "sklearn/tree/_tree.pyx":891 + /* "sklearn/tree/_tree.pyx":880 * * # Get i-th col of X and X_sorted * X_i = X_ptr + X_stride * i # <<<<<<<<<<<<<< @@ -7398,7 +7428,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_X_i = (__pyx_v_X_ptr + (__pyx_v_X_stride * __pyx_v_i)); - /* "sklearn/tree/_tree.pyx":892 + /* "sklearn/tree/_tree.pyx":881 * # Get i-th col of X and X_sorted * X_i = X_ptr + X_stride * i * X_argsorted_i = X_argsorted_ptr + X_argsorted_stride * i # <<<<<<<<<<<<<< @@ -7407,7 +7437,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_X_argsorted_i = (__pyx_v_X_argsorted_ptr + (__pyx_v_X_argsorted_stride * __pyx_v_i)); - /* "sklearn/tree/_tree.pyx":895 + /* "sklearn/tree/_tree.pyx":884 * * # Reset the criterion for this feature * criterion.reset() # <<<<<<<<<<<<<< @@ -7416,7 +7446,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->reset(__pyx_v_criterion); - /* "sklearn/tree/_tree.pyx":898 + /* "sklearn/tree/_tree.pyx":887 * * # Find min and max * a = 0 # <<<<<<<<<<<<<< @@ -7425,7 +7455,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_a = 0; - /* "sklearn/tree/_tree.pyx":899 + /* "sklearn/tree/_tree.pyx":888 * # Find min and max * a = 0 * while sample_mask_ptr[X_argsorted_i[a]] == 0: # <<<<<<<<<<<<<< @@ -7433,10 +7463,10 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o * X_a = X_i[X_argsorted_i[a]] */ while (1) { - __pyx_t_4 = ((__pyx_v_sample_mask_ptr[(__pyx_v_X_argsorted_i[__pyx_v_a])]) == 0); - if (!__pyx_t_4) break; + __pyx_t_5 = ((__pyx_v_sample_mask_ptr[(__pyx_v_X_argsorted_i[__pyx_v_a])]) == 0); + if (!__pyx_t_5) break; - /* "sklearn/tree/_tree.pyx":900 + /* "sklearn/tree/_tree.pyx":889 * a = 0 * while sample_mask_ptr[X_argsorted_i[a]] == 0: * a = a + 1 # <<<<<<<<<<<<<< @@ -7446,7 +7476,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o __pyx_v_a = (__pyx_v_a + 1); } - /* "sklearn/tree/_tree.pyx":901 + /* "sklearn/tree/_tree.pyx":890 * while sample_mask_ptr[X_argsorted_i[a]] == 0: * a = a + 1 * X_a = X_i[X_argsorted_i[a]] # <<<<<<<<<<<<<< @@ -7455,7 +7485,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_X_a = (__pyx_v_X_i[(__pyx_v_X_argsorted_i[__pyx_v_a])]); - /* "sklearn/tree/_tree.pyx":903 + /* "sklearn/tree/_tree.pyx":892 * X_a = X_i[X_argsorted_i[a]] * * b = n_total_samples - 1 # <<<<<<<<<<<<<< @@ -7464,7 +7494,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_b = (__pyx_v_n_total_samples - 1); - /* "sklearn/tree/_tree.pyx":904 + /* "sklearn/tree/_tree.pyx":893 * * b = n_total_samples - 1 * while sample_mask_ptr[X_argsorted_i[b]] == 0: # <<<<<<<<<<<<<< @@ -7472,10 +7502,10 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o * X_b = X_i[X_argsorted_i[b]] */ while (1) { - __pyx_t_4 = ((__pyx_v_sample_mask_ptr[(__pyx_v_X_argsorted_i[__pyx_v_b])]) == 0); - if (!__pyx_t_4) break; + __pyx_t_5 = ((__pyx_v_sample_mask_ptr[(__pyx_v_X_argsorted_i[__pyx_v_b])]) == 0); + if (!__pyx_t_5) break; - /* "sklearn/tree/_tree.pyx":905 + /* "sklearn/tree/_tree.pyx":894 * b = n_total_samples - 1 * while sample_mask_ptr[X_argsorted_i[b]] == 0: * b = b - 1 # <<<<<<<<<<<<<< @@ -7485,7 +7515,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o __pyx_v_b = (__pyx_v_b - 1); } - /* "sklearn/tree/_tree.pyx":906 + /* "sklearn/tree/_tree.pyx":895 * while sample_mask_ptr[X_argsorted_i[b]] == 0: * b = b - 1 * X_b = X_i[X_argsorted_i[b]] # <<<<<<<<<<<<<< @@ -7494,23 +7524,23 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_X_b = (__pyx_v_X_i[(__pyx_v_X_argsorted_i[__pyx_v_b])]); - /* "sklearn/tree/_tree.pyx":908 + /* "sklearn/tree/_tree.pyx":897 * X_b = X_i[X_argsorted_i[b]] * * if b <= a or X_a == X_b: # <<<<<<<<<<<<<< * continue # Skip that feature and don't count it as visited * */ - __pyx_t_4 = (__pyx_v_b <= __pyx_v_a); - if (!__pyx_t_4) { - __pyx_t_2 = (__pyx_v_X_a == __pyx_v_X_b); - __pyx_t_3 = __pyx_t_2; + __pyx_t_5 = (__pyx_v_b <= __pyx_v_a); + if (!__pyx_t_5) { + __pyx_t_3 = (__pyx_v_X_a == __pyx_v_X_b); + __pyx_t_4 = __pyx_t_3; } else { - __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = __pyx_t_5; } - if (__pyx_t_3) { + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":909 + /* "sklearn/tree/_tree.pyx":898 * * if b <= a or X_a == X_b: * continue # Skip that feature and don't count it as visited # <<<<<<<<<<<<<< @@ -7522,23 +7552,23 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } __pyx_L11:; - /* "sklearn/tree/_tree.pyx":912 + /* "sklearn/tree/_tree.pyx":901 * * # Draw a random threshold in [a, b) * random = random_state.rand() # <<<<<<<<<<<<<< * t = X_a + (random * (X_b - X_a)) * if t == X_b: */ - __pyx_t_7 = PyObject_GetAttr(__pyx_v_random_state, __pyx_n_s__rand); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_random_state, __pyx_n_s__rand); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __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 = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_random = __pyx_t_10; + __pyx_v_random = __pyx_t_9; - /* "sklearn/tree/_tree.pyx":913 + /* "sklearn/tree/_tree.pyx":902 * # Draw a random threshold in [a, b) * random = random_state.rand() * t = X_a + (random * (X_b - X_a)) # <<<<<<<<<<<<<< @@ -7547,17 +7577,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_t = (__pyx_v_X_a + (__pyx_v_random * (__pyx_v_X_b - __pyx_v_X_a))); - /* "sklearn/tree/_tree.pyx":914 + /* "sklearn/tree/_tree.pyx":903 * random = random_state.rand() * t = X_a + (random * (X_b - X_a)) * if t == X_b: # <<<<<<<<<<<<<< * t = X_a * */ - __pyx_t_3 = (__pyx_v_t == __pyx_v_X_b); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_t == __pyx_v_X_b); + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":915 + /* "sklearn/tree/_tree.pyx":904 * t = X_a + (random * (X_b - X_a)) * if t == X_b: * t = X_a # <<<<<<<<<<<<<< @@ -7569,7 +7599,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } __pyx_L12:; - /* "sklearn/tree/_tree.pyx":918 + /* "sklearn/tree/_tree.pyx":907 * * # Find the sample just greater than t * c = a + 1 # <<<<<<<<<<<<<< @@ -7578,7 +7608,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_c = (__pyx_v_a + 1); - /* "sklearn/tree/_tree.pyx":920 + /* "sklearn/tree/_tree.pyx":909 * c = a + 1 * * while True: # <<<<<<<<<<<<<< @@ -7588,33 +7618,33 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o while (1) { if (!1) break; - /* "sklearn/tree/_tree.pyx":921 + /* "sklearn/tree/_tree.pyx":910 * * while True: * if sample_mask_ptr[X_argsorted_i[c]] != 0: # <<<<<<<<<<<<<< * # FIXME why is t cast to DTYPE_t? * if X_i[X_argsorted_i[c]] > ( t) or c == b: */ - __pyx_t_3 = ((__pyx_v_sample_mask_ptr[(__pyx_v_X_argsorted_i[__pyx_v_c])]) != 0); - if (__pyx_t_3) { + __pyx_t_4 = ((__pyx_v_sample_mask_ptr[(__pyx_v_X_argsorted_i[__pyx_v_c])]) != 0); + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":923 + /* "sklearn/tree/_tree.pyx":912 * if sample_mask_ptr[X_argsorted_i[c]] != 0: * # FIXME why is t cast to DTYPE_t? * if X_i[X_argsorted_i[c]] > ( t) or c == b: # <<<<<<<<<<<<<< * break * */ - __pyx_t_3 = ((__pyx_v_X_i[(__pyx_v_X_argsorted_i[__pyx_v_c])]) > ((__pyx_t_7sklearn_4tree_5_tree_DTYPE_t)__pyx_v_t)); - if (!__pyx_t_3) { - __pyx_t_4 = (__pyx_v_c == __pyx_v_b); - __pyx_t_2 = __pyx_t_4; + __pyx_t_4 = ((__pyx_v_X_i[(__pyx_v_X_argsorted_i[__pyx_v_c])]) > ((__pyx_t_7sklearn_4tree_5_tree_DTYPE_t)__pyx_v_t)); + if (!__pyx_t_4) { + __pyx_t_5 = (__pyx_v_c == __pyx_v_b); + __pyx_t_3 = __pyx_t_5; } else { - __pyx_t_2 = __pyx_t_3; + __pyx_t_3 = __pyx_t_4; } - if (__pyx_t_2) { + if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":924 + /* "sklearn/tree/_tree.pyx":913 * # FIXME why is t cast to DTYPE_t? * if X_i[X_argsorted_i[c]] > ( t) or c == b: * break # <<<<<<<<<<<<<< @@ -7629,7 +7659,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } __pyx_L15:; - /* "sklearn/tree/_tree.pyx":926 + /* "sklearn/tree/_tree.pyx":915 * break * * c += 1 # <<<<<<<<<<<<<< @@ -7640,23 +7670,23 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } __pyx_L14_break:; - /* "sklearn/tree/_tree.pyx":932 - * X_argsorted_i, - * sample_weight_ptr, - * sample_mask_ptr): # <<<<<<<<<<<<<< + /* "sklearn/tree/_tree.pyx":922 + * X_argsorted_i, + * sample_weight_ptr, + * sample_mask_ptr): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->update(__pyx_v_criterion, 0, __pyx_v_c, __pyx_v_y_ptr, __pyx_v_y_stride, __pyx_v_X_argsorted_i, __pyx_v_sample_weight_ptr, __pyx_v_sample_mask_ptr)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->update(__pyx_v_criterion, 0, __pyx_v_c, __pyx_v_y_ptr, __pyx_v_y_stride, __pyx_v_X_argsorted_i, __pyx_v_sample_weight_ptr, __pyx_v_sample_mask_ptr)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_3 = (!__pyx_t_2); - if (__pyx_t_3) { + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":933 - * sample_weight_ptr, - * sample_mask_ptr): + /* "sklearn/tree/_tree.pyx":923 + * sample_weight_ptr, + * sample_mask_ptr): * continue # <<<<<<<<<<<<<< * * n_left = criterion.n_left @@ -7666,40 +7696,41 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } __pyx_L17:; - /* "sklearn/tree/_tree.pyx":935 + /* "sklearn/tree/_tree.pyx":925 * continue * * n_left = criterion.n_left # <<<<<<<<<<<<<< * * if (n_left < min_samples_leaf or */ - __pyx_v_n_left = __pyx_v_criterion->n_left; + __pyx_t_10 = __pyx_v_criterion->n_left; + __pyx_v_n_left = __pyx_t_10; - /* "sklearn/tree/_tree.pyx":937 + /* "sklearn/tree/_tree.pyx":927 * n_left = criterion.n_left * * if (n_left < min_samples_leaf or # <<<<<<<<<<<<<< * (n_node_samples - n_left) < min_samples_leaf): * continue */ - __pyx_t_3 = (__pyx_v_n_left < __pyx_v_min_samples_leaf); - if (!__pyx_t_3) { + __pyx_t_4 = (__pyx_v_n_left < __pyx_v_min_samples_leaf); + if (!__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":938 + /* "sklearn/tree/_tree.pyx":928 * * if (n_left < min_samples_leaf or * (n_node_samples - n_left) < min_samples_leaf): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_2 = ((__pyx_v_n_node_samples - __pyx_v_n_left) < __pyx_v_min_samples_leaf); - __pyx_t_4 = __pyx_t_2; + __pyx_t_3 = ((__pyx_v_n_node_samples - __pyx_v_n_left) < __pyx_v_min_samples_leaf); + __pyx_t_5 = __pyx_t_3; } else { - __pyx_t_4 = __pyx_t_3; + __pyx_t_5 = __pyx_t_4; } - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":939 + /* "sklearn/tree/_tree.pyx":929 * if (n_left < min_samples_leaf or * (n_node_samples - n_left) < min_samples_leaf): * continue # <<<<<<<<<<<<<< @@ -7711,7 +7742,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } __pyx_L18:; - /* "sklearn/tree/_tree.pyx":941 + /* "sklearn/tree/_tree.pyx":931 * continue * * error = criterion.eval() # <<<<<<<<<<<<<< @@ -7720,17 +7751,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_error = ((struct __pyx_vtabstruct_7sklearn_4tree_5_tree_Criterion *)__pyx_v_criterion->__pyx_vtab)->eval(__pyx_v_criterion); - /* "sklearn/tree/_tree.pyx":943 + /* "sklearn/tree/_tree.pyx":933 * error = criterion.eval() * * if error < best_error: # <<<<<<<<<<<<<< * best_i = i * best_t = t */ - __pyx_t_4 = (__pyx_v_error < __pyx_v_best_error); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_error < __pyx_v_best_error); + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":944 + /* "sklearn/tree/_tree.pyx":934 * * if error < best_error: * best_i = i # <<<<<<<<<<<<<< @@ -7739,7 +7770,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_best_i = __pyx_v_i; - /* "sklearn/tree/_tree.pyx":945 + /* "sklearn/tree/_tree.pyx":935 * if error < best_error: * best_i = i * best_t = t # <<<<<<<<<<<<<< @@ -7748,7 +7779,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_best_t = __pyx_v_t; - /* "sklearn/tree/_tree.pyx":946 + /* "sklearn/tree/_tree.pyx":936 * best_i = i * best_t = t * best_error = error # <<<<<<<<<<<<<< @@ -7760,7 +7791,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } __pyx_L19:; - /* "sklearn/tree/_tree.pyx":949 + /* "sklearn/tree/_tree.pyx":939 * * # Count one more visited feature * visited_features += 1 # <<<<<<<<<<<<<< @@ -7769,17 +7800,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ __pyx_v_visited_features = (__pyx_v_visited_features + 1); - /* "sklearn/tree/_tree.pyx":951 + /* "sklearn/tree/_tree.pyx":941 * visited_features += 1 * * if visited_features >= max_features: # <<<<<<<<<<<<<< * break * */ - __pyx_t_4 = (__pyx_v_visited_features >= __pyx_v_max_features); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_visited_features >= __pyx_v_max_features); + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":952 + /* "sklearn/tree/_tree.pyx":942 * * if visited_features >= max_features: * break # <<<<<<<<<<<<<< @@ -7794,7 +7825,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o } __pyx_L6_break:; - /* "sklearn/tree/_tree.pyx":954 + /* "sklearn/tree/_tree.pyx":944 * break * * _best_i[0] = best_i # <<<<<<<<<<<<<< @@ -7803,7 +7834,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ (__pyx_v__best_i[0]) = __pyx_v_best_i; - /* "sklearn/tree/_tree.pyx":955 + /* "sklearn/tree/_tree.pyx":945 * * _best_i[0] = best_i * _best_t[0] = best_t # <<<<<<<<<<<<<< @@ -7812,7 +7843,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ (__pyx_v__best_t[0]) = __pyx_v_best_t; - /* "sklearn/tree/_tree.pyx":956 + /* "sklearn/tree/_tree.pyx":946 * _best_i[0] = best_i * _best_t[0] = best_t * _best_error[0] = best_error # <<<<<<<<<<<<<< @@ -7821,7 +7852,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o */ (__pyx_v__best_error[0]) = __pyx_v_best_error; - /* "sklearn/tree/_tree.pyx":957 + /* "sklearn/tree/_tree.pyx":947 * _best_t[0] = best_t * _best_error[0] = best_error * _initial_error[0] = initial_error # <<<<<<<<<<<<<< @@ -7832,7 +7863,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; @@ -7850,7 +7881,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_4Tree_find_random_split(struct __pyx_o __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":959 +/* "sklearn/tree/_tree.pyx":949 * _initial_error[0] = initial_error * * cpdef predict(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< @@ -7906,23 +7937,23 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s __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 = 959; __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 = 949; __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 overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__predict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__predict); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __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_13predict)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 959; __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 = 949; __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 = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -7933,7 +7964,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/tree/_tree.pyx":962 + /* "sklearn/tree/_tree.pyx":952 * """Predict target for X.""" * cdef int i, k, c * cdef int n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -7942,7 +7973,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/tree/_tree.pyx":963 + /* "sklearn/tree/_tree.pyx":953 * cdef int i, k, c * cdef int n_samples = X.shape[0] * cdef int node_id = 0 # <<<<<<<<<<<<<< @@ -7951,22 +7982,22 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s */ __pyx_v_node_id = 0; - /* "sklearn/tree/_tree.pyx":968 + /* "sklearn/tree/_tree.pyx":958 * * cdef np.ndarray[np.float64_t, ndim=3] out * out = np_zeros((n_samples, self.n_outputs, self.max_n_classes), dtype=np.float64) # <<<<<<<<<<<<<< * * for i from 0 <= i < n_samples: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyInt_FromLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->n_outputs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyInt_FromLong(__pyx_v_self->max_n_classes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_self->max_n_classes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -7977,26 +8008,26 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __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(((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 = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -8012,13 +8043,13 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s } } __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]; __pyx_pybuffernd_out.diminfo[1].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_out.diminfo[1].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_out.diminfo[2].strides = __pyx_pybuffernd_out.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_out.diminfo[2].shape = __pyx_pybuffernd_out.rcbuffer->pybuffer.shape[2]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __pyx_v_out = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/tree/_tree.pyx":970 + /* "sklearn/tree/_tree.pyx":960 * out = np_zeros((n_samples, self.n_outputs, self.max_n_classes), dtype=np.float64) * * for i from 0 <= i < n_samples: # <<<<<<<<<<<<<< @@ -8028,7 +8059,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s __pyx_t_7 = __pyx_v_n_samples; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - /* "sklearn/tree/_tree.pyx":971 + /* "sklearn/tree/_tree.pyx":961 * * for i from 0 <= i < n_samples: * node_id = 0 # <<<<<<<<<<<<<< @@ -8037,7 +8068,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s */ __pyx_v_node_id = 0; - /* "sklearn/tree/_tree.pyx":974 + /* "sklearn/tree/_tree.pyx":964 * * # While node_id not a leaf * while self.children_left[node_id] != _TREE_LEAF: # and self.children_right[node_id] != _TREE_LEAF: # <<<<<<<<<<<<<< @@ -8048,7 +8079,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s __pyx_t_11 = ((__pyx_v_self->children_left[__pyx_v_node_id]) != __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF); if (!__pyx_t_11) break; - /* "sklearn/tree/_tree.pyx":975 + /* "sklearn/tree/_tree.pyx":965 * # While node_id not a leaf * while self.children_left[node_id] != _TREE_LEAF: # and self.children_right[node_id] != _TREE_LEAF: * if X[i, self.feature[node_id]] <= self.threshold[node_id]: # <<<<<<<<<<<<<< @@ -8060,7 +8091,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s __pyx_t_11 = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)) <= (__pyx_v_self->threshold[__pyx_v_node_id])); if (__pyx_t_11) { - /* "sklearn/tree/_tree.pyx":976 + /* "sklearn/tree/_tree.pyx":966 * while self.children_left[node_id] != _TREE_LEAF: # and self.children_right[node_id] != _TREE_LEAF: * if X[i, self.feature[node_id]] <= self.threshold[node_id]: * node_id = self.children_left[node_id] # <<<<<<<<<<<<<< @@ -8072,7 +8103,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s } /*else*/ { - /* "sklearn/tree/_tree.pyx":978 + /* "sklearn/tree/_tree.pyx":968 * node_id = self.children_left[node_id] * else: * node_id = self.children_right[node_id] # <<<<<<<<<<<<<< @@ -8084,7 +8115,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s __pyx_L7:; } - /* "sklearn/tree/_tree.pyx":980 + /* "sklearn/tree/_tree.pyx":970 * node_id = self.children_right[node_id] * * offset_node = node_id * self.value_stride # <<<<<<<<<<<<<< @@ -8093,7 +8124,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s */ __pyx_v_offset_node = (__pyx_v_node_id * __pyx_v_self->value_stride); - /* "sklearn/tree/_tree.pyx":982 + /* "sklearn/tree/_tree.pyx":972 * offset_node = node_id * self.value_stride * * for k from 0 <= k < self.n_outputs: # <<<<<<<<<<<<<< @@ -8103,7 +8134,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s __pyx_t_14 = __pyx_v_self->n_outputs; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_14; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":983 + /* "sklearn/tree/_tree.pyx":973 * * for k from 0 <= k < self.n_outputs: * offset_output = k * self.max_n_classes # <<<<<<<<<<<<<< @@ -8112,7 +8143,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s */ __pyx_v_offset_output = (__pyx_v_k * __pyx_v_self->max_n_classes); - /* "sklearn/tree/_tree.pyx":985 + /* "sklearn/tree/_tree.pyx":975 * offset_output = k * self.max_n_classes * * for c from 0 <= c < self.n_classes[k]: # <<<<<<<<<<<<<< @@ -8122,7 +8153,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s __pyx_t_15 = (__pyx_v_self->n_classes[__pyx_v_k]); for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_15; __pyx_v_c++) { - /* "sklearn/tree/_tree.pyx":986 + /* "sklearn/tree/_tree.pyx":976 * * for c from 0 <= c < self.n_classes[k]: * out[i, k, c] = self.value[offset_node + offset_output + c] # <<<<<<<<<<<<<< @@ -8137,7 +8168,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_predict(struct __pyx_obj_7s } } - /* "sklearn/tree/_tree.pyx":988 + /* "sklearn/tree/_tree.pyx":978 * out[i, k, c] = self.value[offset_node + offset_output + c] * * return out # <<<<<<<<<<<<<< @@ -8182,7 +8213,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13predict(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 = 959; __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 = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_12predict(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X)); goto __pyx_L0; __pyx_L1_error:; @@ -8192,7 +8223,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_13predict(PyObject *__pyx_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":959 +/* "sklearn/tree/_tree.pyx":949 * _initial_error[0] = initial_error * * cpdef predict(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< @@ -8216,11 +8247,11 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_12predict(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 = 959; __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 = 949; __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 = ((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 = 959; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((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 = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8245,7 +8276,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_12predict(struct __pyx_obj return __pyx_r; } -/* "sklearn/tree/_tree.pyx":990 +/* "sklearn/tree/_tree.pyx":980 * return out * * cpdef apply(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< @@ -8293,23 +8324,23 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl __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 = 990; __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 = 980; __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 overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __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_15apply)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __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 = 980; __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 = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -8320,7 +8351,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/tree/_tree.pyx":992 + /* "sklearn/tree/_tree.pyx":982 * cpdef apply(self, np.ndarray[DTYPE_t, ndim=2] X): * """Finds the terminal region (=leaf node) for each sample in X.""" * cdef int i = 0 # <<<<<<<<<<<<<< @@ -8329,7 +8360,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl */ __pyx_v_i = 0; - /* "sklearn/tree/_tree.pyx":993 + /* "sklearn/tree/_tree.pyx":983 * """Finds the terminal region (=leaf node) for each sample in X.""" * cdef int i = 0 * cdef int n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -8338,7 +8369,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/tree/_tree.pyx":994 + /* "sklearn/tree/_tree.pyx":984 * cdef int i = 0 * cdef int n_samples = X.shape[0] * cdef int node_id = 0 # <<<<<<<<<<<<<< @@ -8347,42 +8378,42 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl */ __pyx_v_node_id = 0; - /* "sklearn/tree/_tree.pyx":997 + /* "sklearn/tree/_tree.pyx":987 * * cdef np.ndarray[np.int32_t, ndim=1] out * out = np_zeros((n_samples, ), dtype=np.int32) # <<<<<<<<<<<<<< * * for i from 0 <= i < n_samples: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyInt_FromLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __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 = 987; __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 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __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 = 987; __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)); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __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 = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 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 = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -8398,13 +8429,13 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl } } __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]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __pyx_v_out = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/tree/_tree.pyx":999 + /* "sklearn/tree/_tree.pyx":989 * out = np_zeros((n_samples, ), dtype=np.int32) * * for i from 0 <= i < n_samples: # <<<<<<<<<<<<<< @@ -8414,7 +8445,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl __pyx_t_7 = __pyx_v_n_samples; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - /* "sklearn/tree/_tree.pyx":1000 + /* "sklearn/tree/_tree.pyx":990 * * for i from 0 <= i < n_samples: * node_id = 0 # <<<<<<<<<<<<<< @@ -8423,7 +8454,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl */ __pyx_v_node_id = 0; - /* "sklearn/tree/_tree.pyx":1003 + /* "sklearn/tree/_tree.pyx":993 * * # While node_id not a leaf * while self.children_left[node_id] != _TREE_LEAF: # and self.children_right[node_id] != _TREE_LEAF: # <<<<<<<<<<<<<< @@ -8434,7 +8465,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl __pyx_t_11 = ((__pyx_v_self->children_left[__pyx_v_node_id]) != __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF); if (!__pyx_t_11) break; - /* "sklearn/tree/_tree.pyx":1004 + /* "sklearn/tree/_tree.pyx":994 * # While node_id not a leaf * while self.children_left[node_id] != _TREE_LEAF: # and self.children_right[node_id] != _TREE_LEAF: * if X[i, self.feature[node_id]] <= self.threshold[node_id]: # <<<<<<<<<<<<<< @@ -8446,7 +8477,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl __pyx_t_11 = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_4tree_5_tree_DTYPE_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)) <= (__pyx_v_self->threshold[__pyx_v_node_id])); if (__pyx_t_11) { - /* "sklearn/tree/_tree.pyx":1005 + /* "sklearn/tree/_tree.pyx":995 * while self.children_left[node_id] != _TREE_LEAF: # and self.children_right[node_id] != _TREE_LEAF: * if X[i, self.feature[node_id]] <= self.threshold[node_id]: * node_id = self.children_left[node_id] # <<<<<<<<<<<<<< @@ -8458,7 +8489,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl } /*else*/ { - /* "sklearn/tree/_tree.pyx":1007 + /* "sklearn/tree/_tree.pyx":997 * node_id = self.children_left[node_id] * else: * node_id = self.children_right[node_id] # <<<<<<<<<<<<<< @@ -8470,7 +8501,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl __pyx_L7:; } - /* "sklearn/tree/_tree.pyx":1009 + /* "sklearn/tree/_tree.pyx":999 * node_id = self.children_right[node_id] * * out[i] = node_id # <<<<<<<<<<<<<< @@ -8481,7 +8512,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_apply(struct __pyx_obj_7skl *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_out.diminfo[0].strides) = __pyx_v_node_id; } - /* "sklearn/tree/_tree.pyx":1011 + /* "sklearn/tree/_tree.pyx":1001 * out[i] = node_id * * return out # <<<<<<<<<<<<<< @@ -8526,7 +8557,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_15apply(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 = 990; __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 = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_4tree_5_tree_4Tree_14apply(((struct __pyx_obj_7sklearn_4tree_5_tree_Tree *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X)); goto __pyx_L0; __pyx_L1_error:; @@ -8536,7 +8567,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_15apply(PyObject *__pyx_v_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":990 +/* "sklearn/tree/_tree.pyx":980 * return out * * cpdef apply(self, np.ndarray[DTYPE_t, ndim=2] X): # <<<<<<<<<<<<<< @@ -8560,11 +8591,11 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14apply(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 = 990; __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 = 980; __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 = ((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 = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((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 = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8589,7 +8620,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_14apply(struct __pyx_obj_7 return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1013 +/* "sklearn/tree/_tree.pyx":1003 * return out * * cpdef compute_feature_importances(self, method="gini"): # <<<<<<<<<<<<<< @@ -8640,16 +8671,16 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __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_17compute_feature_importances)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __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 = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_method); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_method); __Pyx_GIVEREF(__pyx_v_method); - __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 = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -8660,19 +8691,19 @@ 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":1028 + /* "sklearn/tree/_tree.pyx":1018 * or "squared". * """ * if method != "gini" and method != "squared": # <<<<<<<<<<<<<< * raise ValueError( * 'Invalid value for method. Allowed string ' */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__gini), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __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 = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__gini), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __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 = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__squared), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__squared), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_5; } else { @@ -8680,58 +8711,58 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances } if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1029 + /* "sklearn/tree/_tree.pyx":1019 * """ * if method != "gini" and method != "squared": * raise ValueError( # <<<<<<<<<<<<<< * 'Invalid value for method. Allowed string ' * 'values are "gini", or "squared".') */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __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 = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":1035 + /* "sklearn/tree/_tree.pyx":1025 * cdef int node * cdef np.ndarray[np.float64_t, ndim=1] importances * importances = np_zeros((self.n_features,), dtype=np.float64) # <<<<<<<<<<<<<< * * if method == "gini": */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyInt_FromLong(__pyx_v_self->n_features); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->n_features); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __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 = 1025; __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 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __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 = 1025; __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)); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -8747,25 +8778,25 @@ 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_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_9 = 0; __pyx_v_importances = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; - /* "sklearn/tree/_tree.pyx":1037 + /* "sklearn/tree/_tree.pyx":1027 * importances = np_zeros((self.n_features,), dtype=np.float64) * * if method == "gini": # <<<<<<<<<<<<<< * for node from 0 <= node < self.node_count: * if self.children_left[node] != _TREE_LEAF: # and self.children_right[node] != _TREE_LEAF: */ - __pyx_t_8 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__gini), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__gini), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1038 + /* "sklearn/tree/_tree.pyx":1028 * * if method == "gini": * for node from 0 <= node < self.node_count: # <<<<<<<<<<<<<< @@ -8775,7 +8806,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_10 = __pyx_v_self->node_count; for (__pyx_v_node = 0; __pyx_v_node < __pyx_t_10; __pyx_v_node++) { - /* "sklearn/tree/_tree.pyx":1039 + /* "sklearn/tree/_tree.pyx":1029 * if method == "gini": * for node from 0 <= node < self.node_count: * if self.children_left[node] != _TREE_LEAF: # and self.children_right[node] != _TREE_LEAF: # <<<<<<<<<<<<<< @@ -8785,7 +8816,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_6 = ((__pyx_v_self->children_left[__pyx_v_node]) != __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF); if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1040 + /* "sklearn/tree/_tree.pyx":1030 * for node from 0 <= node < self.node_count: * if self.children_left[node] != _TREE_LEAF: # and self.children_right[node] != _TREE_LEAF: * importances[self.feature[node]] += \ # <<<<<<<<<<<<<< @@ -8802,7 +8833,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances } /*else*/ { - /* "sklearn/tree/_tree.pyx":1043 + /* "sklearn/tree/_tree.pyx":1033 * self._compute_feature_importances_gini(node) * else: * for node from 0 <= node < self.node_count: # <<<<<<<<<<<<<< @@ -8812,7 +8843,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_10 = __pyx_v_self->node_count; for (__pyx_v_node = 0; __pyx_v_node < __pyx_t_10; __pyx_v_node++) { - /* "sklearn/tree/_tree.pyx":1044 + /* "sklearn/tree/_tree.pyx":1034 * else: * for node from 0 <= node < self.node_count: * if self.children_left[node] != _TREE_LEAF: # and self.children_right[node] != _TREE_LEAF: # <<<<<<<<<<<<<< @@ -8822,7 +8853,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_6 = ((__pyx_v_self->children_left[__pyx_v_node]) != __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF); if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1045 + /* "sklearn/tree/_tree.pyx":1035 * for node from 0 <= node < self.node_count: * if self.children_left[node] != _TREE_LEAF: # and self.children_right[node] != _TREE_LEAF: * importances[self.feature[node]] += \ # <<<<<<<<<<<<<< @@ -8838,32 +8869,32 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances } __pyx_L4:; - /* "sklearn/tree/_tree.pyx":1048 + /* "sklearn/tree/_tree.pyx":1038 * self._compute_feature_importances_squared(node) * * cdef double normalizer = np.sum(importances) # <<<<<<<<<<<<<< * * if normalizer > 0.0: */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_v_importances)); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_importances)); __Pyx_GIVEREF(((PyObject *)__pyx_v_importances)); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __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_8)); __pyx_t_8 = 0; - __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_normalizer = __pyx_t_16; - /* "sklearn/tree/_tree.pyx":1050 + /* "sklearn/tree/_tree.pyx":1040 * cdef double normalizer = np.sum(importances) * * if normalizer > 0.0: # <<<<<<<<<<<<<< @@ -8873,19 +8904,19 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances __pyx_t_6 = (__pyx_v_normalizer > 0.0); if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1052 + /* "sklearn/tree/_tree.pyx":1042 * 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 = 1052; __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 = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_importances), __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_importances), __pyx_t_3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -8901,7 +8932,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_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_importances)); @@ -8911,7 +8942,7 @@ static PyObject *__pyx_f_7sklearn_4tree_5_tree_4Tree_compute_feature_importances } __pyx_L11:; - /* "sklearn/tree/_tree.pyx":1054 + /* "sklearn/tree/_tree.pyx":1044 * importances /= normalizer * * return importances # <<<<<<<<<<<<<< @@ -8976,7 +9007,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_17compute_feature_importan } } 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 = 1013; __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 = 1003; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -8989,7 +9020,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_17compute_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 = 1013; __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 = 1003; __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(); @@ -9000,7 +9031,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_4Tree_17compute_feature_importan return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1013 +/* "sklearn/tree/_tree.pyx":1003 * return out * * cpdef compute_feature_importances(self, method="gini"): # <<<<<<<<<<<<<< @@ -9020,7 +9051,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_16compute_feature_importan __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.method = __pyx_v_method; - __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 = 1013; __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 = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9038,7 +9069,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_4Tree_16compute_feature_importan return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1056 +/* "sklearn/tree/_tree.pyx":1046 * return importances * * cdef inline double _compute_feature_importances_gini(self, int node): # <<<<<<<<<<<<<< @@ -9051,7 +9082,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_4Tree__compute_feature __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_compute_feature_importances_gini", 0); - /* "sklearn/tree/_tree.pyx":1057 + /* "sklearn/tree/_tree.pyx":1047 * * cdef inline double _compute_feature_importances_gini(self, int node): * return self.n_samples[node] * (self.init_error[node] - self.best_error[node]) # <<<<<<<<<<<<<< @@ -9067,7 +9098,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_4Tree__compute_feature return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1059 +/* "sklearn/tree/_tree.pyx":1049 * return self.n_samples[node] * (self.init_error[node] - self.best_error[node]) * * cdef inline double _compute_feature_importances_squared(self, int node): # <<<<<<<<<<<<<< @@ -9081,7 +9112,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_4Tree__compute_feature __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_compute_feature_importances_squared", 0); - /* "sklearn/tree/_tree.pyx":1060 + /* "sklearn/tree/_tree.pyx":1050 * * cdef inline double _compute_feature_importances_squared(self, int node): * cdef double error = self.init_error[node] - self.best_error[node] # <<<<<<<<<<<<<< @@ -9090,7 +9121,7 @@ static CYTHON_INLINE double __pyx_f_7sklearn_4tree_5_tree_4Tree__compute_feature */ __pyx_v_error = ((__pyx_v_self->init_error[__pyx_v_node]) - (__pyx_v_self->best_error[__pyx_v_node])); - /* "sklearn/tree/_tree.pyx":1061 + /* "sklearn/tree/_tree.pyx":1051 * cdef inline double _compute_feature_importances_squared(self, int node): * cdef double error = self.init_error[node] - self.best_error[node] * return error * error # <<<<<<<<<<<<<< @@ -10225,7 +10256,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_4Tree_8capacity_2__set__(struct __pyx_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1071 +/* "sklearn/tree/_tree.pyx":1061 * """Interface for splitting criteria (regression and classification).""" * * cdef void init(self, DOUBLE_t* y, int y_stride, # <<<<<<<<<<<<<< @@ -10240,7 +10271,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_init(CYTHON_UNUSED struct _ __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1080 +/* "sklearn/tree/_tree.pyx":1070 * pass * * cdef void reset(self): # <<<<<<<<<<<<<< @@ -10255,7 +10286,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_9Criterion_reset(CYTHON_UNUSED struct __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1084 +/* "sklearn/tree/_tree.pyx":1074 * pass * * cdef bool update(self, int a, int b, # <<<<<<<<<<<<<< @@ -10274,7 +10305,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_9Criterion_update(CYTHON_UNUS return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1093 +/* "sklearn/tree/_tree.pyx":1083 * pass * * cdef double eval(self): # <<<<<<<<<<<<<< @@ -10292,7 +10323,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_9Criterion_eval(CYTHON_UNUSED struct return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1097 +/* "sklearn/tree/_tree.pyx":1087 * pass * * cdef void init_value(self, double* buffer_value): # <<<<<<<<<<<<<< @@ -10335,11 +10366,11 @@ static int __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_1__cinit__(P case 1: 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 = 1160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __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 = 1160; __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 = 1150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -10347,12 +10378,12 @@ 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_AsInt(values[0]); if (unlikely((__pyx_v_n_outputs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_outputs = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_outputs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_n_classes = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree.ClassificationCriterion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -10363,7 +10394,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_1__cinit__(P return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1160 +/* "sklearn/tree/_tree.pyx":1150 * cdef double* label_count_init * * def __cinit__(self, int n_outputs, object n_classes): # <<<<<<<<<<<<<< @@ -10390,7 +10421,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "sklearn/tree/_tree.pyx":1162 + /* "sklearn/tree/_tree.pyx":1152 * def __cinit__(self, int n_outputs, object n_classes): * """Constructor.""" * cdef int k = 0 # <<<<<<<<<<<<<< @@ -10399,7 +10430,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_k = 0; - /* "sklearn/tree/_tree.pyx":1164 + /* "sklearn/tree/_tree.pyx":1154 * cdef int k = 0 * * self.n_outputs = n_outputs # <<<<<<<<<<<<<< @@ -10408,7 +10439,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->__pyx_base.n_outputs = __pyx_v_n_outputs; - /* "sklearn/tree/_tree.pyx":1165 + /* "sklearn/tree/_tree.pyx":1155 * * self.n_outputs = n_outputs * self.n_samples = 0 # <<<<<<<<<<<<<< @@ -10417,7 +10448,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->__pyx_base.n_samples = 0; - /* "sklearn/tree/_tree.pyx":1166 + /* "sklearn/tree/_tree.pyx":1156 * self.n_outputs = n_outputs * self.n_samples = 0 * self.weighted_n_samples = 0.0 # <<<<<<<<<<<<<< @@ -10426,7 +10457,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->__pyx_base.weighted_n_samples = 0.0; - /* "sklearn/tree/_tree.pyx":1167 + /* "sklearn/tree/_tree.pyx":1157 * self.n_samples = 0 * self.weighted_n_samples = 0.0 * self.n_left = 0 # <<<<<<<<<<<<<< @@ -10435,7 +10466,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->__pyx_base.n_left = 0; - /* "sklearn/tree/_tree.pyx":1168 + /* "sklearn/tree/_tree.pyx":1158 * self.weighted_n_samples = 0.0 * self.n_left = 0 * self.n_right = 0 # <<<<<<<<<<<<<< @@ -10444,7 +10475,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->__pyx_base.n_right = 0; - /* "sklearn/tree/_tree.pyx":1169 + /* "sklearn/tree/_tree.pyx":1159 * self.n_left = 0 * self.n_right = 0 * self.weighted_n_left = 0.0 # <<<<<<<<<<<<<< @@ -10453,7 +10484,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->__pyx_base.weighted_n_left = 0.0; - /* "sklearn/tree/_tree.pyx":1170 + /* "sklearn/tree/_tree.pyx":1160 * self.n_right = 0 * self.weighted_n_left = 0.0 * self.weighted_n_right = 0.0 # <<<<<<<<<<<<<< @@ -10462,7 +10493,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->__pyx_base.weighted_n_right = 0.0; - /* "sklearn/tree/_tree.pyx":1172 + /* "sklearn/tree/_tree.pyx":1162 * self.weighted_n_right = 0.0 * * self.n_classes = malloc(n_outputs * sizeof(int)) # <<<<<<<<<<<<<< @@ -10471,7 +10502,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->n_classes = ((int *)malloc((__pyx_v_n_outputs * (sizeof(int))))); - /* "sklearn/tree/_tree.pyx":1173 + /* "sklearn/tree/_tree.pyx":1163 * * self.n_classes = malloc(n_outputs * sizeof(int)) * if self.n_classes == NULL: # <<<<<<<<<<<<<< @@ -10481,19 +10512,19 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st __pyx_t_1 = (__pyx_v_self->n_classes == NULL); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1174 + /* "sklearn/tree/_tree.pyx":1164 * self.n_classes = malloc(n_outputs * sizeof(int)) * if self.n_classes == NULL: * raise MemoryError() # <<<<<<<<<<<<<< * * cdef int label_count_stride = -1 */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":1176 + /* "sklearn/tree/_tree.pyx":1166 * raise MemoryError() * * cdef int label_count_stride = -1 # <<<<<<<<<<<<<< @@ -10502,7 +10533,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_label_count_stride = -1; - /* "sklearn/tree/_tree.pyx":1178 + /* "sklearn/tree/_tree.pyx":1168 * cdef int label_count_stride = -1 * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< @@ -10512,47 +10543,47 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st __pyx_t_2 = __pyx_v_n_outputs; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1179 + /* "sklearn/tree/_tree.pyx":1169 * * for k from 0 <= k < n_outputs: * self.n_classes[k] = n_classes[k] # <<<<<<<<<<<<<< * * if n_classes[k] > label_count_stride: */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_n_classes, __pyx_v_k, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_n_classes, __pyx_v_k, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_self->n_classes[__pyx_v_k]) = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1181 + /* "sklearn/tree/_tree.pyx":1171 * self.n_classes[k] = n_classes[k] * * if n_classes[k] > label_count_stride: # <<<<<<<<<<<<<< * label_count_stride = n_classes[k] * */ - __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_n_classes, __pyx_v_k, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_n_classes, __pyx_v_k, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyInt_FromLong(__pyx_v_label_count_stride); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_label_count_stride); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __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_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1182 + /* "sklearn/tree/_tree.pyx":1172 * * if n_classes[k] > label_count_stride: * label_count_stride = n_classes[k] # <<<<<<<<<<<<<< * * self.label_count_stride = label_count_stride */ - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_n_classes, __pyx_v_k, sizeof(int), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_n_classes, __pyx_v_k, sizeof(int), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_label_count_stride = __pyx_t_4; goto __pyx_L6; @@ -10560,7 +10591,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st __pyx_L6:; } - /* "sklearn/tree/_tree.pyx":1184 + /* "sklearn/tree/_tree.pyx":1174 * label_count_stride = n_classes[k] * * self.label_count_stride = label_count_stride # <<<<<<<<<<<<<< @@ -10569,7 +10600,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->label_count_stride = __pyx_v_label_count_stride; - /* "sklearn/tree/_tree.pyx":1187 + /* "sklearn/tree/_tree.pyx":1177 * * # Allocate * self.label_count_left = calloc(n_outputs * label_count_stride, sizeof(double)) # <<<<<<<<<<<<<< @@ -10578,7 +10609,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->label_count_left = ((double *)calloc((__pyx_v_n_outputs * __pyx_v_label_count_stride), (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1188 + /* "sklearn/tree/_tree.pyx":1178 * # Allocate * self.label_count_left = calloc(n_outputs * label_count_stride, sizeof(double)) * self.label_count_right = calloc(n_outputs * label_count_stride, sizeof(double)) # <<<<<<<<<<<<<< @@ -10587,7 +10618,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->label_count_right = ((double *)calloc((__pyx_v_n_outputs * __pyx_v_label_count_stride), (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1189 + /* "sklearn/tree/_tree.pyx":1179 * self.label_count_left = calloc(n_outputs * label_count_stride, sizeof(double)) * self.label_count_right = calloc(n_outputs * label_count_stride, sizeof(double)) * self.label_count_init = calloc(n_outputs * label_count_stride, sizeof(double)) # <<<<<<<<<<<<<< @@ -10596,7 +10627,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ __pyx_v_self->label_count_init = ((double *)calloc((__pyx_v_n_outputs * __pyx_v_label_count_stride), (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1192 + /* "sklearn/tree/_tree.pyx":1182 * * # Check for allocation errors * if self.label_count_left == NULL or \ # <<<<<<<<<<<<<< @@ -10606,7 +10637,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st __pyx_t_1 = (__pyx_v_self->label_count_left == NULL); if (!__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1193 + /* "sklearn/tree/_tree.pyx":1183 * # Check for allocation errors * if self.label_count_left == NULL or \ * self.label_count_right == NULL or \ # <<<<<<<<<<<<<< @@ -10616,7 +10647,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st __pyx_t_7 = (__pyx_v_self->label_count_right == NULL); if (!__pyx_t_7) { - /* "sklearn/tree/_tree.pyx":1194 + /* "sklearn/tree/_tree.pyx":1184 * if self.label_count_left == NULL or \ * self.label_count_right == NULL or \ * self.label_count_init == NULL: # <<<<<<<<<<<<<< @@ -10634,7 +10665,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st } if (__pyx_t_7) { - /* "sklearn/tree/_tree.pyx":1195 + /* "sklearn/tree/_tree.pyx":1185 * self.label_count_right == NULL or \ * self.label_count_init == NULL: * free(self.n_classes) # <<<<<<<<<<<<<< @@ -10643,7 +10674,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ free(__pyx_v_self->n_classes); - /* "sklearn/tree/_tree.pyx":1196 + /* "sklearn/tree/_tree.pyx":1186 * self.label_count_init == NULL: * free(self.n_classes) * free(self.label_count_left) # <<<<<<<<<<<<<< @@ -10652,7 +10683,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ free(__pyx_v_self->label_count_left); - /* "sklearn/tree/_tree.pyx":1197 + /* "sklearn/tree/_tree.pyx":1187 * free(self.n_classes) * free(self.label_count_left) * free(self.label_count_right) # <<<<<<<<<<<<<< @@ -10661,7 +10692,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ free(__pyx_v_self->label_count_right); - /* "sklearn/tree/_tree.pyx":1198 + /* "sklearn/tree/_tree.pyx":1188 * free(self.label_count_left) * free(self.label_count_right) * free(self.label_count_init) # <<<<<<<<<<<<<< @@ -10670,14 +10701,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion___cinit__(st */ free(__pyx_v_self->label_count_init); - /* "sklearn/tree/_tree.pyx":1199 + /* "sklearn/tree/_tree.pyx":1189 * free(self.label_count_right) * free(self.label_count_init) * raise MemoryError() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; @@ -10704,7 +10735,7 @@ static void __pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_3__dealloc_ __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1201 +/* "sklearn/tree/_tree.pyx":1191 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -10716,7 +10747,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_2__dealloc_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "sklearn/tree/_tree.pyx":1203 + /* "sklearn/tree/_tree.pyx":1193 * def __dealloc__(self): * """Destructor.""" * free(self.n_classes) # <<<<<<<<<<<<<< @@ -10725,7 +10756,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_2__dealloc_ */ free(__pyx_v_self->n_classes); - /* "sklearn/tree/_tree.pyx":1204 + /* "sklearn/tree/_tree.pyx":1194 * """Destructor.""" * free(self.n_classes) * free(self.label_count_left) # <<<<<<<<<<<<<< @@ -10734,7 +10765,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_2__dealloc_ */ free(__pyx_v_self->label_count_left); - /* "sklearn/tree/_tree.pyx":1205 + /* "sklearn/tree/_tree.pyx":1195 * free(self.n_classes) * free(self.label_count_left) * free(self.label_count_right) # <<<<<<<<<<<<<< @@ -10743,7 +10774,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_2__dealloc_ */ free(__pyx_v_self->label_count_right); - /* "sklearn/tree/_tree.pyx":1206 + /* "sklearn/tree/_tree.pyx":1196 * free(self.label_count_left) * free(self.label_count_right) * free(self.label_count_init) # <<<<<<<<<<<<<< @@ -10766,7 +10797,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_5__red return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1208 +/* "sklearn/tree/_tree.pyx":1198 * free(self.label_count_init) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -10785,7 +10816,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_4__red int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/tree/_tree.pyx":1209 + /* "sklearn/tree/_tree.pyx":1199 * * def __reduce__(self): * return (ClassificationCriterion, # <<<<<<<<<<<<<< @@ -10794,26 +10825,26 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_4__red */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/tree/_tree.pyx":1210 + /* "sklearn/tree/_tree.pyx":1200 * def __reduce__(self): * return (ClassificationCriterion, * (self.n_outputs, intp_to_ndarray(self.n_classes, # <<<<<<<<<<<<<< * self.n_outputs)), * self.__getstate__()) */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->__pyx_base.n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->__pyx_base.n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/tree/_tree.pyx":1211 + /* "sklearn/tree/_tree.pyx":1201 * return (ClassificationCriterion, * (self.n_outputs, intp_to_ndarray(self.n_classes, * self.n_outputs)), # <<<<<<<<<<<<<< * self.__getstate__()) * */ - __pyx_t_2 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_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 = 1210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((PyObject *)__pyx_f_7sklearn_4tree_5_tree_intp_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 = 1200; __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 = 1210; __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 = 1200; __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); @@ -10822,19 +10853,19 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_4__red __pyx_t_1 = 0; __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":1212 + /* "sklearn/tree/_tree.pyx":1202 * (self.n_outputs, intp_to_ndarray(self.n_classes, * self.n_outputs)), * self.__getstate__()) # <<<<<<<<<<<<<< * * def __getstate__(self): */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1202; __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 = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1202; __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 = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1199; __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))); @@ -10874,7 +10905,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_7__get return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1214 +/* "sklearn/tree/_tree.pyx":1204 * self.__getstate__()) * * def __getstate__(self): # <<<<<<<<<<<<<< @@ -10891,7 +10922,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_6__get int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getstate__", 0); - /* "sklearn/tree/_tree.pyx":1215 + /* "sklearn/tree/_tree.pyx":1205 * * def __getstate__(self): * return {} # <<<<<<<<<<<<<< @@ -10899,7 +10930,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_6__get * 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 = 1215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -10928,7 +10959,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_23ClassificationCriterion_9__set return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1217 +/* "sklearn/tree/_tree.pyx":1207 * return {} * * def __setstate__(self, d): # <<<<<<<<<<<<<< @@ -10947,7 +10978,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_23ClassificationCriterion_8__set return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1220 +/* "sklearn/tree/_tree.pyx":1210 * pass * * cdef void init(self, DOUBLE_t* y, int y_stride, # <<<<<<<<<<<<<< @@ -10966,48 +10997,54 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct __pyx_t_7sklearn_4tree_5_tree_DTYPE_t __pyx_v_w; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; + int *__pyx_t_2; + double *__pyx_t_3; int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; __Pyx_RefNannySetupContext("init", 0); - /* "sklearn/tree/_tree.pyx":1227 + /* "sklearn/tree/_tree.pyx":1217 * int n_total_samples): * """Initialise the criterion.""" * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.n_outputs; + __pyx_t_1 = __pyx_v_self->__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1228 + /* "sklearn/tree/_tree.pyx":1218 * """Initialise the criterion.""" * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes # <<<<<<<<<<<<<< * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_init = self.label_count_init */ - __pyx_v_n_classes = __pyx_v_self->n_classes; + __pyx_t_2 = __pyx_v_self->n_classes; + __pyx_v_n_classes = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1229 + /* "sklearn/tree/_tree.pyx":1219 * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride # <<<<<<<<<<<<<< * cdef double* label_count_init = self.label_count_init * */ - __pyx_v_label_count_stride = __pyx_v_self->label_count_stride; + __pyx_t_1 = __pyx_v_self->label_count_stride; + __pyx_v_label_count_stride = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1230 + /* "sklearn/tree/_tree.pyx":1220 * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_init = self.label_count_init # <<<<<<<<<<<<<< * * cdef int k = 0 */ - __pyx_v_label_count_init = __pyx_v_self->label_count_init; + __pyx_t_3 = __pyx_v_self->label_count_init; + __pyx_v_label_count_init = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1232 + /* "sklearn/tree/_tree.pyx":1222 * cdef double* label_count_init = self.label_count_init * * cdef int k = 0 # <<<<<<<<<<<<<< @@ -11016,7 +11053,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct */ __pyx_v_k = 0; - /* "sklearn/tree/_tree.pyx":1233 + /* "sklearn/tree/_tree.pyx":1223 * * cdef int k = 0 * cdef int c = 0 # <<<<<<<<<<<<<< @@ -11025,7 +11062,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct */ __pyx_v_c = 0; - /* "sklearn/tree/_tree.pyx":1234 + /* "sklearn/tree/_tree.pyx":1224 * cdef int k = 0 * cdef int c = 0 * cdef int j = 0 # <<<<<<<<<<<<<< @@ -11034,7 +11071,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct */ __pyx_v_j = 0; - /* "sklearn/tree/_tree.pyx":1235 + /* "sklearn/tree/_tree.pyx":1225 * cdef int c = 0 * cdef int j = 0 * cdef DTYPE_t w = 1.0 # <<<<<<<<<<<<<< @@ -11043,7 +11080,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct */ __pyx_v_w = 1.0; - /* "sklearn/tree/_tree.pyx":1237 + /* "sklearn/tree/_tree.pyx":1227 * cdef DTYPE_t w = 1.0 * * self.n_samples = n_samples # <<<<<<<<<<<<<< @@ -11052,7 +11089,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct */ __pyx_v_self->__pyx_base.n_samples = __pyx_v_n_samples; - /* "sklearn/tree/_tree.pyx":1238 + /* "sklearn/tree/_tree.pyx":1228 * * self.n_samples = n_samples * self.weighted_n_samples = weighted_n_samples # <<<<<<<<<<<<<< @@ -11061,7 +11098,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct */ __pyx_v_self->__pyx_base.weighted_n_samples = __pyx_v_weighted_n_samples; - /* "sklearn/tree/_tree.pyx":1240 + /* "sklearn/tree/_tree.pyx":1230 * self.weighted_n_samples = weighted_n_samples * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< @@ -11071,17 +11108,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct __pyx_t_1 = __pyx_v_n_outputs; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1241 + /* "sklearn/tree/_tree.pyx":1231 * * for k from 0 <= k < n_outputs: * for c from 0 <= c < n_classes[k]: # <<<<<<<<<<<<<< * label_count_init[k * label_count_stride + c] = 0 * */ - __pyx_t_2 = (__pyx_v_n_classes[__pyx_v_k]); - for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_2; __pyx_v_c++) { + __pyx_t_4 = (__pyx_v_n_classes[__pyx_v_k]); + for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_4; __pyx_v_c++) { - /* "sklearn/tree/_tree.pyx":1242 + /* "sklearn/tree/_tree.pyx":1232 * for k from 0 <= k < n_outputs: * for c from 0 <= c < n_classes[k]: * label_count_init[k * label_count_stride + c] = 0 # <<<<<<<<<<<<<< @@ -11092,7 +11129,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct } } - /* "sklearn/tree/_tree.pyx":1244 + /* "sklearn/tree/_tree.pyx":1234 * label_count_init[k * label_count_stride + c] = 0 * * for j from 0 <= j < n_total_samples: # <<<<<<<<<<<<<< @@ -11102,17 +11139,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct __pyx_t_1 = __pyx_v_n_total_samples; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_1; __pyx_v_j++) { - /* "sklearn/tree/_tree.pyx":1245 + /* "sklearn/tree/_tree.pyx":1235 * * for j from 0 <= j < n_total_samples: * if sample_mask[j] == 0: # <<<<<<<<<<<<<< * continue * if sample_weight != NULL: */ - __pyx_t_3 = ((__pyx_v_sample_mask[__pyx_v_j]) == 0); - if (__pyx_t_3) { + __pyx_t_5 = ((__pyx_v_sample_mask[__pyx_v_j]) == 0); + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":1246 + /* "sklearn/tree/_tree.pyx":1236 * for j from 0 <= j < n_total_samples: * if sample_mask[j] == 0: * continue # <<<<<<<<<<<<<< @@ -11124,17 +11161,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct } __pyx_L9:; - /* "sklearn/tree/_tree.pyx":1247 + /* "sklearn/tree/_tree.pyx":1237 * if sample_mask[j] == 0: * continue * if sample_weight != NULL: # <<<<<<<<<<<<<< * w = sample_weight[j] * */ - __pyx_t_3 = (__pyx_v_sample_weight != NULL); - if (__pyx_t_3) { + __pyx_t_5 = (__pyx_v_sample_weight != NULL); + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":1248 + /* "sklearn/tree/_tree.pyx":1238 * continue * if sample_weight != NULL: * w = sample_weight[j] # <<<<<<<<<<<<<< @@ -11146,17 +11183,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct } __pyx_L10:; - /* "sklearn/tree/_tree.pyx":1250 + /* "sklearn/tree/_tree.pyx":1240 * w = sample_weight[j] * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * c = y[j * y_stride + k] * label_count_init[k * label_count_stride + c] += w */ - __pyx_t_2 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) { + __pyx_t_4 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_4; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1251 + /* "sklearn/tree/_tree.pyx":1241 * * for k from 0 <= k < n_outputs: * c = y[j * y_stride + k] # <<<<<<<<<<<<<< @@ -11165,20 +11202,20 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct */ __pyx_v_c = ((int)(__pyx_v_y[((__pyx_v_j * __pyx_v_y_stride) + __pyx_v_k)])); - /* "sklearn/tree/_tree.pyx":1252 + /* "sklearn/tree/_tree.pyx":1242 * for k from 0 <= k < n_outputs: * c = y[j * y_stride + k] * label_count_init[k * label_count_stride + c] += w # <<<<<<<<<<<<<< * * self.reset() */ - __pyx_t_4 = ((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c); - (__pyx_v_label_count_init[__pyx_t_4]) = ((__pyx_v_label_count_init[__pyx_t_4]) + __pyx_v_w); + __pyx_t_6 = ((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c); + (__pyx_v_label_count_init[__pyx_t_6]) = ((__pyx_v_label_count_init[__pyx_t_6]) + __pyx_v_w); } __pyx_L7_continue:; } - /* "sklearn/tree/_tree.pyx":1254 + /* "sklearn/tree/_tree.pyx":1244 * label_count_init[k * label_count_stride + c] += w * * self.reset() # <<<<<<<<<<<<<< @@ -11190,7 +11227,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init(struct __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1256 +/* "sklearn/tree/_tree.pyx":1246 * self.reset() * * cdef void reset(self): # <<<<<<<<<<<<<< @@ -11209,64 +11246,73 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_reset(struct int __pyx_v_c; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; + int *__pyx_t_2; + double *__pyx_t_3; + double __pyx_t_4; + int __pyx_t_5; __Pyx_RefNannySetupContext("reset", 0); - /* "sklearn/tree/_tree.pyx":1258 + /* "sklearn/tree/_tree.pyx":1248 * cdef void reset(self): * """Reset the criterion for a new feature index.""" * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.n_outputs; + __pyx_t_1 = __pyx_v_self->__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1259 + /* "sklearn/tree/_tree.pyx":1249 * """Reset the criterion for a new feature index.""" * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes # <<<<<<<<<<<<<< * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_init = self.label_count_init */ - __pyx_v_n_classes = __pyx_v_self->n_classes; + __pyx_t_2 = __pyx_v_self->n_classes; + __pyx_v_n_classes = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1260 + /* "sklearn/tree/_tree.pyx":1250 * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride # <<<<<<<<<<<<<< * cdef double* label_count_init = self.label_count_init * cdef double* label_count_left = self.label_count_left */ - __pyx_v_label_count_stride = __pyx_v_self->label_count_stride; + __pyx_t_1 = __pyx_v_self->label_count_stride; + __pyx_v_label_count_stride = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1261 + /* "sklearn/tree/_tree.pyx":1251 * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_init = self.label_count_init # <<<<<<<<<<<<<< * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right */ - __pyx_v_label_count_init = __pyx_v_self->label_count_init; + __pyx_t_3 = __pyx_v_self->label_count_init; + __pyx_v_label_count_init = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1262 + /* "sklearn/tree/_tree.pyx":1252 * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_init = self.label_count_init * cdef double* label_count_left = self.label_count_left # <<<<<<<<<<<<<< * cdef double* label_count_right = self.label_count_right * */ - __pyx_v_label_count_left = __pyx_v_self->label_count_left; + __pyx_t_3 = __pyx_v_self->label_count_left; + __pyx_v_label_count_left = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1263 + /* "sklearn/tree/_tree.pyx":1253 * cdef double* label_count_init = self.label_count_init * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right # <<<<<<<<<<<<<< * * cdef int k = 0 */ - __pyx_v_label_count_right = __pyx_v_self->label_count_right; + __pyx_t_3 = __pyx_v_self->label_count_right; + __pyx_v_label_count_right = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1265 + /* "sklearn/tree/_tree.pyx":1255 * cdef double* label_count_right = self.label_count_right * * cdef int k = 0 # <<<<<<<<<<<<<< @@ -11275,7 +11321,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_reset(struct */ __pyx_v_k = 0; - /* "sklearn/tree/_tree.pyx":1266 + /* "sklearn/tree/_tree.pyx":1256 * * cdef int k = 0 * cdef int c = 0 # <<<<<<<<<<<<<< @@ -11284,7 +11330,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_reset(struct */ __pyx_v_c = 0; - /* "sklearn/tree/_tree.pyx":1267 + /* "sklearn/tree/_tree.pyx":1257 * cdef int k = 0 * cdef int c = 0 * self.n_left = 0 # <<<<<<<<<<<<<< @@ -11293,16 +11339,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_reset(struct */ __pyx_v_self->__pyx_base.n_left = 0; - /* "sklearn/tree/_tree.pyx":1268 + /* "sklearn/tree/_tree.pyx":1258 * cdef int c = 0 * self.n_left = 0 * self.n_right = self.n_samples # <<<<<<<<<<<<<< * self.weighted_n_left = 0.0 * self.weighted_n_right = self.weighted_n_samples */ - __pyx_v_self->__pyx_base.n_right = __pyx_v_self->__pyx_base.n_samples; + __pyx_t_1 = __pyx_v_self->__pyx_base.n_samples; + __pyx_v_self->__pyx_base.n_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1269 + /* "sklearn/tree/_tree.pyx":1259 * self.n_left = 0 * self.n_right = self.n_samples * self.weighted_n_left = 0.0 # <<<<<<<<<<<<<< @@ -11311,16 +11358,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_reset(struct */ __pyx_v_self->__pyx_base.weighted_n_left = 0.0; - /* "sklearn/tree/_tree.pyx":1270 + /* "sklearn/tree/_tree.pyx":1260 * self.n_right = self.n_samples * self.weighted_n_left = 0.0 * self.weighted_n_right = self.weighted_n_samples # <<<<<<<<<<<<<< * * for k from 0 <= k < n_outputs: */ - __pyx_v_self->__pyx_base.weighted_n_right = __pyx_v_self->__pyx_base.weighted_n_samples; + __pyx_t_4 = __pyx_v_self->__pyx_base.weighted_n_samples; + __pyx_v_self->__pyx_base.weighted_n_right = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1272 + /* "sklearn/tree/_tree.pyx":1262 * self.weighted_n_right = self.weighted_n_samples * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< @@ -11330,17 +11378,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_reset(struct __pyx_t_1 = __pyx_v_n_outputs; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1273 + /* "sklearn/tree/_tree.pyx":1263 * * for k from 0 <= k < n_outputs: * for c from 0 <= c < n_classes[k]: # <<<<<<<<<<<<<< * # Reset left label counts to 0 * label_count_left[k * label_count_stride + c] = 0 */ - __pyx_t_2 = (__pyx_v_n_classes[__pyx_v_k]); - for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_2; __pyx_v_c++) { + __pyx_t_5 = (__pyx_v_n_classes[__pyx_v_k]); + for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_5; __pyx_v_c++) { - /* "sklearn/tree/_tree.pyx":1275 + /* "sklearn/tree/_tree.pyx":1265 * for c from 0 <= c < n_classes[k]: * # Reset left label counts to 0 * label_count_left[k * label_count_stride + c] = 0 # <<<<<<<<<<<<<< @@ -11349,7 +11397,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_reset(struct */ (__pyx_v_label_count_left[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]) = 0.0; - /* "sklearn/tree/_tree.pyx":1278 + /* "sklearn/tree/_tree.pyx":1268 * * # Reset right label counts to the initial counts * label_count_right[k * label_count_stride + c] = label_count_init[k * label_count_stride + c] # <<<<<<<<<<<<<< @@ -11363,7 +11411,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_reset(struct __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1280 +/* "sklearn/tree/_tree.pyx":1270 * label_count_right[k * label_count_stride + c] = label_count_init[k * label_count_stride + c] * * cdef bool update(self, int a, int b, # <<<<<<<<<<<<<< @@ -11389,99 +11437,111 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd PyBoolObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; + int *__pyx_t_2; + double *__pyx_t_3; + double __pyx_t_4; int __pyx_t_5; int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update", 0); - /* "sklearn/tree/_tree.pyx":1287 + /* "sklearn/tree/_tree.pyx":1277 * """Update the criteria for each value in interval [a,b) (where a and b * are indices in `X_argsorted_i`).""" * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.n_outputs; + __pyx_t_1 = __pyx_v_self->__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1288 + /* "sklearn/tree/_tree.pyx":1278 * are indices in `X_argsorted_i`).""" * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes # <<<<<<<<<<<<<< * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_left = self.label_count_left */ - __pyx_v_n_classes = __pyx_v_self->n_classes; + __pyx_t_2 = __pyx_v_self->n_classes; + __pyx_v_n_classes = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1289 + /* "sklearn/tree/_tree.pyx":1279 * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride # <<<<<<<<<<<<<< * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right */ - __pyx_v_label_count_stride = __pyx_v_self->label_count_stride; + __pyx_t_1 = __pyx_v_self->label_count_stride; + __pyx_v_label_count_stride = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1290 + /* "sklearn/tree/_tree.pyx":1280 * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_left = self.label_count_left # <<<<<<<<<<<<<< * cdef double* label_count_right = self.label_count_right * cdef int n_left = self.n_left */ - __pyx_v_label_count_left = __pyx_v_self->label_count_left; + __pyx_t_3 = __pyx_v_self->label_count_left; + __pyx_v_label_count_left = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1291 + /* "sklearn/tree/_tree.pyx":1281 * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right # <<<<<<<<<<<<<< * cdef int n_left = self.n_left * cdef int n_right = self.n_right */ - __pyx_v_label_count_right = __pyx_v_self->label_count_right; + __pyx_t_3 = __pyx_v_self->label_count_right; + __pyx_v_label_count_right = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1292 + /* "sklearn/tree/_tree.pyx":1282 * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right * cdef int n_left = self.n_left # <<<<<<<<<<<<<< * cdef int n_right = self.n_right * cdef double weighted_n_left = self.weighted_n_left */ - __pyx_v_n_left = __pyx_v_self->__pyx_base.n_left; + __pyx_t_1 = __pyx_v_self->__pyx_base.n_left; + __pyx_v_n_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1293 + /* "sklearn/tree/_tree.pyx":1283 * cdef double* label_count_right = self.label_count_right * cdef int n_left = self.n_left * cdef int n_right = self.n_right # <<<<<<<<<<<<<< * cdef double weighted_n_left = self.weighted_n_left * cdef double weighted_n_right = self.weighted_n_right */ - __pyx_v_n_right = __pyx_v_self->__pyx_base.n_right; + __pyx_t_1 = __pyx_v_self->__pyx_base.n_right; + __pyx_v_n_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1294 + /* "sklearn/tree/_tree.pyx":1284 * cdef int n_left = self.n_left * cdef int n_right = self.n_right * cdef double weighted_n_left = self.weighted_n_left # <<<<<<<<<<<<<< * cdef double weighted_n_right = self.weighted_n_right * */ - __pyx_v_weighted_n_left = __pyx_v_self->__pyx_base.weighted_n_left; + __pyx_t_4 = __pyx_v_self->__pyx_base.weighted_n_left; + __pyx_v_weighted_n_left = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1295 + /* "sklearn/tree/_tree.pyx":1285 * cdef int n_right = self.n_right * cdef double weighted_n_left = self.weighted_n_left * cdef double weighted_n_right = self.weighted_n_right # <<<<<<<<<<<<<< * * cdef int idx, k, c, s */ - __pyx_v_weighted_n_right = __pyx_v_self->__pyx_base.weighted_n_right; + __pyx_t_4 = __pyx_v_self->__pyx_base.weighted_n_right; + __pyx_v_weighted_n_right = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1298 + /* "sklearn/tree/_tree.pyx":1288 * * cdef int idx, k, c, s * cdef DOUBLE_t w = 1. # <<<<<<<<<<<<<< @@ -11490,7 +11550,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_w = 1.; - /* "sklearn/tree/_tree.pyx":1301 + /* "sklearn/tree/_tree.pyx":1291 * * # post condition: all samples from [0:b) are on the left side * for idx from a <= idx < b: # <<<<<<<<<<<<<< @@ -11500,7 +11560,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd __pyx_t_1 = __pyx_v_b; for (__pyx_v_idx = __pyx_v_a; __pyx_v_idx < __pyx_t_1; __pyx_v_idx++) { - /* "sklearn/tree/_tree.pyx":1302 + /* "sklearn/tree/_tree.pyx":1292 * # post condition: all samples from [0:b) are on the left side * for idx from a <= idx < b: * s = X_argsorted_i[idx] # <<<<<<<<<<<<<< @@ -11509,17 +11569,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_s = (__pyx_v_X_argsorted_i[__pyx_v_idx]); - /* "sklearn/tree/_tree.pyx":1304 + /* "sklearn/tree/_tree.pyx":1294 * s = X_argsorted_i[idx] * * if sample_mask[s] == 0: # <<<<<<<<<<<<<< * continue * if sample_weight != NULL: */ - __pyx_t_2 = ((__pyx_v_sample_mask[__pyx_v_s]) == 0); - if (__pyx_t_2) { + __pyx_t_5 = ((__pyx_v_sample_mask[__pyx_v_s]) == 0); + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":1305 + /* "sklearn/tree/_tree.pyx":1295 * * if sample_mask[s] == 0: * continue # <<<<<<<<<<<<<< @@ -11531,17 +11591,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd } __pyx_L5:; - /* "sklearn/tree/_tree.pyx":1306 + /* "sklearn/tree/_tree.pyx":1296 * if sample_mask[s] == 0: * continue * if sample_weight != NULL: # <<<<<<<<<<<<<< * w = sample_weight[s] * */ - __pyx_t_2 = (__pyx_v_sample_weight != NULL); - if (__pyx_t_2) { + __pyx_t_5 = (__pyx_v_sample_weight != NULL); + if (__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":1307 + /* "sklearn/tree/_tree.pyx":1297 * continue * if sample_weight != NULL: * w = sample_weight[s] # <<<<<<<<<<<<<< @@ -11553,17 +11613,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd } __pyx_L6:; - /* "sklearn/tree/_tree.pyx":1309 + /* "sklearn/tree/_tree.pyx":1299 * w = sample_weight[s] * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * c = y[s * y_stride + k] * label_count_left[k * label_count_stride + c] += w */ - __pyx_t_3 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + __pyx_t_6 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_6; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1310 + /* "sklearn/tree/_tree.pyx":1300 * * for k from 0 <= k < n_outputs: * c = y[s * y_stride + k] # <<<<<<<<<<<<<< @@ -11572,28 +11632,28 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_c = ((int)(__pyx_v_y[((__pyx_v_s * __pyx_v_y_stride) + __pyx_v_k)])); - /* "sklearn/tree/_tree.pyx":1311 + /* "sklearn/tree/_tree.pyx":1301 * for k from 0 <= k < n_outputs: * c = y[s * y_stride + k] * label_count_left[k * label_count_stride + c] += w # <<<<<<<<<<<<<< * label_count_right[k * label_count_stride + c] -= w * */ - __pyx_t_4 = ((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c); - (__pyx_v_label_count_left[__pyx_t_4]) = ((__pyx_v_label_count_left[__pyx_t_4]) + __pyx_v_w); + __pyx_t_7 = ((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c); + (__pyx_v_label_count_left[__pyx_t_7]) = ((__pyx_v_label_count_left[__pyx_t_7]) + __pyx_v_w); - /* "sklearn/tree/_tree.pyx":1312 + /* "sklearn/tree/_tree.pyx":1302 * c = y[s * y_stride + k] * label_count_left[k * label_count_stride + c] += w * label_count_right[k * label_count_stride + c] -= w # <<<<<<<<<<<<<< * * n_left += 1 */ - __pyx_t_4 = ((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c); - (__pyx_v_label_count_right[__pyx_t_4]) = ((__pyx_v_label_count_right[__pyx_t_4]) - __pyx_v_w); + __pyx_t_7 = ((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c); + (__pyx_v_label_count_right[__pyx_t_7]) = ((__pyx_v_label_count_right[__pyx_t_7]) - __pyx_v_w); } - /* "sklearn/tree/_tree.pyx":1314 + /* "sklearn/tree/_tree.pyx":1304 * label_count_right[k * label_count_stride + c] -= w * * n_left += 1 # <<<<<<<<<<<<<< @@ -11602,7 +11662,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_n_left = (__pyx_v_n_left + 1); - /* "sklearn/tree/_tree.pyx":1315 + /* "sklearn/tree/_tree.pyx":1305 * * n_left += 1 * n_right -= 1 # <<<<<<<<<<<<<< @@ -11611,7 +11671,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_n_right = (__pyx_v_n_right - 1); - /* "sklearn/tree/_tree.pyx":1316 + /* "sklearn/tree/_tree.pyx":1306 * n_left += 1 * n_right -= 1 * weighted_n_left += w # <<<<<<<<<<<<<< @@ -11620,7 +11680,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_weighted_n_left = (__pyx_v_weighted_n_left + __pyx_v_w); - /* "sklearn/tree/_tree.pyx":1317 + /* "sklearn/tree/_tree.pyx":1307 * n_right -= 1 * weighted_n_left += w * weighted_n_right -= w # <<<<<<<<<<<<<< @@ -11631,7 +11691,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd __pyx_L3_continue:; } - /* "sklearn/tree/_tree.pyx":1319 + /* "sklearn/tree/_tree.pyx":1309 * weighted_n_right -= w * * self.n_left = n_left # <<<<<<<<<<<<<< @@ -11640,7 +11700,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_self->__pyx_base.n_left = __pyx_v_n_left; - /* "sklearn/tree/_tree.pyx":1320 + /* "sklearn/tree/_tree.pyx":1310 * * self.n_left = n_left * self.n_right = n_right # <<<<<<<<<<<<<< @@ -11649,7 +11709,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_self->__pyx_base.n_right = __pyx_v_n_right; - /* "sklearn/tree/_tree.pyx":1321 + /* "sklearn/tree/_tree.pyx":1311 * self.n_left = n_left * self.n_right = n_right * self.weighted_n_left = weighted_n_left # <<<<<<<<<<<<<< @@ -11658,7 +11718,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_self->__pyx_base.weighted_n_left = __pyx_v_weighted_n_left; - /* "sklearn/tree/_tree.pyx":1322 + /* "sklearn/tree/_tree.pyx":1312 * self.n_right = n_right * self.weighted_n_left = weighted_n_left * self.weighted_n_right = weighted_n_right # <<<<<<<<<<<<<< @@ -11667,31 +11727,31 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd */ __pyx_v_self->__pyx_base.weighted_n_right = __pyx_v_weighted_n_right; - /* "sklearn/tree/_tree.pyx":1325 + /* "sklearn/tree/_tree.pyx":1315 * * # Skip splits that result in nodes with net 0 or negative weight * if (weighted_n_left <= 0 or # <<<<<<<<<<<<<< * (self.weighted_n_samples - weighted_n_left) <= 0): * return False */ - __pyx_t_2 = (__pyx_v_weighted_n_left <= 0.0); - if (!__pyx_t_2) { + __pyx_t_5 = (__pyx_v_weighted_n_left <= 0.0); + if (!__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":1326 + /* "sklearn/tree/_tree.pyx":1316 * # Skip splits that result in nodes with net 0 or negative weight * if (weighted_n_left <= 0 or * (self.weighted_n_samples - weighted_n_left) <= 0): # <<<<<<<<<<<<<< * return False * */ - __pyx_t_5 = ((__pyx_v_self->__pyx_base.weighted_n_samples - __pyx_v_weighted_n_left) <= 0.0); - __pyx_t_6 = __pyx_t_5; + __pyx_t_8 = ((__pyx_v_self->__pyx_base.weighted_n_samples - __pyx_v_weighted_n_left) <= 0.0); + __pyx_t_9 = __pyx_t_8; } else { - __pyx_t_6 = __pyx_t_2; + __pyx_t_9 = __pyx_t_5; } - if (__pyx_t_6) { + if (__pyx_t_9) { - /* "sklearn/tree/_tree.pyx":1327 + /* "sklearn/tree/_tree.pyx":1317 * if (weighted_n_left <= 0 or * (self.weighted_n_samples - weighted_n_left) <= 0): * return False # <<<<<<<<<<<<<< @@ -11699,17 +11759,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd * # Prevent any single class from having a net negative weight */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyBoolObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (!(likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyBoolObject *)__pyx_t_10); + __pyx_t_10 = 0; goto __pyx_L0; goto __pyx_L9; } __pyx_L9:; - /* "sklearn/tree/_tree.pyx":1330 + /* "sklearn/tree/_tree.pyx":1320 * * # Prevent any single class from having a net negative weight * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< @@ -11719,41 +11779,41 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd __pyx_t_1 = __pyx_v_n_outputs; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1331 + /* "sklearn/tree/_tree.pyx":1321 * # Prevent any single class from having a net negative weight * for k from 0 <= k < n_outputs: * for c from 0 <= c < n_classes[k]: # <<<<<<<<<<<<<< * if (label_count_left[k * label_count_stride + c] < 0 or * label_count_right[k * label_count_stride + c] < 0): */ - __pyx_t_3 = (__pyx_v_n_classes[__pyx_v_k]); - for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_3; __pyx_v_c++) { + __pyx_t_6 = (__pyx_v_n_classes[__pyx_v_k]); + for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_6; __pyx_v_c++) { - /* "sklearn/tree/_tree.pyx":1332 + /* "sklearn/tree/_tree.pyx":1322 * for k from 0 <= k < n_outputs: * for c from 0 <= c < n_classes[k]: * if (label_count_left[k * label_count_stride + c] < 0 or # <<<<<<<<<<<<<< * label_count_right[k * label_count_stride + c] < 0): * return False */ - __pyx_t_6 = ((__pyx_v_label_count_left[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]) < 0.0); - if (!__pyx_t_6) { + __pyx_t_9 = ((__pyx_v_label_count_left[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]) < 0.0); + if (!__pyx_t_9) { - /* "sklearn/tree/_tree.pyx":1333 + /* "sklearn/tree/_tree.pyx":1323 * for c from 0 <= c < n_classes[k]: * if (label_count_left[k * label_count_stride + c] < 0 or * label_count_right[k * label_count_stride + c] < 0): # <<<<<<<<<<<<<< * return False * */ - __pyx_t_2 = ((__pyx_v_label_count_right[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]) < 0.0); - __pyx_t_5 = __pyx_t_2; + __pyx_t_5 = ((__pyx_v_label_count_right[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]) < 0.0); + __pyx_t_8 = __pyx_t_5; } else { - __pyx_t_5 = __pyx_t_6; + __pyx_t_8 = __pyx_t_9; } - if (__pyx_t_5) { + if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1334 + /* "sklearn/tree/_tree.pyx":1324 * if (label_count_left[k * label_count_stride + c] < 0 or * label_count_right[k * label_count_stride + c] < 0): * return False # <<<<<<<<<<<<<< @@ -11761,11 +11821,11 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd * return True */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyBoolObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_10 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (!(likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyBoolObject *)__pyx_t_10); + __pyx_t_10 = 0; goto __pyx_L0; goto __pyx_L14; } @@ -11773,7 +11833,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd } } - /* "sklearn/tree/_tree.pyx":1336 + /* "sklearn/tree/_tree.pyx":1326 * return False * * return True # <<<<<<<<<<<<<< @@ -11781,17 +11841,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd * cdef double eval(self): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyBoolObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + if (!(likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyBoolObject *)__pyx_t_10); + __pyx_t_10 = 0; goto __pyx_L0; __pyx_r = ((PyBoolObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("sklearn.tree._tree.ClassificationCriterion.update", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -11800,7 +11860,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_upd return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1338 +/* "sklearn/tree/_tree.pyx":1328 * return True * * cdef double eval(self): # <<<<<<<<<<<<<< @@ -11818,7 +11878,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_eval(CYTHO return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1342 +/* "sklearn/tree/_tree.pyx":1332 * pass * * cdef void init_value(self, double* buffer_value): # <<<<<<<<<<<<<< @@ -11835,46 +11895,52 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init_value(s int __pyx_v_c; __Pyx_RefNannyDeclarations int __pyx_t_1; - int __pyx_t_2; + int *__pyx_t_2; + double *__pyx_t_3; + int __pyx_t_4; __Pyx_RefNannySetupContext("init_value", 0); - /* "sklearn/tree/_tree.pyx":1345 + /* "sklearn/tree/_tree.pyx":1335 * """Get the initial value of the criterion (`init` must be called * before).""" * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.n_outputs; + __pyx_t_1 = __pyx_v_self->__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1346 + /* "sklearn/tree/_tree.pyx":1336 * before).""" * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes # <<<<<<<<<<<<<< * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_init = self.label_count_init */ - __pyx_v_n_classes = __pyx_v_self->n_classes; + __pyx_t_2 = __pyx_v_self->n_classes; + __pyx_v_n_classes = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1347 + /* "sklearn/tree/_tree.pyx":1337 * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride # <<<<<<<<<<<<<< * cdef double* label_count_init = self.label_count_init * */ - __pyx_v_label_count_stride = __pyx_v_self->label_count_stride; + __pyx_t_1 = __pyx_v_self->label_count_stride; + __pyx_v_label_count_stride = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1348 + /* "sklearn/tree/_tree.pyx":1338 * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_init = self.label_count_init # <<<<<<<<<<<<<< * * cdef int k, c */ - __pyx_v_label_count_init = __pyx_v_self->label_count_init; + __pyx_t_3 = __pyx_v_self->label_count_init; + __pyx_v_label_count_init = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1352 + /* "sklearn/tree/_tree.pyx":1342 * cdef int k, c * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< @@ -11884,17 +11950,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init_value(s __pyx_t_1 = __pyx_v_n_outputs; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1353 + /* "sklearn/tree/_tree.pyx":1343 * * for k from 0 <= k < n_outputs: * for c from 0 <= c < n_classes[k]: # <<<<<<<<<<<<<< * buffer_value[k * label_count_stride + c] = ( * label_count_init[k * label_count_stride + c]) */ - __pyx_t_2 = (__pyx_v_n_classes[__pyx_v_k]); - for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_2; __pyx_v_c++) { + __pyx_t_4 = (__pyx_v_n_classes[__pyx_v_k]); + for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_4; __pyx_v_c++) { - /* "sklearn/tree/_tree.pyx":1354 + /* "sklearn/tree/_tree.pyx":1344 * for k from 0 <= k < n_outputs: * for c from 0 <= c < n_classes[k]: * buffer_value[k * label_count_stride + c] = ( # <<<<<<<<<<<<<< @@ -11908,7 +11974,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init_value(s __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1374 +/* "sklearn/tree/_tree.pyx":1364 * """ * * cdef double eval(self): # <<<<<<<<<<<<<< @@ -11935,84 +12001,95 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn double __pyx_v_count_right; double __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + double __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; + int *__pyx_t_3; + double *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; __Pyx_RefNannySetupContext("eval", 0); - /* "sklearn/tree/_tree.pyx":1376 + /* "sklearn/tree/_tree.pyx":1366 * cdef double eval(self): * """Returns Gini index of left branch + Gini index of right branch.""" * cdef double n_samples = self.weighted_n_samples # <<<<<<<<<<<<<< * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes */ - __pyx_v_n_samples = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_samples; + __pyx_t_1 = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_samples; + __pyx_v_n_samples = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1377 + /* "sklearn/tree/_tree.pyx":1367 * """Returns Gini index of left branch + Gini index of right branch.""" * cdef double n_samples = self.weighted_n_samples * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.__pyx_base.n_outputs; + __pyx_t_2 = __pyx_v_self->__pyx_base.__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1378 + /* "sklearn/tree/_tree.pyx":1368 * cdef double n_samples = self.weighted_n_samples * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes # <<<<<<<<<<<<<< * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_left = self.label_count_left */ - __pyx_v_n_classes = __pyx_v_self->__pyx_base.n_classes; + __pyx_t_3 = __pyx_v_self->__pyx_base.n_classes; + __pyx_v_n_classes = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1379 + /* "sklearn/tree/_tree.pyx":1369 * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride # <<<<<<<<<<<<<< * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right */ - __pyx_v_label_count_stride = __pyx_v_self->__pyx_base.label_count_stride; + __pyx_t_2 = __pyx_v_self->__pyx_base.label_count_stride; + __pyx_v_label_count_stride = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1380 + /* "sklearn/tree/_tree.pyx":1370 * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_left = self.label_count_left # <<<<<<<<<<<<<< * cdef double* label_count_right = self.label_count_right * cdef double n_left = self.weighted_n_left */ - __pyx_v_label_count_left = __pyx_v_self->__pyx_base.label_count_left; + __pyx_t_4 = __pyx_v_self->__pyx_base.label_count_left; + __pyx_v_label_count_left = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1381 + /* "sklearn/tree/_tree.pyx":1371 * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right # <<<<<<<<<<<<<< * cdef double n_left = self.weighted_n_left * cdef double n_right = self.weighted_n_right */ - __pyx_v_label_count_right = __pyx_v_self->__pyx_base.label_count_right; + __pyx_t_4 = __pyx_v_self->__pyx_base.label_count_right; + __pyx_v_label_count_right = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1382 + /* "sklearn/tree/_tree.pyx":1372 * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right * cdef double n_left = self.weighted_n_left # <<<<<<<<<<<<<< * cdef double n_right = self.weighted_n_right * */ - __pyx_v_n_left = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_left; + __pyx_t_1 = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_left; + __pyx_v_n_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1383 + /* "sklearn/tree/_tree.pyx":1373 * cdef double* label_count_right = self.label_count_right * cdef double n_left = self.weighted_n_left * cdef double n_right = self.weighted_n_right # <<<<<<<<<<<<<< * * cdef double total_left = 0.0 */ - __pyx_v_n_right = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_right; + __pyx_t_1 = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_right; + __pyx_v_n_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1385 + /* "sklearn/tree/_tree.pyx":1375 * cdef double n_right = self.weighted_n_right * * cdef double total_left = 0.0 # <<<<<<<<<<<<<< @@ -12021,7 +12098,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn */ __pyx_v_total_left = 0.0; - /* "sklearn/tree/_tree.pyx":1386 + /* "sklearn/tree/_tree.pyx":1376 * * cdef double total_left = 0.0 * cdef double total_right = 0.0 # <<<<<<<<<<<<<< @@ -12030,17 +12107,17 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn */ __pyx_v_total_right = 0.0; - /* "sklearn/tree/_tree.pyx":1392 + /* "sklearn/tree/_tree.pyx":1382 * cdef double count_left, count_right * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * H_left = n_left * n_left * H_right = n_right * n_right */ - __pyx_t_1 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { + __pyx_t_2 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1393 + /* "sklearn/tree/_tree.pyx":1383 * * for k from 0 <= k < n_outputs: * H_left = n_left * n_left # <<<<<<<<<<<<<< @@ -12049,7 +12126,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn */ __pyx_v_H_left = (__pyx_v_n_left * __pyx_v_n_left); - /* "sklearn/tree/_tree.pyx":1394 + /* "sklearn/tree/_tree.pyx":1384 * for k from 0 <= k < n_outputs: * H_left = n_left * n_left * H_right = n_right * n_right # <<<<<<<<<<<<<< @@ -12058,17 +12135,17 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn */ __pyx_v_H_right = (__pyx_v_n_right * __pyx_v_n_right); - /* "sklearn/tree/_tree.pyx":1396 + /* "sklearn/tree/_tree.pyx":1386 * H_right = n_right * n_right * * for c from 0 <= c < n_classes[k]: # <<<<<<<<<<<<<< * count_left = label_count_left[k * label_count_stride + c] * if count_left > 0: */ - __pyx_t_2 = (__pyx_v_n_classes[__pyx_v_k]); - for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_2; __pyx_v_c++) { + __pyx_t_5 = (__pyx_v_n_classes[__pyx_v_k]); + for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_5; __pyx_v_c++) { - /* "sklearn/tree/_tree.pyx":1397 + /* "sklearn/tree/_tree.pyx":1387 * * for c from 0 <= c < n_classes[k]: * count_left = label_count_left[k * label_count_stride + c] # <<<<<<<<<<<<<< @@ -12077,17 +12154,17 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn */ __pyx_v_count_left = (__pyx_v_label_count_left[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]); - /* "sklearn/tree/_tree.pyx":1398 + /* "sklearn/tree/_tree.pyx":1388 * for c from 0 <= c < n_classes[k]: * count_left = label_count_left[k * label_count_stride + c] * if count_left > 0: # <<<<<<<<<<<<<< * H_left -= (count_left * count_left) * */ - __pyx_t_3 = (__pyx_v_count_left > 0.0); - if (__pyx_t_3) { + __pyx_t_6 = (__pyx_v_count_left > 0.0); + if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1399 + /* "sklearn/tree/_tree.pyx":1389 * count_left = label_count_left[k * label_count_stride + c] * if count_left > 0: * H_left -= (count_left * count_left) # <<<<<<<<<<<<<< @@ -12099,7 +12176,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn } __pyx_L7:; - /* "sklearn/tree/_tree.pyx":1401 + /* "sklearn/tree/_tree.pyx":1391 * H_left -= (count_left * count_left) * * count_right = label_count_right[k * label_count_stride + c] # <<<<<<<<<<<<<< @@ -12108,17 +12185,17 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn */ __pyx_v_count_right = (__pyx_v_label_count_right[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]); - /* "sklearn/tree/_tree.pyx":1402 + /* "sklearn/tree/_tree.pyx":1392 * * count_right = label_count_right[k * label_count_stride + c] * if count_right > 0: # <<<<<<<<<<<<<< * H_right -= (count_right * count_right) * */ - __pyx_t_3 = (__pyx_v_count_right > 0.0); - if (__pyx_t_3) { + __pyx_t_6 = (__pyx_v_count_right > 0.0); + if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1403 + /* "sklearn/tree/_tree.pyx":1393 * count_right = label_count_right[k * label_count_stride + c] * if count_right > 0: * H_right -= (count_right * count_right) # <<<<<<<<<<<<<< @@ -12131,17 +12208,17 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn __pyx_L8:; } - /* "sklearn/tree/_tree.pyx":1405 + /* "sklearn/tree/_tree.pyx":1395 * H_right -= (count_right * count_right) * * if n_left == 0: # <<<<<<<<<<<<<< * H_left = 0 * else: */ - __pyx_t_3 = (__pyx_v_n_left == 0.0); - if (__pyx_t_3) { + __pyx_t_6 = (__pyx_v_n_left == 0.0); + if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1406 + /* "sklearn/tree/_tree.pyx":1396 * * if n_left == 0: * H_left = 0 # <<<<<<<<<<<<<< @@ -12153,7 +12230,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn } /*else*/ { - /* "sklearn/tree/_tree.pyx":1408 + /* "sklearn/tree/_tree.pyx":1398 * H_left = 0 * else: * H_left /= n_left # <<<<<<<<<<<<<< @@ -12164,17 +12241,17 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn } __pyx_L9:; - /* "sklearn/tree/_tree.pyx":1410 + /* "sklearn/tree/_tree.pyx":1400 * H_left /= n_left * * if n_right == 0: # <<<<<<<<<<<<<< * H_right = 0 * else: */ - __pyx_t_3 = (__pyx_v_n_right == 0.0); - if (__pyx_t_3) { + __pyx_t_6 = (__pyx_v_n_right == 0.0); + if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1411 + /* "sklearn/tree/_tree.pyx":1401 * * if n_right == 0: * H_right = 0 # <<<<<<<<<<<<<< @@ -12186,7 +12263,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn } /*else*/ { - /* "sklearn/tree/_tree.pyx":1413 + /* "sklearn/tree/_tree.pyx":1403 * H_right = 0 * else: * H_right /= n_right # <<<<<<<<<<<<<< @@ -12197,7 +12274,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn } __pyx_L10:; - /* "sklearn/tree/_tree.pyx":1415 + /* "sklearn/tree/_tree.pyx":1405 * H_right /= n_right * * total_left += H_left # <<<<<<<<<<<<<< @@ -12206,7 +12283,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn */ __pyx_v_total_left = (__pyx_v_total_left + __pyx_v_H_left); - /* "sklearn/tree/_tree.pyx":1416 + /* "sklearn/tree/_tree.pyx":1406 * * total_left += H_left * total_right += H_right # <<<<<<<<<<<<<< @@ -12216,7 +12293,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn __pyx_v_total_right = (__pyx_v_total_right + __pyx_v_H_right); } - /* "sklearn/tree/_tree.pyx":1418 + /* "sklearn/tree/_tree.pyx":1408 * total_right += H_right * * return (total_left + total_right) / (n_samples * n_outputs) # <<<<<<<<<<<<<< @@ -12232,7 +12309,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_4Gini_eval(struct __pyx_obj_7sklearn return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1436 +/* "sklearn/tree/_tree.pyx":1426 * """ * * cdef double eval(self): # <<<<<<<<<<<<<< @@ -12258,84 +12335,95 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_eval(struct __pyx_obj_7skle double __pyx_v_e2; double __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + double __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; + int *__pyx_t_3; + double *__pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; __Pyx_RefNannySetupContext("eval", 0); - /* "sklearn/tree/_tree.pyx":1438 + /* "sklearn/tree/_tree.pyx":1428 * cdef double eval(self): * """Returns Entropy of left branch + Entropy index of right branch. """ * cdef double n_samples = self.weighted_n_samples # <<<<<<<<<<<<<< * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes */ - __pyx_v_n_samples = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_samples; + __pyx_t_1 = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_samples; + __pyx_v_n_samples = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1439 + /* "sklearn/tree/_tree.pyx":1429 * """Returns Entropy of left branch + Entropy index of right branch. """ * cdef double n_samples = self.weighted_n_samples * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.__pyx_base.n_outputs; + __pyx_t_2 = __pyx_v_self->__pyx_base.__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1440 + /* "sklearn/tree/_tree.pyx":1430 * cdef double n_samples = self.weighted_n_samples * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes # <<<<<<<<<<<<<< * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_left = self.label_count_left */ - __pyx_v_n_classes = __pyx_v_self->__pyx_base.n_classes; + __pyx_t_3 = __pyx_v_self->__pyx_base.n_classes; + __pyx_v_n_classes = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1441 + /* "sklearn/tree/_tree.pyx":1431 * cdef int n_outputs = self.n_outputs * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride # <<<<<<<<<<<<<< * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right */ - __pyx_v_label_count_stride = __pyx_v_self->__pyx_base.label_count_stride; + __pyx_t_2 = __pyx_v_self->__pyx_base.label_count_stride; + __pyx_v_label_count_stride = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1442 + /* "sklearn/tree/_tree.pyx":1432 * cdef int* n_classes = self.n_classes * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_left = self.label_count_left # <<<<<<<<<<<<<< * cdef double* label_count_right = self.label_count_right * cdef double n_left = self.weighted_n_left */ - __pyx_v_label_count_left = __pyx_v_self->__pyx_base.label_count_left; + __pyx_t_4 = __pyx_v_self->__pyx_base.label_count_left; + __pyx_v_label_count_left = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1443 + /* "sklearn/tree/_tree.pyx":1433 * cdef int label_count_stride = self.label_count_stride * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right # <<<<<<<<<<<<<< * cdef double n_left = self.weighted_n_left * cdef double n_right = self.weighted_n_right */ - __pyx_v_label_count_right = __pyx_v_self->__pyx_base.label_count_right; + __pyx_t_4 = __pyx_v_self->__pyx_base.label_count_right; + __pyx_v_label_count_right = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1444 + /* "sklearn/tree/_tree.pyx":1434 * cdef double* label_count_left = self.label_count_left * cdef double* label_count_right = self.label_count_right * cdef double n_left = self.weighted_n_left # <<<<<<<<<<<<<< * cdef double n_right = self.weighted_n_right * */ - __pyx_v_n_left = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_left; + __pyx_t_1 = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_left; + __pyx_v_n_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1445 + /* "sklearn/tree/_tree.pyx":1435 * cdef double* label_count_right = self.label_count_right * cdef double n_left = self.weighted_n_left * cdef double n_right = self.weighted_n_right # <<<<<<<<<<<<<< * * cdef double total = 0.0 */ - __pyx_v_n_right = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_right; + __pyx_t_1 = __pyx_v_self->__pyx_base.__pyx_base.weighted_n_right; + __pyx_v_n_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1447 + /* "sklearn/tree/_tree.pyx":1437 * cdef double n_right = self.weighted_n_right * * cdef double total = 0.0 # <<<<<<<<<<<<<< @@ -12344,17 +12432,17 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_eval(struct __pyx_obj_7skle */ __pyx_v_total = 0.0; - /* "sklearn/tree/_tree.pyx":1453 + /* "sklearn/tree/_tree.pyx":1443 * cdef double e1, e2 * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * H_left = 0.0 * H_right = 0.0 */ - __pyx_t_1 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { + __pyx_t_2 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1454 + /* "sklearn/tree/_tree.pyx":1444 * * for k from 0 <= k < n_outputs: * H_left = 0.0 # <<<<<<<<<<<<<< @@ -12363,7 +12451,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_eval(struct __pyx_obj_7skle */ __pyx_v_H_left = 0.0; - /* "sklearn/tree/_tree.pyx":1455 + /* "sklearn/tree/_tree.pyx":1445 * for k from 0 <= k < n_outputs: * H_left = 0.0 * H_right = 0.0 # <<<<<<<<<<<<<< @@ -12372,27 +12460,27 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_eval(struct __pyx_obj_7skle */ __pyx_v_H_right = 0.0; - /* "sklearn/tree/_tree.pyx":1457 + /* "sklearn/tree/_tree.pyx":1447 * H_right = 0.0 * * for c from 0 <= c < n_classes[k]: # <<<<<<<<<<<<<< * if label_count_left[k * label_count_stride + c] > 0: * H_left -= ((label_count_left[k * label_count_stride + c] / n_left) * log(label_count_left[k * label_count_stride + c] / n_left)) */ - __pyx_t_2 = (__pyx_v_n_classes[__pyx_v_k]); - for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_2; __pyx_v_c++) { + __pyx_t_5 = (__pyx_v_n_classes[__pyx_v_k]); + for (__pyx_v_c = 0; __pyx_v_c < __pyx_t_5; __pyx_v_c++) { - /* "sklearn/tree/_tree.pyx":1458 + /* "sklearn/tree/_tree.pyx":1448 * * for c from 0 <= c < n_classes[k]: * if label_count_left[k * label_count_stride + c] > 0: # <<<<<<<<<<<<<< * H_left -= ((label_count_left[k * label_count_stride + c] / n_left) * log(label_count_left[k * label_count_stride + c] / n_left)) * */ - __pyx_t_3 = ((__pyx_v_label_count_left[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]) > 0.0); - if (__pyx_t_3) { + __pyx_t_6 = ((__pyx_v_label_count_left[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]) > 0.0); + if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1459 + /* "sklearn/tree/_tree.pyx":1449 * for c from 0 <= c < n_classes[k]: * if label_count_left[k * label_count_stride + c] > 0: * H_left -= ((label_count_left[k * label_count_stride + c] / n_left) * log(label_count_left[k * label_count_stride + c] / n_left)) # <<<<<<<<<<<<<< @@ -12404,17 +12492,17 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_eval(struct __pyx_obj_7skle } __pyx_L7:; - /* "sklearn/tree/_tree.pyx":1461 + /* "sklearn/tree/_tree.pyx":1451 * H_left -= ((label_count_left[k * label_count_stride + c] / n_left) * log(label_count_left[k * label_count_stride + c] / n_left)) * * if self.label_count_right[k * label_count_stride + c] > 0: # <<<<<<<<<<<<<< * H_right -= ((label_count_right[k * label_count_stride + c] / n_right) * log(label_count_right[k * label_count_stride + c] / n_right)) * */ - __pyx_t_3 = ((__pyx_v_self->__pyx_base.label_count_right[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]) > 0.0); - if (__pyx_t_3) { + __pyx_t_6 = ((__pyx_v_self->__pyx_base.label_count_right[((__pyx_v_k * __pyx_v_label_count_stride) + __pyx_v_c)]) > 0.0); + if (__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1462 + /* "sklearn/tree/_tree.pyx":1452 * * if self.label_count_right[k * label_count_stride + c] > 0: * H_right -= ((label_count_right[k * label_count_stride + c] / n_right) * log(label_count_right[k * label_count_stride + c] / n_right)) # <<<<<<<<<<<<<< @@ -12427,7 +12515,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_eval(struct __pyx_obj_7skle __pyx_L8:; } - /* "sklearn/tree/_tree.pyx":1464 + /* "sklearn/tree/_tree.pyx":1454 * H_right -= ((label_count_right[k * label_count_stride + c] / n_right) * log(label_count_right[k * label_count_stride + c] / n_right)) * * e1 = (n_left / n_samples) * H_left # <<<<<<<<<<<<<< @@ -12436,7 +12524,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_eval(struct __pyx_obj_7skle */ __pyx_v_e1 = ((__pyx_v_n_left / __pyx_v_n_samples) * __pyx_v_H_left); - /* "sklearn/tree/_tree.pyx":1465 + /* "sklearn/tree/_tree.pyx":1455 * * e1 = (n_left / n_samples) * H_left * e2 = (n_right / n_samples) * H_right # <<<<<<<<<<<<<< @@ -12445,7 +12533,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_eval(struct __pyx_obj_7skle */ __pyx_v_e2 = ((__pyx_v_n_right / __pyx_v_n_samples) * __pyx_v_H_right); - /* "sklearn/tree/_tree.pyx":1467 + /* "sklearn/tree/_tree.pyx":1457 * e2 = (n_right / n_samples) * H_right * * total += e1 + e2 # <<<<<<<<<<<<<< @@ -12455,7 +12543,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_7Entropy_eval(struct __pyx_obj_7skle __pyx_v_total = (__pyx_v_total + (__pyx_v_e1 + __pyx_v_e2)); } - /* "sklearn/tree/_tree.pyx":1469 + /* "sklearn/tree/_tree.pyx":1459 * total += e1 + e2 * * return total / n_outputs # <<<<<<<<<<<<<< @@ -12496,18 +12584,18 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObj else goto __pyx_L5_argtuple_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 = 1537; __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 = 1527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_n_outputs = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_outputs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n_outputs = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_n_outputs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree.RegressionCriterion.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -12518,7 +12606,7 @@ static int __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_1__cinit__(PyObj return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1537 +/* "sklearn/tree/_tree.pyx":1527 * cdef double* var_right * * def __cinit__(self, int n_outputs): # <<<<<<<<<<<<<< @@ -12544,7 +12632,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "sklearn/tree/_tree.pyx":1539 + /* "sklearn/tree/_tree.pyx":1529 * def __cinit__(self, int n_outputs): * """Constructor.""" * cdef int k = 0 # <<<<<<<<<<<<<< @@ -12553,7 +12641,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_k = 0; - /* "sklearn/tree/_tree.pyx":1541 + /* "sklearn/tree/_tree.pyx":1531 * cdef int k = 0 * * self.n_outputs = n_outputs # <<<<<<<<<<<<<< @@ -12562,7 +12650,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->__pyx_base.n_outputs = __pyx_v_n_outputs; - /* "sklearn/tree/_tree.pyx":1543 + /* "sklearn/tree/_tree.pyx":1533 * self.n_outputs = n_outputs * * self.n_samples = 0 # <<<<<<<<<<<<<< @@ -12571,7 +12659,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->__pyx_base.n_samples = 0; - /* "sklearn/tree/_tree.pyx":1544 + /* "sklearn/tree/_tree.pyx":1534 * * self.n_samples = 0 * self.weighted_n_samples = 0.0 # <<<<<<<<<<<<<< @@ -12580,7 +12668,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->__pyx_base.weighted_n_samples = 0.0; - /* "sklearn/tree/_tree.pyx":1545 + /* "sklearn/tree/_tree.pyx":1535 * self.n_samples = 0 * self.weighted_n_samples = 0.0 * self.n_left = 0 # <<<<<<<<<<<<<< @@ -12589,7 +12677,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->__pyx_base.n_left = 0; - /* "sklearn/tree/_tree.pyx":1546 + /* "sklearn/tree/_tree.pyx":1536 * self.weighted_n_samples = 0.0 * self.n_left = 0 * self.n_right = 0 # <<<<<<<<<<<<<< @@ -12598,7 +12686,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->__pyx_base.n_right = 0; - /* "sklearn/tree/_tree.pyx":1547 + /* "sklearn/tree/_tree.pyx":1537 * self.n_left = 0 * self.n_right = 0 * self.weighted_n_left = 0.0 # <<<<<<<<<<<<<< @@ -12607,7 +12695,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->__pyx_base.weighted_n_left = 0.0; - /* "sklearn/tree/_tree.pyx":1548 + /* "sklearn/tree/_tree.pyx":1538 * self.n_right = 0 * self.weighted_n_left = 0.0 * self.weighted_n_right = 0.0 # <<<<<<<<<<<<<< @@ -12616,7 +12704,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->__pyx_base.weighted_n_right = 0.0; - /* "sklearn/tree/_tree.pyx":1551 + /* "sklearn/tree/_tree.pyx":1541 * * # Allocate * self.mean_left = calloc(n_outputs, sizeof(double)) # <<<<<<<<<<<<<< @@ -12625,7 +12713,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->mean_left = ((double *)calloc(__pyx_v_n_outputs, (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1552 + /* "sklearn/tree/_tree.pyx":1542 * # Allocate * self.mean_left = calloc(n_outputs, sizeof(double)) * self.mean_right = calloc(n_outputs, sizeof(double)) # <<<<<<<<<<<<<< @@ -12634,7 +12722,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->mean_right = ((double *)calloc(__pyx_v_n_outputs, (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1553 + /* "sklearn/tree/_tree.pyx":1543 * self.mean_left = calloc(n_outputs, sizeof(double)) * self.mean_right = calloc(n_outputs, sizeof(double)) * self.mean_init = calloc(n_outputs, sizeof(double)) # <<<<<<<<<<<<<< @@ -12643,7 +12731,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->mean_init = ((double *)calloc(__pyx_v_n_outputs, (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1554 + /* "sklearn/tree/_tree.pyx":1544 * self.mean_right = calloc(n_outputs, sizeof(double)) * self.mean_init = calloc(n_outputs, sizeof(double)) * self.sq_sum_left = calloc(n_outputs, sizeof(double)) # <<<<<<<<<<<<<< @@ -12652,7 +12740,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->sq_sum_left = ((double *)calloc(__pyx_v_n_outputs, (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1555 + /* "sklearn/tree/_tree.pyx":1545 * self.mean_init = calloc(n_outputs, sizeof(double)) * self.sq_sum_left = calloc(n_outputs, sizeof(double)) * self.sq_sum_right = calloc(n_outputs, sizeof(double)) # <<<<<<<<<<<<<< @@ -12661,7 +12749,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->sq_sum_right = ((double *)calloc(__pyx_v_n_outputs, (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1556 + /* "sklearn/tree/_tree.pyx":1546 * self.sq_sum_left = calloc(n_outputs, sizeof(double)) * self.sq_sum_right = calloc(n_outputs, sizeof(double)) * self.sq_sum_init = calloc(n_outputs, sizeof(double)) # <<<<<<<<<<<<<< @@ -12670,7 +12758,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->sq_sum_init = ((double *)calloc(__pyx_v_n_outputs, (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1557 + /* "sklearn/tree/_tree.pyx":1547 * self.sq_sum_right = calloc(n_outputs, sizeof(double)) * self.sq_sum_init = calloc(n_outputs, sizeof(double)) * self.var_left = calloc(n_outputs, sizeof(double)) # <<<<<<<<<<<<<< @@ -12679,7 +12767,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->var_left = ((double *)calloc(__pyx_v_n_outputs, (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1558 + /* "sklearn/tree/_tree.pyx":1548 * self.sq_sum_init = calloc(n_outputs, sizeof(double)) * self.var_left = calloc(n_outputs, sizeof(double)) * self.var_right = calloc(n_outputs, sizeof(double)) # <<<<<<<<<<<<<< @@ -12688,7 +12776,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ __pyx_v_self->var_right = ((double *)calloc(__pyx_v_n_outputs, (sizeof(double)))); - /* "sklearn/tree/_tree.pyx":1561 + /* "sklearn/tree/_tree.pyx":1551 * * # Check for allocation errors * if self.mean_left == NULL or \ # <<<<<<<<<<<<<< @@ -12698,7 +12786,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct __pyx_t_1 = (__pyx_v_self->mean_left == NULL); if (!__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1562 + /* "sklearn/tree/_tree.pyx":1552 * # Check for allocation errors * if self.mean_left == NULL or \ * self.mean_right == NULL or \ # <<<<<<<<<<<<<< @@ -12708,7 +12796,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct __pyx_t_2 = (__pyx_v_self->mean_right == NULL); if (!__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":1563 + /* "sklearn/tree/_tree.pyx":1553 * if self.mean_left == NULL or \ * self.mean_right == NULL or \ * self.mean_init == NULL or \ # <<<<<<<<<<<<<< @@ -12718,7 +12806,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct __pyx_t_3 = (__pyx_v_self->mean_init == NULL); if (!__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":1564 + /* "sklearn/tree/_tree.pyx":1554 * self.mean_right == NULL or \ * self.mean_init == NULL or \ * self.sq_sum_left == NULL or \ # <<<<<<<<<<<<<< @@ -12728,7 +12816,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct __pyx_t_4 = (__pyx_v_self->sq_sum_left == NULL); if (!__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1565 + /* "sklearn/tree/_tree.pyx":1555 * self.mean_init == NULL or \ * self.sq_sum_left == NULL or \ * self.sq_sum_right == NULL or \ # <<<<<<<<<<<<<< @@ -12738,7 +12826,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct __pyx_t_5 = (__pyx_v_self->sq_sum_right == NULL); if (!__pyx_t_5) { - /* "sklearn/tree/_tree.pyx":1566 + /* "sklearn/tree/_tree.pyx":1556 * self.sq_sum_left == NULL or \ * self.sq_sum_right == NULL or \ * self.sq_sum_init == NULL or \ # <<<<<<<<<<<<<< @@ -12748,7 +12836,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct __pyx_t_6 = (__pyx_v_self->sq_sum_init == NULL); if (!__pyx_t_6) { - /* "sklearn/tree/_tree.pyx":1567 + /* "sklearn/tree/_tree.pyx":1557 * self.sq_sum_right == NULL or \ * self.sq_sum_init == NULL or \ * self.var_left == NULL or \ # <<<<<<<<<<<<<< @@ -12758,7 +12846,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct __pyx_t_7 = (__pyx_v_self->var_left == NULL); if (!__pyx_t_7) { - /* "sklearn/tree/_tree.pyx":1568 + /* "sklearn/tree/_tree.pyx":1558 * self.sq_sum_init == NULL or \ * self.var_left == NULL or \ * self.var_right == NULL: # <<<<<<<<<<<<<< @@ -12796,7 +12884,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct } if (__pyx_t_2) { - /* "sklearn/tree/_tree.pyx":1569 + /* "sklearn/tree/_tree.pyx":1559 * self.var_left == NULL or \ * self.var_right == NULL: * free(self.mean_left) # <<<<<<<<<<<<<< @@ -12805,7 +12893,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ free(__pyx_v_self->mean_left); - /* "sklearn/tree/_tree.pyx":1570 + /* "sklearn/tree/_tree.pyx":1560 * self.var_right == NULL: * free(self.mean_left) * free(self.mean_right) # <<<<<<<<<<<<<< @@ -12814,7 +12902,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ free(__pyx_v_self->mean_right); - /* "sklearn/tree/_tree.pyx":1571 + /* "sklearn/tree/_tree.pyx":1561 * free(self.mean_left) * free(self.mean_right) * free(self.mean_init) # <<<<<<<<<<<<<< @@ -12823,7 +12911,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ free(__pyx_v_self->mean_init); - /* "sklearn/tree/_tree.pyx":1572 + /* "sklearn/tree/_tree.pyx":1562 * free(self.mean_right) * free(self.mean_init) * free(self.sq_sum_left) # <<<<<<<<<<<<<< @@ -12832,7 +12920,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ free(__pyx_v_self->sq_sum_left); - /* "sklearn/tree/_tree.pyx":1573 + /* "sklearn/tree/_tree.pyx":1563 * free(self.mean_init) * free(self.sq_sum_left) * free(self.sq_sum_right) # <<<<<<<<<<<<<< @@ -12841,7 +12929,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ free(__pyx_v_self->sq_sum_right); - /* "sklearn/tree/_tree.pyx":1574 + /* "sklearn/tree/_tree.pyx":1564 * free(self.sq_sum_left) * free(self.sq_sum_right) * free(self.sq_sum_init) # <<<<<<<<<<<<<< @@ -12850,7 +12938,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ free(__pyx_v_self->sq_sum_init); - /* "sklearn/tree/_tree.pyx":1575 + /* "sklearn/tree/_tree.pyx":1565 * free(self.sq_sum_right) * free(self.sq_sum_init) * free(self.var_left) # <<<<<<<<<<<<<< @@ -12859,7 +12947,7 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ free(__pyx_v_self->var_left); - /* "sklearn/tree/_tree.pyx":1576 + /* "sklearn/tree/_tree.pyx":1566 * free(self.sq_sum_init) * free(self.var_left) * free(self.var_right) # <<<<<<<<<<<<<< @@ -12868,14 +12956,14 @@ static int __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion___cinit__(struct */ free(__pyx_v_self->var_right); - /* "sklearn/tree/_tree.pyx":1577 + /* "sklearn/tree/_tree.pyx":1567 * free(self.var_left) * free(self.var_right) * raise MemoryError() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; @@ -12899,7 +12987,7 @@ static void __pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_3__dealloc__(Py __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1579 +/* "sklearn/tree/_tree.pyx":1569 * raise MemoryError() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -12911,7 +12999,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(st __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "sklearn/tree/_tree.pyx":1581 + /* "sklearn/tree/_tree.pyx":1571 * def __dealloc__(self): * """Destructor.""" * free(self.mean_left) # <<<<<<<<<<<<<< @@ -12920,7 +13008,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(st */ free(__pyx_v_self->mean_left); - /* "sklearn/tree/_tree.pyx":1582 + /* "sklearn/tree/_tree.pyx":1572 * """Destructor.""" * free(self.mean_left) * free(self.mean_right) # <<<<<<<<<<<<<< @@ -12929,7 +13017,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(st */ free(__pyx_v_self->mean_right); - /* "sklearn/tree/_tree.pyx":1583 + /* "sklearn/tree/_tree.pyx":1573 * free(self.mean_left) * free(self.mean_right) * free(self.mean_init) # <<<<<<<<<<<<<< @@ -12938,7 +13026,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(st */ free(__pyx_v_self->mean_init); - /* "sklearn/tree/_tree.pyx":1584 + /* "sklearn/tree/_tree.pyx":1574 * free(self.mean_right) * free(self.mean_init) * free(self.sq_sum_left) # <<<<<<<<<<<<<< @@ -12947,7 +13035,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(st */ free(__pyx_v_self->sq_sum_left); - /* "sklearn/tree/_tree.pyx":1585 + /* "sklearn/tree/_tree.pyx":1575 * free(self.mean_init) * free(self.sq_sum_left) * free(self.sq_sum_right) # <<<<<<<<<<<<<< @@ -12956,7 +13044,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(st */ free(__pyx_v_self->sq_sum_right); - /* "sklearn/tree/_tree.pyx":1586 + /* "sklearn/tree/_tree.pyx":1576 * free(self.sq_sum_left) * free(self.sq_sum_right) * free(self.sq_sum_init) # <<<<<<<<<<<<<< @@ -12965,7 +13053,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(st */ free(__pyx_v_self->sq_sum_init); - /* "sklearn/tree/_tree.pyx":1587 + /* "sklearn/tree/_tree.pyx":1577 * free(self.sq_sum_right) * free(self.sq_sum_init) * free(self.var_left) # <<<<<<<<<<<<<< @@ -12974,7 +13062,7 @@ static void __pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_2__dealloc__(st */ free(__pyx_v_self->var_left); - /* "sklearn/tree/_tree.pyx":1588 + /* "sklearn/tree/_tree.pyx":1578 * free(self.sq_sum_init) * free(self.var_left) * free(self.var_right) # <<<<<<<<<<<<<< @@ -12997,7 +13085,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_5__reduce_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1590 +/* "sklearn/tree/_tree.pyx":1580 * free(self.var_right) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -13016,7 +13104,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_4__reduce_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/tree/_tree.pyx":1591 + /* "sklearn/tree/_tree.pyx":1581 * * def __reduce__(self): * return (RegressionCriterion, # <<<<<<<<<<<<<< @@ -13025,34 +13113,34 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_4__reduce_ */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/tree/_tree.pyx":1592 + /* "sklearn/tree/_tree.pyx":1582 * def __reduce__(self): * return (RegressionCriterion, * (self.n_outputs,), # <<<<<<<<<<<<<< * self.__getstate__()) * */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->__pyx_base.n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->__pyx_base.n_outputs); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1582; __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 = 1592; __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 = 1582; __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; - /* "sklearn/tree/_tree.pyx":1593 + /* "sklearn/tree/_tree.pyx":1583 * return (RegressionCriterion, * (self.n_outputs,), * self.__getstate__()) # <<<<<<<<<<<<<< * * def __getstate__(self): */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s____getstate__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1583; __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 = 1593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 1583; __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 = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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))); @@ -13092,7 +13180,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_7__getstat return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1595 +/* "sklearn/tree/_tree.pyx":1585 * self.__getstate__()) * * def __getstate__(self): # <<<<<<<<<<<<<< @@ -13109,7 +13197,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_6__getstat int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getstate__", 0); - /* "sklearn/tree/_tree.pyx":1596 + /* "sklearn/tree/_tree.pyx":1586 * * def __getstate__(self): * return {} # <<<<<<<<<<<<<< @@ -13117,7 +13205,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_6__getstat * 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 = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -13146,7 +13234,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_19RegressionCriterion_9__setstat return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1598 +/* "sklearn/tree/_tree.pyx":1588 * return {} * * def __setstate__(self, d): # <<<<<<<<<<<<<< @@ -13165,7 +13253,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree_19RegressionCriterion_8__setstat return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1601 +/* "sklearn/tree/_tree.pyx":1591 * pass * * cdef void init(self, DOUBLE_t* y, int y_stride, # <<<<<<<<<<<<<< @@ -13188,94 +13276,104 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t __pyx_v_y_jk; int __pyx_v_j; __Pyx_RefNannyDeclarations - int __pyx_t_1; + double *__pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; + int __pyx_t_5; __Pyx_RefNannySetupContext("init", 0); - /* "sklearn/tree/_tree.pyx":1610 + /* "sklearn/tree/_tree.pyx":1600 * are in the right branch and store the mean and squared * sum in `self.mean_init` and `self.sq_sum_init`. """ * cdef double* mean_left = self.mean_left # <<<<<<<<<<<<<< * cdef double* mean_right = self.mean_right * cdef double* mean_init = self.mean_init */ - __pyx_v_mean_left = __pyx_v_self->mean_left; + __pyx_t_1 = __pyx_v_self->mean_left; + __pyx_v_mean_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1611 + /* "sklearn/tree/_tree.pyx":1601 * sum in `self.mean_init` and `self.sq_sum_init`. """ * cdef double* mean_left = self.mean_left * cdef double* mean_right = self.mean_right # <<<<<<<<<<<<<< * cdef double* mean_init = self.mean_init * cdef double* sq_sum_left = self.sq_sum_left */ - __pyx_v_mean_right = __pyx_v_self->mean_right; + __pyx_t_1 = __pyx_v_self->mean_right; + __pyx_v_mean_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1612 + /* "sklearn/tree/_tree.pyx":1602 * cdef double* mean_left = self.mean_left * cdef double* mean_right = self.mean_right * cdef double* mean_init = self.mean_init # <<<<<<<<<<<<<< * cdef double* sq_sum_left = self.sq_sum_left * cdef double* sq_sum_right = self.sq_sum_right */ - __pyx_v_mean_init = __pyx_v_self->mean_init; + __pyx_t_1 = __pyx_v_self->mean_init; + __pyx_v_mean_init = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1613 + /* "sklearn/tree/_tree.pyx":1603 * cdef double* mean_right = self.mean_right * cdef double* mean_init = self.mean_init * cdef double* sq_sum_left = self.sq_sum_left # <<<<<<<<<<<<<< * cdef double* sq_sum_right = self.sq_sum_right * cdef double* sq_sum_init = self.sq_sum_init */ - __pyx_v_sq_sum_left = __pyx_v_self->sq_sum_left; + __pyx_t_1 = __pyx_v_self->sq_sum_left; + __pyx_v_sq_sum_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1614 + /* "sklearn/tree/_tree.pyx":1604 * cdef double* mean_init = self.mean_init * cdef double* sq_sum_left = self.sq_sum_left * cdef double* sq_sum_right = self.sq_sum_right # <<<<<<<<<<<<<< * cdef double* sq_sum_init = self.sq_sum_init * cdef double* var_left = self.var_left */ - __pyx_v_sq_sum_right = __pyx_v_self->sq_sum_right; + __pyx_t_1 = __pyx_v_self->sq_sum_right; + __pyx_v_sq_sum_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1615 + /* "sklearn/tree/_tree.pyx":1605 * cdef double* sq_sum_left = self.sq_sum_left * cdef double* sq_sum_right = self.sq_sum_right * cdef double* sq_sum_init = self.sq_sum_init # <<<<<<<<<<<<<< * cdef double* var_left = self.var_left * cdef double* var_right = self.var_right */ - __pyx_v_sq_sum_init = __pyx_v_self->sq_sum_init; + __pyx_t_1 = __pyx_v_self->sq_sum_init; + __pyx_v_sq_sum_init = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1616 + /* "sklearn/tree/_tree.pyx":1606 * cdef double* sq_sum_right = self.sq_sum_right * cdef double* sq_sum_init = self.sq_sum_init * cdef double* var_left = self.var_left # <<<<<<<<<<<<<< * cdef double* var_right = self.var_right * cdef int n_outputs = self.n_outputs */ - __pyx_v_var_left = __pyx_v_self->var_left; + __pyx_t_1 = __pyx_v_self->var_left; + __pyx_v_var_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1617 + /* "sklearn/tree/_tree.pyx":1607 * cdef double* sq_sum_init = self.sq_sum_init * cdef double* var_left = self.var_left * cdef double* var_right = self.var_right # <<<<<<<<<<<<<< * cdef int n_outputs = self.n_outputs * */ - __pyx_v_var_right = __pyx_v_self->var_right; + __pyx_t_1 = __pyx_v_self->var_right; + __pyx_v_var_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1618 + /* "sklearn/tree/_tree.pyx":1608 * cdef double* var_left = self.var_left * cdef double* var_right = self.var_right * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * * cdef int k = 0 */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.n_outputs; + __pyx_t_2 = __pyx_v_self->__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1620 + /* "sklearn/tree/_tree.pyx":1610 * cdef int n_outputs = self.n_outputs * * cdef int k = 0 # <<<<<<<<<<<<<< @@ -13284,17 +13382,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ __pyx_v_k = 0; - /* "sklearn/tree/_tree.pyx":1622 + /* "sklearn/tree/_tree.pyx":1612 * cdef int k = 0 * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * mean_left[k] = 0.0 * mean_right[k] = 0.0 */ - __pyx_t_1 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { + __pyx_t_2 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1623 + /* "sklearn/tree/_tree.pyx":1613 * * for k from 0 <= k < n_outputs: * mean_left[k] = 0.0 # <<<<<<<<<<<<<< @@ -13303,7 +13401,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ (__pyx_v_mean_left[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1624 + /* "sklearn/tree/_tree.pyx":1614 * for k from 0 <= k < n_outputs: * mean_left[k] = 0.0 * mean_right[k] = 0.0 # <<<<<<<<<<<<<< @@ -13312,7 +13410,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ (__pyx_v_mean_right[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1625 + /* "sklearn/tree/_tree.pyx":1615 * mean_left[k] = 0.0 * mean_right[k] = 0.0 * mean_init[k] = 0.0 # <<<<<<<<<<<<<< @@ -13321,7 +13419,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ (__pyx_v_mean_init[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1626 + /* "sklearn/tree/_tree.pyx":1616 * mean_right[k] = 0.0 * mean_init[k] = 0.0 * sq_sum_right[k] = 0.0 # <<<<<<<<<<<<<< @@ -13330,7 +13428,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ (__pyx_v_sq_sum_right[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1627 + /* "sklearn/tree/_tree.pyx":1617 * mean_init[k] = 0.0 * sq_sum_right[k] = 0.0 * sq_sum_left[k] = 0.0 # <<<<<<<<<<<<<< @@ -13339,7 +13437,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ (__pyx_v_sq_sum_left[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1628 + /* "sklearn/tree/_tree.pyx":1618 * sq_sum_right[k] = 0.0 * sq_sum_left[k] = 0.0 * sq_sum_init[k] = 0.0 # <<<<<<<<<<<<<< @@ -13348,7 +13446,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ (__pyx_v_sq_sum_init[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1629 + /* "sklearn/tree/_tree.pyx":1619 * sq_sum_left[k] = 0.0 * sq_sum_init[k] = 0.0 * var_left[k] = 0.0 # <<<<<<<<<<<<<< @@ -13357,7 +13455,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ (__pyx_v_var_left[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1630 + /* "sklearn/tree/_tree.pyx":1620 * sq_sum_init[k] = 0.0 * var_left[k] = 0.0 * var_right[k] = 0.0 # <<<<<<<<<<<<<< @@ -13367,7 +13465,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py (__pyx_v_var_right[__pyx_v_k]) = 0.0; } - /* "sklearn/tree/_tree.pyx":1632 + /* "sklearn/tree/_tree.pyx":1622 * var_right[k] = 0.0 * * self.n_samples = n_samples # <<<<<<<<<<<<<< @@ -13376,7 +13474,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ __pyx_v_self->__pyx_base.n_samples = __pyx_v_n_samples; - /* "sklearn/tree/_tree.pyx":1633 + /* "sklearn/tree/_tree.pyx":1623 * * self.n_samples = n_samples * self.weighted_n_samples = weighted_n_samples # <<<<<<<<<<<<<< @@ -13385,7 +13483,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ __pyx_v_self->__pyx_base.weighted_n_samples = __pyx_v_weighted_n_samples; - /* "sklearn/tree/_tree.pyx":1635 + /* "sklearn/tree/_tree.pyx":1625 * self.weighted_n_samples = weighted_n_samples * * cdef DOUBLE_t w = 1.0 # <<<<<<<<<<<<<< @@ -13394,7 +13492,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ __pyx_v_w = 1.0; - /* "sklearn/tree/_tree.pyx":1636 + /* "sklearn/tree/_tree.pyx":1626 * * cdef DOUBLE_t w = 1.0 * cdef DOUBLE_t y_jk = 0.0 # <<<<<<<<<<<<<< @@ -13403,7 +13501,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ __pyx_v_y_jk = 0.0; - /* "sklearn/tree/_tree.pyx":1637 + /* "sklearn/tree/_tree.pyx":1627 * cdef DOUBLE_t w = 1.0 * cdef DOUBLE_t y_jk = 0.0 * cdef int j = 0 # <<<<<<<<<<<<<< @@ -13412,27 +13510,27 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ __pyx_v_j = 0; - /* "sklearn/tree/_tree.pyx":1639 + /* "sklearn/tree/_tree.pyx":1629 * cdef int j = 0 * * for j from 0 <= j < n_total_samples: # <<<<<<<<<<<<<< * if sample_mask[j] == 0: * continue */ - __pyx_t_1 = __pyx_v_n_total_samples; - for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_1; __pyx_v_j++) { + __pyx_t_2 = __pyx_v_n_total_samples; + for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_2; __pyx_v_j++) { - /* "sklearn/tree/_tree.pyx":1640 + /* "sklearn/tree/_tree.pyx":1630 * * for j from 0 <= j < n_total_samples: * if sample_mask[j] == 0: # <<<<<<<<<<<<<< * continue * if sample_weight != NULL: */ - __pyx_t_2 = ((__pyx_v_sample_mask[__pyx_v_j]) == 0); - if (__pyx_t_2) { + __pyx_t_3 = ((__pyx_v_sample_mask[__pyx_v_j]) == 0); + if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":1641 + /* "sklearn/tree/_tree.pyx":1631 * for j from 0 <= j < n_total_samples: * if sample_mask[j] == 0: * continue # <<<<<<<<<<<<<< @@ -13444,17 +13542,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py } __pyx_L7:; - /* "sklearn/tree/_tree.pyx":1642 + /* "sklearn/tree/_tree.pyx":1632 * if sample_mask[j] == 0: * continue * if sample_weight != NULL: # <<<<<<<<<<<<<< * w = sample_weight[j] * */ - __pyx_t_2 = (__pyx_v_sample_weight != NULL); - if (__pyx_t_2) { + __pyx_t_3 = (__pyx_v_sample_weight != NULL); + if (__pyx_t_3) { - /* "sklearn/tree/_tree.pyx":1643 + /* "sklearn/tree/_tree.pyx":1633 * continue * if sample_weight != NULL: * w = sample_weight[j] # <<<<<<<<<<<<<< @@ -13466,17 +13564,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py } __pyx_L8:; - /* "sklearn/tree/_tree.pyx":1645 + /* "sklearn/tree/_tree.pyx":1635 * w = sample_weight[j] * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * y_jk = y[j * y_stride + k] * sq_sum_init[k] += w * y_jk * y_jk */ - __pyx_t_3 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + __pyx_t_4 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_4; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1646 + /* "sklearn/tree/_tree.pyx":1636 * * for k from 0 <= k < n_outputs: * y_jk = y[j * y_stride + k] # <<<<<<<<<<<<<< @@ -13485,51 +13583,51 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py */ __pyx_v_y_jk = (__pyx_v_y[((__pyx_v_j * __pyx_v_y_stride) + __pyx_v_k)]); - /* "sklearn/tree/_tree.pyx":1647 + /* "sklearn/tree/_tree.pyx":1637 * for k from 0 <= k < n_outputs: * y_jk = y[j * y_stride + k] * sq_sum_init[k] += w * y_jk * y_jk # <<<<<<<<<<<<<< * mean_init[k] += w * y_jk * */ - __pyx_t_4 = __pyx_v_k; - (__pyx_v_sq_sum_init[__pyx_t_4]) = ((__pyx_v_sq_sum_init[__pyx_t_4]) + ((__pyx_v_w * __pyx_v_y_jk) * __pyx_v_y_jk)); + __pyx_t_5 = __pyx_v_k; + (__pyx_v_sq_sum_init[__pyx_t_5]) = ((__pyx_v_sq_sum_init[__pyx_t_5]) + ((__pyx_v_w * __pyx_v_y_jk) * __pyx_v_y_jk)); - /* "sklearn/tree/_tree.pyx":1648 + /* "sklearn/tree/_tree.pyx":1638 * y_jk = y[j * y_stride + k] * sq_sum_init[k] += w * y_jk * y_jk * mean_init[k] += w * y_jk # <<<<<<<<<<<<<< * * for k from 0 <= k < n_outputs: */ - __pyx_t_4 = __pyx_v_k; - (__pyx_v_mean_init[__pyx_t_4]) = ((__pyx_v_mean_init[__pyx_t_4]) + (__pyx_v_w * __pyx_v_y_jk)); + __pyx_t_5 = __pyx_v_k; + (__pyx_v_mean_init[__pyx_t_5]) = ((__pyx_v_mean_init[__pyx_t_5]) + (__pyx_v_w * __pyx_v_y_jk)); } __pyx_L5_continue:; } - /* "sklearn/tree/_tree.pyx":1650 + /* "sklearn/tree/_tree.pyx":1640 * mean_init[k] += w * y_jk * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * mean_init[k] /= weighted_n_samples * */ - __pyx_t_1 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { + __pyx_t_2 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1651 + /* "sklearn/tree/_tree.pyx":1641 * * for k from 0 <= k < n_outputs: * mean_init[k] /= weighted_n_samples # <<<<<<<<<<<<<< * * self.reset() */ - __pyx_t_3 = __pyx_v_k; - (__pyx_v_mean_init[__pyx_t_3]) = ((__pyx_v_mean_init[__pyx_t_3]) / __pyx_v_weighted_n_samples); + __pyx_t_4 = __pyx_v_k; + (__pyx_v_mean_init[__pyx_t_4]) = ((__pyx_v_mean_init[__pyx_t_4]) / __pyx_v_weighted_n_samples); } - /* "sklearn/tree/_tree.pyx":1653 + /* "sklearn/tree/_tree.pyx":1643 * mean_init[k] /= weighted_n_samples * * self.reset() # <<<<<<<<<<<<<< @@ -13541,7 +13639,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init(struct __py __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1655 +/* "sklearn/tree/_tree.pyx":1645 * self.reset() * * cdef void reset(self): # <<<<<<<<<<<<<< @@ -13562,100 +13660,112 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p int __pyx_v_n_outputs; int __pyx_v_k; __Pyx_RefNannyDeclarations - int __pyx_t_1; + double *__pyx_t_1; + double __pyx_t_2; + int __pyx_t_3; __Pyx_RefNannySetupContext("reset", 0); - /* "sklearn/tree/_tree.pyx":1662 + /* "sklearn/tree/_tree.pyx":1652 * right branch. * """ * cdef double* mean_left = self.mean_left # <<<<<<<<<<<<<< * cdef double* mean_right = self.mean_right * cdef double* mean_init = self.mean_init */ - __pyx_v_mean_left = __pyx_v_self->mean_left; + __pyx_t_1 = __pyx_v_self->mean_left; + __pyx_v_mean_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1663 + /* "sklearn/tree/_tree.pyx":1653 * """ * cdef double* mean_left = self.mean_left * cdef double* mean_right = self.mean_right # <<<<<<<<<<<<<< * cdef double* mean_init = self.mean_init * cdef double* sq_sum_left = self.sq_sum_left */ - __pyx_v_mean_right = __pyx_v_self->mean_right; + __pyx_t_1 = __pyx_v_self->mean_right; + __pyx_v_mean_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1664 + /* "sklearn/tree/_tree.pyx":1654 * cdef double* mean_left = self.mean_left * cdef double* mean_right = self.mean_right * cdef double* mean_init = self.mean_init # <<<<<<<<<<<<<< * cdef double* sq_sum_left = self.sq_sum_left * cdef double* sq_sum_right = self.sq_sum_right */ - __pyx_v_mean_init = __pyx_v_self->mean_init; + __pyx_t_1 = __pyx_v_self->mean_init; + __pyx_v_mean_init = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1665 + /* "sklearn/tree/_tree.pyx":1655 * cdef double* mean_right = self.mean_right * cdef double* mean_init = self.mean_init * cdef double* sq_sum_left = self.sq_sum_left # <<<<<<<<<<<<<< * cdef double* sq_sum_right = self.sq_sum_right * cdef double* sq_sum_init = self.sq_sum_init */ - __pyx_v_sq_sum_left = __pyx_v_self->sq_sum_left; + __pyx_t_1 = __pyx_v_self->sq_sum_left; + __pyx_v_sq_sum_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1666 + /* "sklearn/tree/_tree.pyx":1656 * cdef double* mean_init = self.mean_init * cdef double* sq_sum_left = self.sq_sum_left * cdef double* sq_sum_right = self.sq_sum_right # <<<<<<<<<<<<<< * cdef double* sq_sum_init = self.sq_sum_init * cdef double* var_left = self.var_left */ - __pyx_v_sq_sum_right = __pyx_v_self->sq_sum_right; + __pyx_t_1 = __pyx_v_self->sq_sum_right; + __pyx_v_sq_sum_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1667 + /* "sklearn/tree/_tree.pyx":1657 * cdef double* sq_sum_left = self.sq_sum_left * cdef double* sq_sum_right = self.sq_sum_right * cdef double* sq_sum_init = self.sq_sum_init # <<<<<<<<<<<<<< * cdef double* var_left = self.var_left * cdef double* var_right = self.var_right */ - __pyx_v_sq_sum_init = __pyx_v_self->sq_sum_init; + __pyx_t_1 = __pyx_v_self->sq_sum_init; + __pyx_v_sq_sum_init = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1668 + /* "sklearn/tree/_tree.pyx":1658 * cdef double* sq_sum_right = self.sq_sum_right * cdef double* sq_sum_init = self.sq_sum_init * cdef double* var_left = self.var_left # <<<<<<<<<<<<<< * cdef double* var_right = self.var_right * */ - __pyx_v_var_left = __pyx_v_self->var_left; + __pyx_t_1 = __pyx_v_self->var_left; + __pyx_v_var_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1669 + /* "sklearn/tree/_tree.pyx":1659 * cdef double* sq_sum_init = self.sq_sum_init * cdef double* var_left = self.var_left * cdef double* var_right = self.var_right # <<<<<<<<<<<<<< * * cdef double weighted_n_samples = self.weighted_n_samples */ - __pyx_v_var_right = __pyx_v_self->var_right; + __pyx_t_1 = __pyx_v_self->var_right; + __pyx_v_var_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1671 + /* "sklearn/tree/_tree.pyx":1661 * cdef double* var_right = self.var_right * * cdef double weighted_n_samples = self.weighted_n_samples # <<<<<<<<<<<<<< * cdef int n_outputs = self.n_outputs * */ - __pyx_v_weighted_n_samples = __pyx_v_self->__pyx_base.weighted_n_samples; + __pyx_t_2 = __pyx_v_self->__pyx_base.weighted_n_samples; + __pyx_v_weighted_n_samples = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1672 + /* "sklearn/tree/_tree.pyx":1662 * * cdef double weighted_n_samples = self.weighted_n_samples * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * * cdef int k = 0 */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.n_outputs; + __pyx_t_3 = __pyx_v_self->__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1674 + /* "sklearn/tree/_tree.pyx":1664 * cdef int n_outputs = self.n_outputs * * cdef int k = 0 # <<<<<<<<<<<<<< @@ -13664,16 +13774,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p */ __pyx_v_k = 0; - /* "sklearn/tree/_tree.pyx":1676 + /* "sklearn/tree/_tree.pyx":1666 * cdef int k = 0 * * self.n_right = self.n_samples # <<<<<<<<<<<<<< * self.n_left = 0 * self.weighted_n_right = self.weighted_n_samples */ - __pyx_v_self->__pyx_base.n_right = __pyx_v_self->__pyx_base.n_samples; + __pyx_t_3 = __pyx_v_self->__pyx_base.n_samples; + __pyx_v_self->__pyx_base.n_right = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1677 + /* "sklearn/tree/_tree.pyx":1667 * * self.n_right = self.n_samples * self.n_left = 0 # <<<<<<<<<<<<<< @@ -13682,16 +13793,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p */ __pyx_v_self->__pyx_base.n_left = 0; - /* "sklearn/tree/_tree.pyx":1678 + /* "sklearn/tree/_tree.pyx":1668 * self.n_right = self.n_samples * self.n_left = 0 * self.weighted_n_right = self.weighted_n_samples # <<<<<<<<<<<<<< * self.weighted_n_left = 0.0 * */ - __pyx_v_self->__pyx_base.weighted_n_right = __pyx_v_self->__pyx_base.weighted_n_samples; + __pyx_t_2 = __pyx_v_self->__pyx_base.weighted_n_samples; + __pyx_v_self->__pyx_base.weighted_n_right = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1679 + /* "sklearn/tree/_tree.pyx":1669 * self.n_left = 0 * self.weighted_n_right = self.weighted_n_samples * self.weighted_n_left = 0.0 # <<<<<<<<<<<<<< @@ -13700,17 +13812,17 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p */ __pyx_v_self->__pyx_base.weighted_n_left = 0.0; - /* "sklearn/tree/_tree.pyx":1681 + /* "sklearn/tree/_tree.pyx":1671 * self.weighted_n_left = 0.0 * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * mean_right[k] = mean_init[k] * mean_left[k] = 0.0 */ - __pyx_t_1 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { + __pyx_t_3 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1682 + /* "sklearn/tree/_tree.pyx":1672 * * for k from 0 <= k < n_outputs: * mean_right[k] = mean_init[k] # <<<<<<<<<<<<<< @@ -13719,7 +13831,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p */ (__pyx_v_mean_right[__pyx_v_k]) = (__pyx_v_mean_init[__pyx_v_k]); - /* "sklearn/tree/_tree.pyx":1683 + /* "sklearn/tree/_tree.pyx":1673 * for k from 0 <= k < n_outputs: * mean_right[k] = mean_init[k] * mean_left[k] = 0.0 # <<<<<<<<<<<<<< @@ -13728,7 +13840,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p */ (__pyx_v_mean_left[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1684 + /* "sklearn/tree/_tree.pyx":1674 * mean_right[k] = mean_init[k] * mean_left[k] = 0.0 * sq_sum_right[k] = sq_sum_init[k] # <<<<<<<<<<<<<< @@ -13737,7 +13849,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p */ (__pyx_v_sq_sum_right[__pyx_v_k]) = (__pyx_v_sq_sum_init[__pyx_v_k]); - /* "sklearn/tree/_tree.pyx":1685 + /* "sklearn/tree/_tree.pyx":1675 * mean_left[k] = 0.0 * sq_sum_right[k] = sq_sum_init[k] * sq_sum_left[k] = 0.0 # <<<<<<<<<<<<<< @@ -13746,7 +13858,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p */ (__pyx_v_sq_sum_left[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1686 + /* "sklearn/tree/_tree.pyx":1676 * sq_sum_right[k] = sq_sum_init[k] * sq_sum_left[k] = 0.0 * var_left[k] = 0.0 # <<<<<<<<<<<<<< @@ -13755,7 +13867,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p */ (__pyx_v_var_left[__pyx_v_k]) = 0.0; - /* "sklearn/tree/_tree.pyx":1687 + /* "sklearn/tree/_tree.pyx":1677 * sq_sum_left[k] = 0.0 * var_left[k] = 0.0 * var_right[k] = (sq_sum_right[k] - # <<<<<<<<<<<<<< @@ -13768,7 +13880,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_reset(struct __p __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1690 +/* "sklearn/tree/_tree.pyx":1680 * weighted_n_samples * (mean_right[k] * mean_right[k])) * * cdef bool update(self, int a, int b, # <<<<<<<<<<<<<< @@ -13797,136 +13909,151 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( int __pyx_v_k; PyBoolObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + double *__pyx_t_1; int __pyx_t_2; - int __pyx_t_3; + double __pyx_t_3; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("update", 0); - /* "sklearn/tree/_tree.pyx":1697 + /* "sklearn/tree/_tree.pyx":1687 * """Update the criteria for each value in interval [a,b) (where a and b * are indices in `X_argsorted_i`).""" * cdef double* mean_left = self.mean_left # <<<<<<<<<<<<<< * cdef double* mean_right = self.mean_right * cdef double* sq_sum_left = self.sq_sum_left */ - __pyx_v_mean_left = __pyx_v_self->mean_left; + __pyx_t_1 = __pyx_v_self->mean_left; + __pyx_v_mean_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1698 + /* "sklearn/tree/_tree.pyx":1688 * are indices in `X_argsorted_i`).""" * cdef double* mean_left = self.mean_left * cdef double* mean_right = self.mean_right # <<<<<<<<<<<<<< * cdef double* sq_sum_left = self.sq_sum_left * cdef double* sq_sum_right = self.sq_sum_right */ - __pyx_v_mean_right = __pyx_v_self->mean_right; + __pyx_t_1 = __pyx_v_self->mean_right; + __pyx_v_mean_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1699 + /* "sklearn/tree/_tree.pyx":1689 * cdef double* mean_left = self.mean_left * cdef double* mean_right = self.mean_right * cdef double* sq_sum_left = self.sq_sum_left # <<<<<<<<<<<<<< * cdef double* sq_sum_right = self.sq_sum_right * cdef double* var_left = self.var_left */ - __pyx_v_sq_sum_left = __pyx_v_self->sq_sum_left; + __pyx_t_1 = __pyx_v_self->sq_sum_left; + __pyx_v_sq_sum_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1700 + /* "sklearn/tree/_tree.pyx":1690 * cdef double* mean_right = self.mean_right * cdef double* sq_sum_left = self.sq_sum_left * cdef double* sq_sum_right = self.sq_sum_right # <<<<<<<<<<<<<< * cdef double* var_left = self.var_left * cdef double* var_right = self.var_right */ - __pyx_v_sq_sum_right = __pyx_v_self->sq_sum_right; + __pyx_t_1 = __pyx_v_self->sq_sum_right; + __pyx_v_sq_sum_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1701 + /* "sklearn/tree/_tree.pyx":1691 * cdef double* sq_sum_left = self.sq_sum_left * cdef double* sq_sum_right = self.sq_sum_right * cdef double* var_left = self.var_left # <<<<<<<<<<<<<< * cdef double* var_right = self.var_right * */ - __pyx_v_var_left = __pyx_v_self->var_left; + __pyx_t_1 = __pyx_v_self->var_left; + __pyx_v_var_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1702 + /* "sklearn/tree/_tree.pyx":1692 * cdef double* sq_sum_right = self.sq_sum_right * cdef double* var_left = self.var_left * cdef double* var_right = self.var_right # <<<<<<<<<<<<<< * * cdef int n_samples = self.n_samples */ - __pyx_v_var_right = __pyx_v_self->var_right; + __pyx_t_1 = __pyx_v_self->var_right; + __pyx_v_var_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1704 + /* "sklearn/tree/_tree.pyx":1694 * cdef double* var_right = self.var_right * * cdef int n_samples = self.n_samples # <<<<<<<<<<<<<< * cdef double weighted_n_samples = self.weighted_n_samples * cdef int n_outputs = self.n_outputs */ - __pyx_v_n_samples = __pyx_v_self->__pyx_base.n_samples; + __pyx_t_2 = __pyx_v_self->__pyx_base.n_samples; + __pyx_v_n_samples = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1705 + /* "sklearn/tree/_tree.pyx":1695 * * cdef int n_samples = self.n_samples * cdef double weighted_n_samples = self.weighted_n_samples # <<<<<<<<<<<<<< * cdef int n_outputs = self.n_outputs * cdef int n_left = self.n_left */ - __pyx_v_weighted_n_samples = __pyx_v_self->__pyx_base.weighted_n_samples; + __pyx_t_3 = __pyx_v_self->__pyx_base.weighted_n_samples; + __pyx_v_weighted_n_samples = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1706 + /* "sklearn/tree/_tree.pyx":1696 * cdef int n_samples = self.n_samples * cdef double weighted_n_samples = self.weighted_n_samples * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * cdef int n_left = self.n_left * cdef int n_right = self.n_right */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.n_outputs; + __pyx_t_2 = __pyx_v_self->__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1707 + /* "sklearn/tree/_tree.pyx":1697 * cdef double weighted_n_samples = self.weighted_n_samples * cdef int n_outputs = self.n_outputs * cdef int n_left = self.n_left # <<<<<<<<<<<<<< * cdef int n_right = self.n_right * cdef double weighted_n_left = self.weighted_n_left */ - __pyx_v_n_left = __pyx_v_self->__pyx_base.n_left; + __pyx_t_2 = __pyx_v_self->__pyx_base.n_left; + __pyx_v_n_left = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1708 + /* "sklearn/tree/_tree.pyx":1698 * cdef int n_outputs = self.n_outputs * cdef int n_left = self.n_left * cdef int n_right = self.n_right # <<<<<<<<<<<<<< * cdef double weighted_n_left = self.weighted_n_left * cdef double weighted_n_right = self.weighted_n_right */ - __pyx_v_n_right = __pyx_v_self->__pyx_base.n_right; + __pyx_t_2 = __pyx_v_self->__pyx_base.n_right; + __pyx_v_n_right = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1709 + /* "sklearn/tree/_tree.pyx":1699 * cdef int n_left = self.n_left * cdef int n_right = self.n_right * cdef double weighted_n_left = self.weighted_n_left # <<<<<<<<<<<<<< * cdef double weighted_n_right = self.weighted_n_right * */ - __pyx_v_weighted_n_left = __pyx_v_self->__pyx_base.weighted_n_left; + __pyx_t_3 = __pyx_v_self->__pyx_base.weighted_n_left; + __pyx_v_weighted_n_left = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1710 + /* "sklearn/tree/_tree.pyx":1700 * cdef int n_right = self.n_right * cdef double weighted_n_left = self.weighted_n_left * cdef double weighted_n_right = self.weighted_n_right # <<<<<<<<<<<<<< * * cdef DOUBLE_t w = 1.0 */ - __pyx_v_weighted_n_right = __pyx_v_self->__pyx_base.weighted_n_right; + __pyx_t_3 = __pyx_v_self->__pyx_base.weighted_n_right; + __pyx_v_weighted_n_right = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":1712 + /* "sklearn/tree/_tree.pyx":1702 * cdef double weighted_n_right = self.weighted_n_right * * cdef DOUBLE_t w = 1.0 # <<<<<<<<<<<<<< @@ -13935,7 +14062,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_w = 1.0; - /* "sklearn/tree/_tree.pyx":1713 + /* "sklearn/tree/_tree.pyx":1703 * * cdef DOUBLE_t w = 1.0 * cdef DOUBLE_t y_idx = 0.0 # <<<<<<<<<<<<<< @@ -13944,17 +14071,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_y_idx = 0.0; - /* "sklearn/tree/_tree.pyx":1717 + /* "sklearn/tree/_tree.pyx":1707 * * # post condition: all samples from [0:b) are on the left side * for idx from a <= idx < b: # <<<<<<<<<<<<<< * j = X_argsorted_i[idx] * */ - __pyx_t_1 = __pyx_v_b; - for (__pyx_v_idx = __pyx_v_a; __pyx_v_idx < __pyx_t_1; __pyx_v_idx++) { + __pyx_t_2 = __pyx_v_b; + for (__pyx_v_idx = __pyx_v_a; __pyx_v_idx < __pyx_t_2; __pyx_v_idx++) { - /* "sklearn/tree/_tree.pyx":1718 + /* "sklearn/tree/_tree.pyx":1708 * # post condition: all samples from [0:b) are on the left side * for idx from a <= idx < b: * j = X_argsorted_i[idx] # <<<<<<<<<<<<<< @@ -13963,17 +14090,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_j = (__pyx_v_X_argsorted_i[__pyx_v_idx]); - /* "sklearn/tree/_tree.pyx":1720 + /* "sklearn/tree/_tree.pyx":1710 * j = X_argsorted_i[idx] * * if sample_mask[j] == 0: # <<<<<<<<<<<<<< * continue * if sample_weight != NULL: */ - __pyx_t_2 = ((__pyx_v_sample_mask[__pyx_v_j]) == 0); - if (__pyx_t_2) { + __pyx_t_4 = ((__pyx_v_sample_mask[__pyx_v_j]) == 0); + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1721 + /* "sklearn/tree/_tree.pyx":1711 * * if sample_mask[j] == 0: * continue # <<<<<<<<<<<<<< @@ -13985,17 +14112,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( } __pyx_L5:; - /* "sklearn/tree/_tree.pyx":1722 + /* "sklearn/tree/_tree.pyx":1712 * if sample_mask[j] == 0: * continue * if sample_weight != NULL: # <<<<<<<<<<<<<< * w = sample_weight[j] * */ - __pyx_t_2 = (__pyx_v_sample_weight != NULL); - if (__pyx_t_2) { + __pyx_t_4 = (__pyx_v_sample_weight != NULL); + if (__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1723 + /* "sklearn/tree/_tree.pyx":1713 * continue * if sample_weight != NULL: * w = sample_weight[j] # <<<<<<<<<<<<<< @@ -14007,17 +14134,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( } __pyx_L6:; - /* "sklearn/tree/_tree.pyx":1725 + /* "sklearn/tree/_tree.pyx":1715 * w = sample_weight[j] * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * y_idx = y[j * y_stride + k] * sq_sum_left[k] += w * (y_idx * y_idx) */ - __pyx_t_3 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + __pyx_t_5 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1726 + /* "sklearn/tree/_tree.pyx":1716 * * for k from 0 <= k < n_outputs: * y_idx = y[j * y_stride + k] # <<<<<<<<<<<<<< @@ -14026,27 +14153,27 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_y_idx = (__pyx_v_y[((__pyx_v_j * __pyx_v_y_stride) + __pyx_v_k)]); - /* "sklearn/tree/_tree.pyx":1727 + /* "sklearn/tree/_tree.pyx":1717 * for k from 0 <= k < n_outputs: * y_idx = y[j * y_stride + k] * sq_sum_left[k] += w * (y_idx * y_idx) # <<<<<<<<<<<<<< * sq_sum_right[k] -= w * (y_idx * y_idx) * */ - __pyx_t_4 = __pyx_v_k; - (__pyx_v_sq_sum_left[__pyx_t_4]) = ((__pyx_v_sq_sum_left[__pyx_t_4]) + (__pyx_v_w * (__pyx_v_y_idx * __pyx_v_y_idx))); + __pyx_t_6 = __pyx_v_k; + (__pyx_v_sq_sum_left[__pyx_t_6]) = ((__pyx_v_sq_sum_left[__pyx_t_6]) + (__pyx_v_w * (__pyx_v_y_idx * __pyx_v_y_idx))); - /* "sklearn/tree/_tree.pyx":1728 + /* "sklearn/tree/_tree.pyx":1718 * y_idx = y[j * y_stride + k] * sq_sum_left[k] += w * (y_idx * y_idx) * sq_sum_right[k] -= w * (y_idx * y_idx) # <<<<<<<<<<<<<< * * mean_left[k] = ((weighted_n_left * mean_left[k] + w * y_idx) / */ - __pyx_t_4 = __pyx_v_k; - (__pyx_v_sq_sum_right[__pyx_t_4]) = ((__pyx_v_sq_sum_right[__pyx_t_4]) - (__pyx_v_w * (__pyx_v_y_idx * __pyx_v_y_idx))); + __pyx_t_6 = __pyx_v_k; + (__pyx_v_sq_sum_right[__pyx_t_6]) = ((__pyx_v_sq_sum_right[__pyx_t_6]) - (__pyx_v_w * (__pyx_v_y_idx * __pyx_v_y_idx))); - /* "sklearn/tree/_tree.pyx":1730 + /* "sklearn/tree/_tree.pyx":1720 * sq_sum_right[k] -= w * (y_idx * y_idx) * * mean_left[k] = ((weighted_n_left * mean_left[k] + w * y_idx) / # <<<<<<<<<<<<<< @@ -14055,7 +14182,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ (__pyx_v_mean_left[__pyx_v_k]) = (((__pyx_v_weighted_n_left * (__pyx_v_mean_left[__pyx_v_k])) + (__pyx_v_w * __pyx_v_y_idx)) / (__pyx_v_weighted_n_left + __pyx_v_w)); - /* "sklearn/tree/_tree.pyx":1732 + /* "sklearn/tree/_tree.pyx":1722 * mean_left[k] = ((weighted_n_left * mean_left[k] + w * y_idx) / * (weighted_n_left + w)) * mean_right[k] = (((weighted_n_samples - weighted_n_left) * # <<<<<<<<<<<<<< @@ -14065,7 +14192,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( (__pyx_v_mean_right[__pyx_v_k]) = ((((__pyx_v_weighted_n_samples - __pyx_v_weighted_n_left) * (__pyx_v_mean_right[__pyx_v_k])) - (__pyx_v_w * __pyx_v_y_idx)) / ((__pyx_v_weighted_n_samples - __pyx_v_weighted_n_left) - __pyx_v_w)); } - /* "sklearn/tree/_tree.pyx":1736 + /* "sklearn/tree/_tree.pyx":1726 * (weighted_n_samples - weighted_n_left - w)) * * n_left += 1 # <<<<<<<<<<<<<< @@ -14074,7 +14201,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_n_left = (__pyx_v_n_left + 1); - /* "sklearn/tree/_tree.pyx":1737 + /* "sklearn/tree/_tree.pyx":1727 * * n_left += 1 * self.n_left = n_left # <<<<<<<<<<<<<< @@ -14083,7 +14210,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_self->__pyx_base.n_left = __pyx_v_n_left; - /* "sklearn/tree/_tree.pyx":1738 + /* "sklearn/tree/_tree.pyx":1728 * n_left += 1 * self.n_left = n_left * n_right -= 1 # <<<<<<<<<<<<<< @@ -14092,7 +14219,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_n_right = (__pyx_v_n_right - 1); - /* "sklearn/tree/_tree.pyx":1739 + /* "sklearn/tree/_tree.pyx":1729 * self.n_left = n_left * n_right -= 1 * self.n_right = n_right # <<<<<<<<<<<<<< @@ -14101,7 +14228,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_self->__pyx_base.n_right = __pyx_v_n_right; - /* "sklearn/tree/_tree.pyx":1740 + /* "sklearn/tree/_tree.pyx":1730 * n_right -= 1 * self.n_right = n_right * weighted_n_left += w # <<<<<<<<<<<<<< @@ -14110,7 +14237,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_weighted_n_left = (__pyx_v_weighted_n_left + __pyx_v_w); - /* "sklearn/tree/_tree.pyx":1741 + /* "sklearn/tree/_tree.pyx":1731 * self.n_right = n_right * weighted_n_left += w * self.weighted_n_left = weighted_n_left # <<<<<<<<<<<<<< @@ -14119,7 +14246,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_self->__pyx_base.weighted_n_left = __pyx_v_weighted_n_left; - /* "sklearn/tree/_tree.pyx":1742 + /* "sklearn/tree/_tree.pyx":1732 * weighted_n_left += w * self.weighted_n_left = weighted_n_left * weighted_n_right -= w # <<<<<<<<<<<<<< @@ -14128,7 +14255,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_weighted_n_right = (__pyx_v_weighted_n_right - __pyx_v_w); - /* "sklearn/tree/_tree.pyx":1743 + /* "sklearn/tree/_tree.pyx":1733 * self.weighted_n_left = weighted_n_left * weighted_n_right -= w * self.weighted_n_right = weighted_n_right # <<<<<<<<<<<<<< @@ -14137,17 +14264,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ __pyx_v_self->__pyx_base.weighted_n_right = __pyx_v_weighted_n_right; - /* "sklearn/tree/_tree.pyx":1745 + /* "sklearn/tree/_tree.pyx":1735 * self.weighted_n_right = weighted_n_right * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * var_left[k] = sq_sum_left[k] - weighted_n_left * (mean_left[k] * mean_left[k]) * var_right[k] = sq_sum_right[k] - weighted_n_right * (mean_right[k] * mean_right[k]) */ - __pyx_t_3 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_3; __pyx_v_k++) { + __pyx_t_5 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_5; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1746 + /* "sklearn/tree/_tree.pyx":1736 * * for k from 0 <= k < n_outputs: * var_left[k] = sq_sum_left[k] - weighted_n_left * (mean_left[k] * mean_left[k]) # <<<<<<<<<<<<<< @@ -14156,7 +14283,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( */ (__pyx_v_var_left[__pyx_v_k]) = ((__pyx_v_sq_sum_left[__pyx_v_k]) - (__pyx_v_weighted_n_left * ((__pyx_v_mean_left[__pyx_v_k]) * (__pyx_v_mean_left[__pyx_v_k])))); - /* "sklearn/tree/_tree.pyx":1747 + /* "sklearn/tree/_tree.pyx":1737 * for k from 0 <= k < n_outputs: * var_left[k] = sq_sum_left[k] - weighted_n_left * (mean_left[k] * mean_left[k]) * var_right[k] = sq_sum_right[k] - weighted_n_right * (mean_right[k] * mean_right[k]) # <<<<<<<<<<<<<< @@ -14168,31 +14295,31 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( __pyx_L3_continue:; } - /* "sklearn/tree/_tree.pyx":1750 + /* "sklearn/tree/_tree.pyx":1740 * * # Skip splits that result in nodes with net 0 or negative weight * if (weighted_n_left <= 0 or # <<<<<<<<<<<<<< * (self.weighted_n_samples - weighted_n_left) <= 0): * return False */ - __pyx_t_2 = (__pyx_v_weighted_n_left <= 0.0); - if (!__pyx_t_2) { + __pyx_t_4 = (__pyx_v_weighted_n_left <= 0.0); + if (!__pyx_t_4) { - /* "sklearn/tree/_tree.pyx":1751 + /* "sklearn/tree/_tree.pyx":1741 * # Skip splits that result in nodes with net 0 or negative weight * if (weighted_n_left <= 0 or * (self.weighted_n_samples - weighted_n_left) <= 0): # <<<<<<<<<<<<<< * return False * */ - __pyx_t_5 = ((__pyx_v_self->__pyx_base.weighted_n_samples - __pyx_v_weighted_n_left) <= 0.0); - __pyx_t_6 = __pyx_t_5; + __pyx_t_7 = ((__pyx_v_self->__pyx_base.weighted_n_samples - __pyx_v_weighted_n_left) <= 0.0); + __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_6 = __pyx_t_2; + __pyx_t_8 = __pyx_t_4; } - if (__pyx_t_6) { + if (__pyx_t_8) { - /* "sklearn/tree/_tree.pyx":1752 + /* "sklearn/tree/_tree.pyx":1742 * if (weighted_n_left <= 0 or * (self.weighted_n_samples - weighted_n_left) <= 0): * return False # <<<<<<<<<<<<<< @@ -14200,17 +14327,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( * return True */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyBoolObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_9 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (!(likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyBoolObject *)__pyx_t_9); + __pyx_t_9 = 0; goto __pyx_L0; goto __pyx_L11; } __pyx_L11:; - /* "sklearn/tree/_tree.pyx":1754 + /* "sklearn/tree/_tree.pyx":1744 * return False * * return True # <<<<<<<<<<<<<< @@ -14218,17 +14345,17 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( * cdef double eval(self): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - if (!(likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyBoolObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_t_9 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (!(likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyBoolObject *)__pyx_t_9); + __pyx_t_9 = 0; goto __pyx_L0; __pyx_r = ((PyBoolObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("sklearn.tree._tree.RegressionCriterion.update", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -14237,7 +14364,7 @@ static PyBoolObject *__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_update( return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1756 +/* "sklearn/tree/_tree.pyx":1746 * return True * * cdef double eval(self): # <<<<<<<<<<<<<< @@ -14255,7 +14382,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_eval(CYTHON_UN return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1760 +/* "sklearn/tree/_tree.pyx":1750 * pass * * cdef void init_value(self, double* buffer_value): # <<<<<<<<<<<<<< @@ -14269,27 +14396,30 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init_value(struc int __pyx_v_k; __Pyx_RefNannyDeclarations int __pyx_t_1; + double *__pyx_t_2; __Pyx_RefNannySetupContext("init_value", 0); - /* "sklearn/tree/_tree.pyx":1763 + /* "sklearn/tree/_tree.pyx":1753 * """Get the initial value of the criterion (`init` must be called * before).""" * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * cdef double* mean_init = self.mean_init * */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.n_outputs; + __pyx_t_1 = __pyx_v_self->__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1764 + /* "sklearn/tree/_tree.pyx":1754 * before).""" * cdef int n_outputs = self.n_outputs * cdef double* mean_init = self.mean_init # <<<<<<<<<<<<<< * * cdef int k */ - __pyx_v_mean_init = __pyx_v_self->mean_init; + __pyx_t_2 = __pyx_v_self->mean_init; + __pyx_v_mean_init = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1768 + /* "sklearn/tree/_tree.pyx":1758 * cdef int k * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< @@ -14299,7 +14429,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init_value(struc __pyx_t_1 = __pyx_v_n_outputs; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1769 + /* "sklearn/tree/_tree.pyx":1759 * * for k from 0 <= k < n_outputs: * buffer_value[k] = mean_init[k] # <<<<<<<<<<<<<< @@ -14312,7 +14442,7 @@ static void __pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init_value(struc __Pyx_RefNannyFinishContext(); } -/* "sklearn/tree/_tree.pyx":1778 +/* "sklearn/tree/_tree.pyx":1768 * """ * * cdef double eval(self): # <<<<<<<<<<<<<< @@ -14328,37 +14458,41 @@ static double __pyx_f_7sklearn_4tree_5_tree_3MSE_eval(struct __pyx_obj_7sklearn_ double __pyx_v_total; double __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + double *__pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("eval", 0); - /* "sklearn/tree/_tree.pyx":1779 + /* "sklearn/tree/_tree.pyx":1769 * * cdef double eval(self): * cdef double* var_left = self.var_left # <<<<<<<<<<<<<< * cdef double* var_right = self.var_right * */ - __pyx_v_var_left = __pyx_v_self->__pyx_base.var_left; + __pyx_t_1 = __pyx_v_self->__pyx_base.var_left; + __pyx_v_var_left = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1780 + /* "sklearn/tree/_tree.pyx":1770 * cdef double eval(self): * cdef double* var_left = self.var_left * cdef double* var_right = self.var_right # <<<<<<<<<<<<<< * * cdef int n_outputs = self.n_outputs */ - __pyx_v_var_right = __pyx_v_self->__pyx_base.var_right; + __pyx_t_1 = __pyx_v_self->__pyx_base.var_right; + __pyx_v_var_right = __pyx_t_1; - /* "sklearn/tree/_tree.pyx":1782 + /* "sklearn/tree/_tree.pyx":1772 * cdef double* var_right = self.var_right * * cdef int n_outputs = self.n_outputs # <<<<<<<<<<<<<< * * cdef int k */ - __pyx_v_n_outputs = __pyx_v_self->__pyx_base.__pyx_base.n_outputs; + __pyx_t_2 = __pyx_v_self->__pyx_base.__pyx_base.n_outputs; + __pyx_v_n_outputs = __pyx_t_2; - /* "sklearn/tree/_tree.pyx":1785 + /* "sklearn/tree/_tree.pyx":1775 * * cdef int k * cdef double total = 0.0 # <<<<<<<<<<<<<< @@ -14367,17 +14501,17 @@ static double __pyx_f_7sklearn_4tree_5_tree_3MSE_eval(struct __pyx_obj_7sklearn_ */ __pyx_v_total = 0.0; - /* "sklearn/tree/_tree.pyx":1787 + /* "sklearn/tree/_tree.pyx":1777 * cdef double total = 0.0 * * for k from 0 <= k < n_outputs: # <<<<<<<<<<<<<< * total += var_left[k] * total += var_right[k] */ - __pyx_t_1 = __pyx_v_n_outputs; - for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_1; __pyx_v_k++) { + __pyx_t_2 = __pyx_v_n_outputs; + for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_2; __pyx_v_k++) { - /* "sklearn/tree/_tree.pyx":1788 + /* "sklearn/tree/_tree.pyx":1778 * * for k from 0 <= k < n_outputs: * total += var_left[k] # <<<<<<<<<<<<<< @@ -14386,7 +14520,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_3MSE_eval(struct __pyx_obj_7sklearn_ */ __pyx_v_total = (__pyx_v_total + (__pyx_v_var_left[__pyx_v_k])); - /* "sklearn/tree/_tree.pyx":1789 + /* "sklearn/tree/_tree.pyx":1779 * for k from 0 <= k < n_outputs: * total += var_left[k] * total += var_right[k] # <<<<<<<<<<<<<< @@ -14396,7 +14530,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_3MSE_eval(struct __pyx_obj_7sklearn_ __pyx_v_total = (__pyx_v_total + (__pyx_v_var_right[__pyx_v_k])); } - /* "sklearn/tree/_tree.pyx":1791 + /* "sklearn/tree/_tree.pyx":1781 * total += var_right[k] * * return total / n_outputs # <<<<<<<<<<<<<< @@ -14412,7 +14546,7 @@ static double __pyx_f_7sklearn_4tree_5_tree_3MSE_eval(struct __pyx_obj_7sklearn_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1798 +/* "sklearn/tree/_tree.pyx":1788 * # ============================================================================= * * cdef inline np.ndarray intp_to_ndarray(int* data, int size): # <<<<<<<<<<<<<< @@ -14430,7 +14564,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarra int __pyx_clineno = 0; __Pyx_RefNannySetupContext("intp_to_ndarray", 0); - /* "sklearn/tree/_tree.pyx":1801 + /* "sklearn/tree/_tree.pyx":1791 * """Encapsulate data into a 1D numpy array of int's.""" * cdef np.npy_intp shape[1] * shape[0] = size # <<<<<<<<<<<<<< @@ -14439,7 +14573,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarra */ (__pyx_v_shape[0]) = ((npy_intp)__pyx_v_size); - /* "sklearn/tree/_tree.pyx":1802 + /* "sklearn/tree/_tree.pyx":1792 * cdef np.npy_intp shape[1] * shape[0] = size * return np.PyArray_SimpleNewFromData(1, shape, np.NPY_INT, data) # <<<<<<<<<<<<<< @@ -14447,9 +14581,9 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarra * cdef inline np.ndarray doublep_to_ndarray(double* data, int size): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_INT, __pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_INT, __pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1792; __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 = 1802; __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 = 1792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -14466,7 +14600,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_intp_to_ndarra return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1804 +/* "sklearn/tree/_tree.pyx":1794 * return np.PyArray_SimpleNewFromData(1, shape, np.NPY_INT, data) * * cdef inline np.ndarray doublep_to_ndarray(double* data, int size): # <<<<<<<<<<<<<< @@ -14484,7 +14618,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_doublep_to_nda int __pyx_clineno = 0; __Pyx_RefNannySetupContext("doublep_to_ndarray", 0); - /* "sklearn/tree/_tree.pyx":1807 + /* "sklearn/tree/_tree.pyx":1797 * """Encapsulate data into a 1D numpy array of double's.""" * cdef np.npy_intp shape[1] * shape[0] = size # <<<<<<<<<<<<<< @@ -14493,7 +14627,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_doublep_to_nda */ (__pyx_v_shape[0]) = ((npy_intp)__pyx_v_size); - /* "sklearn/tree/_tree.pyx":1808 + /* "sklearn/tree/_tree.pyx":1798 * cdef np.npy_intp shape[1] * shape[0] = size * return np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, data) # <<<<<<<<<<<<<< @@ -14501,9 +14635,9 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_doublep_to_nda * cdef inline int _smallest_sample_larger_than(int sample_idx, */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_DOUBLE, __pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_DOUBLE, __pyx_v_data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1798; __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 = 1808; __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 = 1798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -14520,7 +14654,7 @@ static CYTHON_INLINE PyArrayObject *__pyx_f_7sklearn_4tree_5_tree_doublep_to_nda return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1810 +/* "sklearn/tree/_tree.pyx":1800 * return np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, data) * * cdef inline int _smallest_sample_larger_than(int sample_idx, # <<<<<<<<<<<<<< @@ -14538,7 +14672,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t int __pyx_t_2; __Pyx_RefNannySetupContext("_smallest_sample_larger_than", 0); - /* "sklearn/tree/_tree.pyx":1829 + /* "sklearn/tree/_tree.pyx":1819 * -1 if no such element exists. * """ * cdef int idx = 0, j # <<<<<<<<<<<<<< @@ -14547,7 +14681,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t */ __pyx_v_idx = 0; - /* "sklearn/tree/_tree.pyx":1830 + /* "sklearn/tree/_tree.pyx":1820 * """ * cdef int idx = 0, j * cdef DTYPE_t threshold = -DBL_MAX # <<<<<<<<<<<<<< @@ -14556,7 +14690,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t */ __pyx_v_threshold = (-DBL_MAX); - /* "sklearn/tree/_tree.pyx":1832 + /* "sklearn/tree/_tree.pyx":1822 * cdef DTYPE_t threshold = -DBL_MAX * * if sample_idx > -1: # <<<<<<<<<<<<<< @@ -14566,7 +14700,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t __pyx_t_1 = (__pyx_v_sample_idx > -1); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1833 + /* "sklearn/tree/_tree.pyx":1823 * * if sample_idx > -1: * threshold = X_i[X_argsorted_i[sample_idx]] # <<<<<<<<<<<<<< @@ -14578,7 +14712,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t } __pyx_L3:; - /* "sklearn/tree/_tree.pyx":1835 + /* "sklearn/tree/_tree.pyx":1825 * threshold = X_i[X_argsorted_i[sample_idx]] * * for idx from sample_idx < idx < n_total_samples: # <<<<<<<<<<<<<< @@ -14588,7 +14722,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t __pyx_t_2 = __pyx_v_n_total_samples; for (__pyx_v_idx = __pyx_v_sample_idx+1; __pyx_v_idx < __pyx_t_2; __pyx_v_idx++) { - /* "sklearn/tree/_tree.pyx":1836 + /* "sklearn/tree/_tree.pyx":1826 * * for idx from sample_idx < idx < n_total_samples: * j = X_argsorted_i[idx] # <<<<<<<<<<<<<< @@ -14597,7 +14731,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t */ __pyx_v_j = (__pyx_v_X_argsorted_i[__pyx_v_idx]); - /* "sklearn/tree/_tree.pyx":1838 + /* "sklearn/tree/_tree.pyx":1828 * j = X_argsorted_i[idx] * * if sample_mask[j] == 0: # <<<<<<<<<<<<<< @@ -14607,7 +14741,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t __pyx_t_1 = ((__pyx_v_sample_mask[__pyx_v_j]) == 0); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1839 + /* "sklearn/tree/_tree.pyx":1829 * * if sample_mask[j] == 0: * continue # <<<<<<<<<<<<<< @@ -14619,7 +14753,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t } __pyx_L6:; - /* "sklearn/tree/_tree.pyx":1841 + /* "sklearn/tree/_tree.pyx":1831 * continue * * if X_i[j] > threshold + 1.e-7: # <<<<<<<<<<<<<< @@ -14629,7 +14763,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t __pyx_t_1 = ((__pyx_v_X_i[__pyx_v_j]) > (__pyx_v_threshold + 1.e-7)); if (__pyx_t_1) { - /* "sklearn/tree/_tree.pyx":1842 + /* "sklearn/tree/_tree.pyx":1832 * * if X_i[j] > threshold + 1.e-7: * return idx # <<<<<<<<<<<<<< @@ -14644,7 +14778,7 @@ static CYTHON_INLINE int __pyx_f_7sklearn_4tree_5_tree__smallest_sample_larger_t __pyx_L4_continue:; } - /* "sklearn/tree/_tree.pyx":1844 + /* "sklearn/tree/_tree.pyx":1834 * return idx * * return -1 # <<<<<<<<<<<<<< @@ -14692,16 +14826,16 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_1_random_sample_mask(PyObject *_ case 1: 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 = 1846; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_random_sample_mask", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __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--; else { - __Pyx_RaiseArgtupleInvalid("_random_sample_mask", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_random_sample_mask", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_random_sample_mask") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_random_sample_mask") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -14710,13 +14844,13 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_1_random_sample_mask(PyObject *_ 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 = 1846; __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 = 1846; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __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 = 1836; __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 = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_random_state = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_random_sample_mask", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_random_sample_mask", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.tree._tree._random_sample_mask", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -14727,7 +14861,7 @@ static PyObject *__pyx_pw_7sklearn_4tree_5_tree_1_random_sample_mask(PyObject *_ return __pyx_r; } -/* "sklearn/tree/_tree.pyx":1846 +/* "sklearn/tree/_tree.pyx":1836 * return -1 * * def _random_sample_mask(int n_total_samples, int n_total_in_bag, random_state): # <<<<<<<<<<<<<< @@ -14770,33 +14904,33 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE __pyx_pybuffernd_sample_mask.data = NULL; __pyx_pybuffernd_sample_mask.rcbuffer = &__pyx_pybuffer_sample_mask; - /* "sklearn/tree/_tree.pyx":1867 + /* "sklearn/tree/_tree.pyx":1857 * """ * cdef np.ndarray[np.float64_t, ndim=1, mode="c"] rand = \ * random_state.rand(n_total_samples) # <<<<<<<<<<<<<< * cdef np.ndarray[BOOL_t, ndim=1, mode="c"] sample_mask = \ * np_zeros((n_total_samples,), dtype=np.int8) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_random_state, __pyx_n_s__rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_random_state, __pyx_n_s__rand); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __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 = 1867; __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 = 1857; __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 = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __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; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rand.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_rand = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_rand.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1856; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_rand.diminfo[0].strides = __pyx_pybuffernd_rand.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rand.diminfo[0].shape = __pyx_pybuffernd_rand.rcbuffer->pybuffer.shape[0]; } } @@ -14804,48 +14938,48 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE __pyx_v_rand = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":1869 + /* "sklearn/tree/_tree.pyx":1859 * random_state.rand(n_total_samples) * cdef np.ndarray[BOOL_t, ndim=1, mode="c"] sample_mask = \ * np_zeros((n_total_samples,), dtype=np.int8) # <<<<<<<<<<<<<< * * cdef int n_bagged = 0 */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1859; __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 = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_n_total_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1859; __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 = 1869; __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 = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__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 = 1869; __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 = 1859; __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)); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __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_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__int8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __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; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_mask.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_4tree_5_tree_BOOL_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_sample_mask = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sample_mask.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1858; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_sample_mask.diminfo[0].strides = __pyx_pybuffernd_sample_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_mask.diminfo[0].shape = __pyx_pybuffernd_sample_mask.rcbuffer->pybuffer.shape[0]; } } @@ -14853,7 +14987,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE __pyx_v_sample_mask = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/tree/_tree.pyx":1871 + /* "sklearn/tree/_tree.pyx":1861 * np_zeros((n_total_samples,), dtype=np.int8) * * cdef int n_bagged = 0 # <<<<<<<<<<<<<< @@ -14862,7 +14996,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE */ __pyx_v_n_bagged = 0; - /* "sklearn/tree/_tree.pyx":1872 + /* "sklearn/tree/_tree.pyx":1862 * * cdef int n_bagged = 0 * cdef int i = 0 # <<<<<<<<<<<<<< @@ -14871,7 +15005,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE */ __pyx_v_i = 0; - /* "sklearn/tree/_tree.pyx":1874 + /* "sklearn/tree/_tree.pyx":1864 * cdef int i = 0 * * for i from 0 <= i < n_total_samples: # <<<<<<<<<<<<<< @@ -14881,7 +15015,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE __pyx_t_8 = __pyx_v_n_total_samples; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) { - /* "sklearn/tree/_tree.pyx":1875 + /* "sklearn/tree/_tree.pyx":1865 * * for i from 0 <= i < n_total_samples: * if rand[i] * (n_total_samples - i) < (n_total_in_bag - n_bagged): # <<<<<<<<<<<<<< @@ -14892,7 +15026,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE __pyx_t_10 = (((*__Pyx_BufPtrCContig1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_rand.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_rand.diminfo[0].strides)) * (__pyx_v_n_total_samples - __pyx_v_i)) < (__pyx_v_n_total_in_bag - __pyx_v_n_bagged)); if (__pyx_t_10) { - /* "sklearn/tree/_tree.pyx":1876 + /* "sklearn/tree/_tree.pyx":1866 * for i from 0 <= i < n_total_samples: * if rand[i] * (n_total_samples - i) < (n_total_in_bag - n_bagged): * sample_mask[i] = 1 # <<<<<<<<<<<<<< @@ -14902,7 +15036,7 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE __pyx_t_11 = __pyx_v_i; *__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_4tree_5_tree_BOOL_t *, __pyx_pybuffernd_sample_mask.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_sample_mask.diminfo[0].strides) = 1; - /* "sklearn/tree/_tree.pyx":1877 + /* "sklearn/tree/_tree.pyx":1867 * if rand[i] * (n_total_samples - i) < (n_total_in_bag - n_bagged): * sample_mask[i] = 1 * n_bagged += 1 # <<<<<<<<<<<<<< @@ -14915,22 +15049,22 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE __pyx_L5:; } - /* "sklearn/tree/_tree.pyx":1879 + /* "sklearn/tree/_tree.pyx":1869 * n_bagged += 1 * * return sample_mask.astype(np_bool) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_sample_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_sample_mask), __pyx_n_s__astype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_bool); 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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1879; __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 = 1869; __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_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); 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_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -14966,8 +15100,8 @@ static PyObject *__pyx_pf_7sklearn_4tree_5_tree__random_sample_mask(CYTHON_UNUSE } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -15311,8 +15445,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset @@ -15387,7 +15523,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: @@ -15782,8 +15919,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -17125,6 +17262,7 @@ 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; + PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); @@ -17137,6 +17275,7 @@ static void __pyx_tp_dealloc_7sklearn_4tree_5_tree_Tree(PyObject *o) { Py_CLEAR(p->criterion); Py_CLEAR(p->random_state); Py_CLEAR(p->features); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -18588,8 +18727,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __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; @@ -18601,42 +18740,42 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/tree/_tree.pyx":495 + /* "sklearn/tree/_tree.pyx":483 * # Count samples * if n_node_samples == 0: * raise ValueError("Attempting to find a split " # <<<<<<<<<<<<<< * "with an empty sample_mask.") * */ - __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); - /* "sklearn/tree/_tree.pyx":499 + /* "sklearn/tree/_tree.pyx":487 * * if weighted_n_node_samples < 0.0: * raise ValueError("Attempting to find a split with a negative " # <<<<<<<<<<<<<< * "weighted number of samples.") * */ - __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "sklearn/tree/_tree.pyx":1029 + /* "sklearn/tree/_tree.pyx":1019 * """ * if method != "gini" and method != "squared": * raise ValueError( # <<<<<<<<<<<<<< * 'Invalid value for method. Allowed string ' * 'values are "gini", or "squared".') */ - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7)); @@ -18727,14 +18866,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - /* "sklearn/tree/_tree.pyx":1846 + /* "sklearn/tree/_tree.pyx":1836 * return -1 * * 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. * */ - __pyx_k_tuple_21 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_21 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_INCREF(((PyObject *)__pyx_n_s__n_total_samples)); PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_n_s__n_total_samples)); @@ -18758,7 +18897,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_21, 6, ((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); - __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_23, __pyx_n_s___random_sample_mask, 1846, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_23, __pyx_n_s___random_sample_mask, 1836, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -18827,6 +18966,14 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__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 __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); @@ -18851,9 +18998,9 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_Criterion.update = (PyBoolObject *(*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, int, int, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, int, int *, __pyx_t_7sklearn_4tree_5_tree_DOUBLE_t *, __pyx_t_7sklearn_4tree_5_tree_BOOL_t *))__pyx_f_7sklearn_4tree_5_tree_9Criterion_update; __pyx_vtable_7sklearn_4tree_5_tree_Criterion.eval = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *))__pyx_f_7sklearn_4tree_5_tree_9Criterion_eval; __pyx_vtable_7sklearn_4tree_5_tree_Criterion.init_value = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *))__pyx_f_7sklearn_4tree_5_tree_9Criterion_init_value; - if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Criterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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 = 1068; __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 = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Criterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1058; __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 = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_Criterion = &__pyx_type_7sklearn_4tree_5_tree_Criterion; __pyx_vtabptr_7sklearn_4tree_5_tree_Tree = &__pyx_vtable_7sklearn_4tree_5_tree_Tree; __pyx_vtable_7sklearn_4tree_5_tree_Tree.resize = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, struct __pyx_opt_args_7sklearn_4tree_5_tree_4Tree_resize *__pyx_optional_args))__pyx_f_7sklearn_4tree_5_tree_4Tree_resize; @@ -18869,9 +19016,9 @@ PyMODINIT_FUNC PyInit__tree(void) __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; __pyx_vtable_7sklearn_4tree_5_tree_Tree._compute_feature_importances_gini = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, int))__pyx_f_7sklearn_4tree_5_tree_4Tree__compute_feature_importances_gini; __pyx_vtable_7sklearn_4tree_5_tree_Tree._compute_feature_importances_squared = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Tree *, int))__pyx_f_7sklearn_4tree_5_tree_4Tree__compute_feature_importances_squared; - if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Tree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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 = 74; __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 = 74; __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 = 62; __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 = 62; __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 = 62; __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_ClassificationCriterion = &__pyx_vtable_7sklearn_4tree_5_tree_ClassificationCriterion; __pyx_vtable_7sklearn_4tree_5_tree_ClassificationCriterion.__pyx_base = *__pyx_vtabptr_7sklearn_4tree_5_tree_Criterion; @@ -18881,25 +19028,25 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_ClassificationCriterion.__pyx_base.eval = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *))__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_eval; __pyx_vtable_7sklearn_4tree_5_tree_ClassificationCriterion.__pyx_base.init_value = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *))__pyx_f_7sklearn_4tree_5_tree_23ClassificationCriterion_init_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 = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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 = 1103; __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 = 1103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_ClassificationCriterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1093; __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 = 1093; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_ClassificationCriterion = &__pyx_type_7sklearn_4tree_5_tree_ClassificationCriterion; __pyx_vtabptr_7sklearn_4tree_5_tree_Gini = &__pyx_vtable_7sklearn_4tree_5_tree_Gini; __pyx_vtable_7sklearn_4tree_5_tree_Gini.__pyx_base = *__pyx_vtabptr_7sklearn_4tree_5_tree_ClassificationCriterion; __pyx_vtable_7sklearn_4tree_5_tree_Gini.__pyx_base.__pyx_base.eval = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *))__pyx_f_7sklearn_4tree_5_tree_4Gini_eval; __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 = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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 = 1358; __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 = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Gini) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1348; __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 = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_Gini = &__pyx_type_7sklearn_4tree_5_tree_Gini; __pyx_vtabptr_7sklearn_4tree_5_tree_Entropy = &__pyx_vtable_7sklearn_4tree_5_tree_Entropy; __pyx_vtable_7sklearn_4tree_5_tree_Entropy.__pyx_base = *__pyx_vtabptr_7sklearn_4tree_5_tree_ClassificationCriterion; __pyx_vtable_7sklearn_4tree_5_tree_Entropy.__pyx_base.__pyx_base.eval = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *))__pyx_f_7sklearn_4tree_5_tree_7Entropy_eval; __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 = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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 = 1421; __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 = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_Entropy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1411; __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 = 1411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_Entropy = &__pyx_type_7sklearn_4tree_5_tree_Entropy; __pyx_vtabptr_7sklearn_4tree_5_tree_RegressionCriterion = &__pyx_vtable_7sklearn_4tree_5_tree_RegressionCriterion; __pyx_vtable_7sklearn_4tree_5_tree_RegressionCriterion.__pyx_base = *__pyx_vtabptr_7sklearn_4tree_5_tree_Criterion; @@ -18909,17 +19056,17 @@ PyMODINIT_FUNC PyInit__tree(void) __pyx_vtable_7sklearn_4tree_5_tree_RegressionCriterion.__pyx_base.eval = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *))__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_eval; __pyx_vtable_7sklearn_4tree_5_tree_RegressionCriterion.__pyx_base.init_value = (void (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *, double *))__pyx_f_7sklearn_4tree_5_tree_19RegressionCriterion_init_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 = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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 = 1472; __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 = 1472; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_RegressionCriterion) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1462; __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 = 1462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_RegressionCriterion = &__pyx_type_7sklearn_4tree_5_tree_RegressionCriterion; __pyx_vtabptr_7sklearn_4tree_5_tree_MSE = &__pyx_vtable_7sklearn_4tree_5_tree_MSE; __pyx_vtable_7sklearn_4tree_5_tree_MSE.__pyx_base = *__pyx_vtabptr_7sklearn_4tree_5_tree_RegressionCriterion; __pyx_vtable_7sklearn_4tree_5_tree_MSE.__pyx_base.__pyx_base.eval = (double (*)(struct __pyx_obj_7sklearn_4tree_5_tree_Criterion *))__pyx_f_7sklearn_4tree_5_tree_3MSE_eval; __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 = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - 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 = 1772; __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 = 1772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_4tree_5_tree_MSE) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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 = 1762; __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 = 1762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_4tree_5_tree_MSE = &__pyx_type_7sklearn_4tree_5_tree_MSE; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -18940,19 +19087,19 @@ PyMODINIT_FUNC PyInit__tree(void) /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "sklearn/tree/_tree.pyx":18 - * from cpython cimport bool + /* "sklearn/tree/_tree.pyx":22 + * from libc.string cimport memcpy * * import numpy as np # <<<<<<<<<<<<<< * 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 = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/tree/_tree.pyx":20 + /* "sklearn/tree/_tree.pyx":24 * import numpy as np * cimport numpy as np * np.import_array() # <<<<<<<<<<<<<< @@ -18961,269 +19108,269 @@ PyMODINIT_FUNC PyInit__tree(void) */ import_array(); - /* "sklearn/tree/_tree.pyx":22 + /* "sklearn/tree/_tree.pyx":26 * np.import_array() * * from numpy import zeros as np_zeros # <<<<<<<<<<<<<< * from numpy import ones as np_ones * from numpy import bool as np_bool */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(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_INCREF(((PyObject *)__pyx_n_s__zeros)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__zeros)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zeros)); - __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 = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 26; __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 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (__pyx_t_1 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__zeros); - if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_zeros, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_zeros, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __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; - /* "sklearn/tree/_tree.pyx":23 + /* "sklearn/tree/_tree.pyx":27 * * from numpy import zeros as np_zeros * from numpy import ones as np_ones # <<<<<<<<<<<<<< * from numpy import bool as np_bool * from numpy import float32 as np_float32 */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__ones)); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__ones)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ones)); - __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 = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 27; __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 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ones); if (__pyx_t_2 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__ones); - if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_ones, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_ones, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __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; - /* "sklearn/tree/_tree.pyx":24 + /* "sklearn/tree/_tree.pyx":28 * from numpy import zeros as np_zeros * from numpy import ones as np_ones * from numpy import bool as np_bool # <<<<<<<<<<<<<< * from numpy import float32 as np_float32 * from numpy import float64 as np_float64 */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(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_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 = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 28; __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 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bool); if (__pyx_t_1 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__bool); - if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_bool, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __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; - /* "sklearn/tree/_tree.pyx":25 + /* "sklearn/tree/_tree.pyx":29 * from numpy import ones as np_ones * from numpy import bool as np_bool * from numpy import float32 as np_float32 # <<<<<<<<<<<<<< * from numpy import float64 as np_float64 * */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__float32)); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__float32)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float32)); - __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 = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 29; __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 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float32); if (__pyx_t_2 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__float32); - if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_float32, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_float32, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __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; - /* "sklearn/tree/_tree.pyx":26 + /* "sklearn/tree/_tree.pyx":30 * from numpy import bool as np_bool * from numpy import float32 as np_float32 * from numpy import float64 as np_float64 # <<<<<<<<<<<<<< * - * cdef extern from "stdlib.h": + * */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(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_INCREF(((PyObject *)__pyx_n_s__float64)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__float64)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__float64)); - __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 = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 30; __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 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (__pyx_t_1 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__float64); - if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_float64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np_float64, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __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; - /* "sklearn/tree/_tree.pyx":50 + /* "sklearn/tree/_tree.pyx":38 * * # Dtype * DTYPE = np_float32 # <<<<<<<<<<<<<< * DOUBLE = np_float64 * # ctypedef np.float32_t DTYPE_t */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_float32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_float32); 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); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/tree/_tree.pyx":51 + /* "sklearn/tree/_tree.pyx":39 * # Dtype * DTYPE = np_float32 * DOUBLE = np_float64 # <<<<<<<<<<<<<< * # ctypedef np.float32_t DTYPE_t * # ctypedef np.float64_t DOUBLE_t */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_float64); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np_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 (PyObject_SetAttr(__pyx_m, __pyx_n_s__DOUBLE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __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; - /* "sklearn/tree/_tree.pyx":57 + /* "sklearn/tree/_tree.pyx":45 * * # Constants * cdef double INFINITY = np.inf # <<<<<<<<<<<<<< * * TREE_LEAF = -1 */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_7sklearn_4tree_5_tree_INFINITY = __pyx_t_3; - /* "sklearn/tree/_tree.pyx":59 + /* "sklearn/tree/_tree.pyx":47 * cdef double INFINITY = np.inf * * TREE_LEAF = -1 # <<<<<<<<<<<<<< * TREE_UNDEFINED = -2 * cdef int _TREE_LEAF = TREE_LEAF */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TREE_LEAF, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TREE_LEAF, __pyx_int_neg_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/tree/_tree.pyx":60 + /* "sklearn/tree/_tree.pyx":48 * * TREE_LEAF = -1 * TREE_UNDEFINED = -2 # <<<<<<<<<<<<<< * cdef int _TREE_LEAF = TREE_LEAF * cdef int _TREE_UNDEFINED = TREE_UNDEFINED */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TREE_UNDEFINED, __pyx_int_neg_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TREE_UNDEFINED, __pyx_int_neg_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/tree/_tree.pyx":61 + /* "sklearn/tree/_tree.pyx":49 * TREE_LEAF = -1 * TREE_UNDEFINED = -2 * cdef int _TREE_LEAF = TREE_LEAF # <<<<<<<<<<<<<< * cdef int _TREE_UNDEFINED = TREE_UNDEFINED * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__TREE_LEAF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__TREE_LEAF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_7sklearn_4tree_5_tree__TREE_LEAF = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":62 + /* "sklearn/tree/_tree.pyx":50 * TREE_UNDEFINED = -2 * cdef int _TREE_LEAF = TREE_LEAF * cdef int _TREE_UNDEFINED = TREE_UNDEFINED # <<<<<<<<<<<<<< * * TREE_SPLIT_BEST = 1 */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__TREE_UNDEFINED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__TREE_UNDEFINED); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_7sklearn_4tree_5_tree__TREE_UNDEFINED = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":64 + /* "sklearn/tree/_tree.pyx":52 * cdef int _TREE_UNDEFINED = TREE_UNDEFINED * * TREE_SPLIT_BEST = 1 # <<<<<<<<<<<<<< * TREE_SPLIT_RANDOM = 2 * cdef int _TREE_SPLIT_BEST = TREE_SPLIT_BEST */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TREE_SPLIT_BEST, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TREE_SPLIT_BEST, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/tree/_tree.pyx":65 + /* "sklearn/tree/_tree.pyx":53 * * TREE_SPLIT_BEST = 1 * TREE_SPLIT_RANDOM = 2 # <<<<<<<<<<<<<< * cdef int _TREE_SPLIT_BEST = TREE_SPLIT_BEST * cdef int _TREE_SPLIT_RANDOM = TREE_SPLIT_RANDOM */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TREE_SPLIT_RANDOM, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__TREE_SPLIT_RANDOM, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/tree/_tree.pyx":66 + /* "sklearn/tree/_tree.pyx":54 * TREE_SPLIT_BEST = 1 * TREE_SPLIT_RANDOM = 2 * cdef int _TREE_SPLIT_BEST = TREE_SPLIT_BEST # <<<<<<<<<<<<<< * cdef int _TREE_SPLIT_RANDOM = TREE_SPLIT_RANDOM * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__TREE_SPLIT_BEST); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__TREE_SPLIT_BEST); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_7sklearn_4tree_5_tree__TREE_SPLIT_BEST = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":67 + /* "sklearn/tree/_tree.pyx":55 * TREE_SPLIT_RANDOM = 2 * cdef int _TREE_SPLIT_BEST = TREE_SPLIT_BEST * cdef int _TREE_SPLIT_RANDOM = TREE_SPLIT_RANDOM # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__TREE_SPLIT_RANDOM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__TREE_SPLIT_RANDOM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_7sklearn_4tree_5_tree__TREE_SPLIT_RANDOM = __pyx_t_4; - /* "sklearn/tree/_tree.pyx":1846 + /* "sklearn/tree/_tree.pyx":1836 * return -1 * * 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. * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_4tree_5_tree_1_random_sample_mask, NULL, __pyx_n_s_24); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_4tree_5_tree_1_random_sample_mask, NULL, __pyx_n_s_24); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___random_sample_mask, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___random_sample_mask, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/tree/_tree.pyx":1 diff --git a/sklearn/tree/_tree.pyx b/sklearn/tree/_tree.pyx index 648f18df6b046..d181fe6ab410c 100644 --- a/sklearn/tree/_tree.pyx +++ b/sklearn/tree/_tree.pyx @@ -14,6 +14,10 @@ cimport cython from cpython cimport bool +from libc.float cimport DBL_MAX +from libc.math cimport log, pow +from libc.stdlib cimport calloc, free, malloc, realloc +from libc.string cimport memcpy import numpy as np cimport numpy as np @@ -25,22 +29,6 @@ from numpy import bool as np_bool from numpy import float32 as np_float32 from numpy import float64 as np_float64 -cdef extern from "stdlib.h": - void* malloc(size_t size) - void* calloc(size_t nmemb, size_t size) - void* realloc(void* ptr, size_t size) - void free(void* ptr) - -cdef extern from "string.h": - void* memcpy(void* dest, void* src, size_t n) - -cdef extern from "math.h": - cdef extern double log(double x) - cdef extern double pow(double base, double exponent) - -cdef extern from "float.h": - cdef extern double DBL_MAX - # ============================================================================= # Types and constants diff --git a/sklearn/utils/arraybuilder.c b/sklearn/utils/arraybuilder.c index f656490130e61..daef5b33f8843 100644 --- a/sklearn/utils/arraybuilder.c +++ b/sklearn/utils/arraybuilder.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.15.1+ on Thu Nov 17 19:41:19 2011 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:52 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -7,12 +7,10 @@ #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -24,30 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #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 PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -55,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -69,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -79,40 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #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) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #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) #endif - +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - -/* new Py3.3 unicode representation (PEP 393) */ -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) - #define CYTHON_PEP393_ENABLED - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) +#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_READ(k, d, i) PyUnicode_READ(k, d, i) #else - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #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])) #endif - #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -120,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -139,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -147,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -166,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -179,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -207,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -221,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -230,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -302,8 +309,12 @@ 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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -328,7 +339,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -338,7 +348,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -346,18 +355,19 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "arraybuilder.pyx", "numpy.pxd", + "type.pxd", }; -/* "numpy.pxd":719 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -366,7 +376,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -375,7 +385,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -384,7 +394,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -393,7 +403,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -402,7 +412,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -411,7 +421,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -420,7 +430,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -429,7 +439,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -438,7 +448,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -447,7 +457,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.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 # <<<<<<<<<<<<<< @@ -456,7 +466,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -465,7 +475,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -474,7 +484,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -483,7 +493,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -492,7 +502,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -501,7 +511,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -510,7 +520,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -519,7 +529,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -528,7 +538,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -537,7 +547,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -545,7 +555,6 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -566,10 +575,11 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder; -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -578,7 +588,7 @@ struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -587,7 +597,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -596,7 +606,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -605,7 +615,7 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "sklearn/utils/arraybuilder.pyx":6 +/* "sklearn/utils/arraybuilder.pyx":11 * * * cdef class ArrayBuilder(object): # <<<<<<<<<<<<<< @@ -625,11 +635,9 @@ struct __pyx_vtabstruct_7sklearn_5utils_12arraybuilder_ArrayBuilder { PyObject *(*_grow)(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *); }; static struct __pyx_vtabstruct_7sklearn_5utils_12arraybuilder_ArrayBuilder *__pyx_vtabptr_7sklearn_5utils_12arraybuilder_ArrayBuilder; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -642,8 +650,21 @@ static struct __pyx_vtabstruct_7sklearn_5utils_12arraybuilder_ArrayBuilder *__py static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -654,7 +675,7 @@ static struct __pyx_vtabstruct_7sklearn_5utils_12arraybuilder_ArrayBuilder *__py #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -665,14 +686,14 @@ static struct __pyx_vtabstruct_7sklearn_5utils_12arraybuilder_ArrayBuilder *__py #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ - #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ @@ -682,7 +703,6 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ #define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_SetItemInt_Fast(o, i, v) : \ __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) - static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; @@ -690,8 +710,8 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb Py_DECREF(j); return r; } - static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { +#if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { @@ -701,13 +721,26 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje Py_DECREF(old); return 1; } - } - else if (likely(i >= 0)) { + } else { /* inlined PySequence_SetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } return m->sq_ass_item(o, i, v); } } +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif + return PySequence_SetItem(o, i, v); + } +#endif return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } @@ -716,13 +749,15 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ @@ -740,7 +775,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -863,15 +897,38 @@ static int __Pyx_check_binary_version(void); static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + /* Module declarations from 'cython' */ /* Module declarations from 'cpython.buffer' */ @@ -882,6 +939,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -892,14 +954,7 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from 'sklearn.utils.arraybuilder' */ static PyTypeObject *__pyx_ptype_7sklearn_5utils_12arraybuilder_ArrayBuilder = 0; @@ -910,6 +965,12 @@ int __pyx_module_is_main_sklearn__utils__arraybuilder = 0; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; +static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *__pyx_v_self, PyObject *__pyx_v_dtype, PyObject *__pyx_v_initial_capacity); /* proto */ +static Py_ssize_t __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2__len__(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_4append(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *__pyx_v_self, PyObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_6get(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *__pyx_v_self); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; static char __pyx_k_5[] = "Non-native byte order not supported"; @@ -976,31 +1037,16 @@ static PyObject *__pyx_k_tuple_9; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_12; -/* "sklearn/utils/arraybuilder.pyx":15 - * cdef object _arr # object because we don't know the dtype statically - * - * def __init__(self, dtype, initial_capacity=256): # <<<<<<<<<<<<<< - * assert self.GROWTH_FACTOR > 1 - * assert initial_capacity >= 2 - */ - -static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_dtype = 0; PyObject *__pyx_v_initial_capacity = 0; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dtype,&__pyx_n_s__initial_capacity,0}; - __Pyx_RefNannySetupContext("__init__"); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dtype,&__pyx_n_s__initial_capacity,0}; PyObject* values[2] = {0,0}; values[1] = ((PyObject *)__pyx_int_256); if (unlikely(__pyx_kwds)) { @@ -1015,8 +1061,7 @@ static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(PyObj kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -1025,10 +1070,8 @@ static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - __pyx_v_dtype = values[0]; - __pyx_v_initial_capacity = values[1]; } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -1042,14 +1085,39 @@ static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(PyObj } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.arraybuilder.ArrayBuilder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self), __pyx_v_dtype, __pyx_v_initial_capacity); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "sklearn/utils/arraybuilder.pyx":16 +/* "sklearn/utils/arraybuilder.pyx":20 + * cdef object _arr # object because we don't know the dtype statically + * + * def __init__(self, dtype, initial_capacity=256): # <<<<<<<<<<<<<< + * assert self.GROWTH_FACTOR > 1 + * assert initial_capacity >= 2 + */ + +static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *__pyx_v_self, PyObject *__pyx_v_dtype, PyObject *__pyx_v_initial_capacity) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/utils/arraybuilder.pyx":21 * * def __init__(self, dtype, initial_capacity=256): * assert self.GROWTH_FACTOR > 1 # <<<<<<<<<<<<<< @@ -1057,20 +1125,19 @@ static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(PyObj * self._arr = np.empty(initial_capacity, dtype=dtype) */ #ifndef CYTHON_WITHOUT_ASSERTIONS - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__GROWTH_FACTOR); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__GROWTH_FACTOR); 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_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__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_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) { PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "sklearn/utils/arraybuilder.pyx":17 + /* "sklearn/utils/arraybuilder.pyx":22 * def __init__(self, dtype, initial_capacity=256): * assert self.GROWTH_FACTOR > 1 * assert initial_capacity >= 2 # <<<<<<<<<<<<<< @@ -1078,55 +1145,54 @@ static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(PyObj * self._nelems = 0 */ #ifndef CYTHON_WITHOUT_ASSERTIONS - __pyx_t_2 = PyObject_RichCompare(__pyx_v_initial_capacity, __pyx_int_2, Py_GE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_initial_capacity, __pyx_int_2, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) { PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "sklearn/utils/arraybuilder.pyx":18 + /* "sklearn/utils/arraybuilder.pyx":23 * assert self.GROWTH_FACTOR > 1 * assert initial_capacity >= 2 * self._arr = np.empty(initial_capacity, dtype=dtype) # <<<<<<<<<<<<<< * self._nelems = 0 * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __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[0]; __pyx_lineno = 18; __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 = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_initial_capacity); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_initial_capacity); __Pyx_GIVEREF(__pyx_v_initial_capacity); - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_GIVEREF(__pyx_t_5); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_arr); - __Pyx_DECREF(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_arr); - ((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_arr = __pyx_t_5; + __Pyx_GOTREF(__pyx_v_self->_arr); + __Pyx_DECREF(__pyx_v_self->_arr); + __pyx_v_self->_arr = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/utils/arraybuilder.pyx":19 + /* "sklearn/utils/arraybuilder.pyx":24 * assert initial_capacity >= 2 * self._arr = np.empty(initial_capacity, dtype=dtype) * self._nelems = 0 # <<<<<<<<<<<<<< * * def __len__(self): */ - ((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_nelems = 0; + __pyx_v_self->_nelems = 0; __pyx_r = 0; goto __pyx_L0; @@ -1142,7 +1208,18 @@ static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(PyObj return __pyx_r; } -/* "sklearn/utils/arraybuilder.pyx":21 +/* Python wrapper */ +static Py_ssize_t __pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2__len__(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/arraybuilder.pyx":26 * self._nelems = 0 * * def __len__(self): # <<<<<<<<<<<<<< @@ -1150,20 +1227,19 @@ static int __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__(PyObj * */ -static Py_ssize_t __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_1__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_1__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2__len__(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__len__"); + __Pyx_RefNannySetupContext("__len__", 0); - /* "sklearn/utils/arraybuilder.pyx":22 + /* "sklearn/utils/arraybuilder.pyx":27 * * def __len__(self): * return self._nelems # <<<<<<<<<<<<<< * * @cython.boundscheck(False) */ - __pyx_r = ((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_nelems; + __pyx_r = __pyx_v_self->_nelems; goto __pyx_L0; __pyx_r = 0; @@ -1172,7 +1248,19 @@ static Py_ssize_t __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_1__len_ return __pyx_r; } -/* "sklearn/utils/arraybuilder.pyx":25 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_5append(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ +static char __pyx_doc_7sklearn_5utils_12arraybuilder_12ArrayBuilder_4append[] = "Append a single value.\n\n Complexity: amortized O(1).\n "; +static PyObject *__pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_5append(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("append (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_4append(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self), ((PyObject *)__pyx_v_x)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/arraybuilder.pyx":30 * * @cython.boundscheck(False) * def append(self, x): # <<<<<<<<<<<<<< @@ -1180,9 +1268,7 @@ static Py_ssize_t __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_1__len_ * */ -static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2append(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/ -static char __pyx_doc_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2append[] = "Append a single value.\n\n Complexity: amortized O(1).\n "; -static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2append(PyObject *__pyx_v_self, PyObject *__pyx_v_x) { +static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_4append(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *__pyx_v_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1192,58 +1278,57 @@ static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2append( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("append"); + __Pyx_RefNannySetupContext("append", 0); - /* "sklearn/utils/arraybuilder.pyx":30 + /* "sklearn/utils/arraybuilder.pyx":35 * Complexity: amortized O(1). * """ * if self._nelems == self._arr.size: # <<<<<<<<<<<<<< * self._grow() * self._arr[self._nelems] = x */ - __pyx_t_1 = PyInt_FromSsize_t(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_nelems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->_nelems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_arr, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_arr, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __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; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { - /* "sklearn/utils/arraybuilder.pyx":31 + /* "sklearn/utils/arraybuilder.pyx":36 * """ * if self._nelems == self._arr.size: * self._grow() # <<<<<<<<<<<<<< * self._arr[self._nelems] = x * self._nelems += 1 */ - __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5utils_12arraybuilder_ArrayBuilder *)((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->__pyx_vtab)->_grow(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self->__pyx_vtab)->_grow(__pyx_v_self); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "sklearn/utils/arraybuilder.pyx":32 + /* "sklearn/utils/arraybuilder.pyx":37 * if self._nelems == self._arr.size: * self._grow() * self._arr[self._nelems] = x # <<<<<<<<<<<<<< * self._nelems += 1 * */ - if (__Pyx_SetItemInt(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_arr, ((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_nelems, __pyx_v_x, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_self->_arr, __pyx_v_self->_nelems, __pyx_v_x, sizeof(Py_ssize_t), PyInt_FromSsize_t) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/utils/arraybuilder.pyx":33 + /* "sklearn/utils/arraybuilder.pyx":38 * self._grow() * self._arr[self._nelems] = x * self._nelems += 1 # <<<<<<<<<<<<<< * * def get(self): */ - ((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_nelems = (((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_nelems + 1); + __pyx_v_self->_nelems = (__pyx_v_self->_nelems + 1); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -1259,7 +1344,19 @@ static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2append( return __pyx_r; } -/* "sklearn/utils/arraybuilder.pyx":35 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_7get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_7sklearn_5utils_12arraybuilder_12ArrayBuilder_6get[] = "Return the constructed array.\n\n Don't use an ArrayBuilder after calling this method.\n "; +static PyObject *__pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_7get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_6get(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/arraybuilder.pyx":40 * self._nelems += 1 * * def get(self): # <<<<<<<<<<<<<< @@ -1267,9 +1364,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2append( * */ -static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3get[] = "Return the constructed array.\n\n Don't use an ArrayBuilder after calling this method.\n "; -static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_6get(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1278,31 +1373,31 @@ static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3get(PyO int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get"); + __Pyx_RefNannySetupContext("get", 0); - /* "sklearn/utils/arraybuilder.pyx":40 + /* "sklearn/utils/arraybuilder.pyx":45 * Don't use an ArrayBuilder after calling this method. * """ * self._arr.resize(self._nelems) # <<<<<<<<<<<<<< * return self._arr * */ - __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_arr, __pyx_n_s__resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->_arr, __pyx_n_s__resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_nelems); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->_nelems); 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __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 = 45; __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 = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __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_2); __pyx_t_2 = 0; - /* "sklearn/utils/arraybuilder.pyx":41 + /* "sklearn/utils/arraybuilder.pyx":46 * """ * self._arr.resize(self._nelems) * return self._arr # <<<<<<<<<<<<<< @@ -1310,8 +1405,8 @@ static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3get(PyO * cdef _grow(self): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_arr); - __pyx_r = ((struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)__pyx_v_self)->_arr; + __Pyx_INCREF(__pyx_v_self->_arr); + __pyx_r = __pyx_v_self->_arr; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -1328,7 +1423,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3get(PyO return __pyx_r; } -/* "sklearn/utils/arraybuilder.pyx":43 +/* "sklearn/utils/arraybuilder.pyx":48 * return self._arr * * cdef _grow(self): # <<<<<<<<<<<<<< @@ -1345,29 +1440,29 @@ static PyObject *__pyx_f_7sklearn_5utils_12arraybuilder_12ArrayBuilder__grow(str int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_grow"); + __Pyx_RefNannySetupContext("_grow", 0); - /* "sklearn/utils/arraybuilder.pyx":44 + /* "sklearn/utils/arraybuilder.pyx":49 * * cdef _grow(self): * self._arr.resize(self._arr.size * self.GROWTH_FACTOR) # <<<<<<<<<<<<<< */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->_arr, __pyx_n_s__resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->_arr, __pyx_n_s__resize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_arr, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->_arr, __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__GROWTH_FACTOR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__GROWTH_FACTOR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); 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_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __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_3)); __pyx_t_3 = 0; @@ -1388,7 +1483,18 @@ static PyObject *__pyx_f_7sklearn_5utils_12arraybuilder_12ArrayBuilder__grow(str return __pyx_r; } -/* "numpy.pxd":190 +/* 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) { + int __pyx_r; + __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)); + __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): # <<<<<<<<<<<<<< @@ -1396,8 +1502,7 @@ static PyObject *__pyx_f_7sklearn_5utils_12arraybuilder_12ArrayBuilder__grow(str * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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; int __pyx_v_ndim; @@ -1422,13 +1527,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -1439,11 +1544,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1452,7 +1557,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1461,16 +1566,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1480,7 +1585,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1488,11 +1593,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1501,9 +1606,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1513,37 +1618,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * 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") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.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_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1553,46 +1658,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * 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") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.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_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, ((PyObject *)__pyx_k_tuple_4), 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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1601,7 +1706,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -1610,7 +1715,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.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) # <<<<<<<<<<<<<< @@ -1619,7 +1724,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.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 # <<<<<<<<<<<<<< @@ -1628,7 +1733,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -1639,49 +1744,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1690,25 +1795,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1717,17 +1822,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1736,7 +1843,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -1752,7 +1859,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1764,49 +1871,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -1817,10 +1925,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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" */ @@ -1837,24 +1945,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (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" @@ -1863,10 +1971,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1876,10 +1984,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -1889,10 +1997,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -1902,10 +2010,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -1915,10 +2023,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -1928,10 +2036,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -1941,10 +2049,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -1954,10 +2062,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -1967,10 +2075,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -1980,10 +2088,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -1993,10 +2101,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2006,10 +2114,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -2019,10 +2127,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2032,10 +2140,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2045,10 +2153,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2058,10 +2166,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2071,37 +2179,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __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_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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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)); __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2110,7 +2218,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2119,57 +2227,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -2194,31 +2302,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* 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)); + __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 CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2226,11 +2342,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2240,7 +2356,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2248,14 +2364,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2270,9 +2386,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2280,7 +2396,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2298,7 +2414,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2313,9 +2429,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2323,7 +2439,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2341,7 +2457,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2356,9 +2472,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2366,7 +2482,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2384,7 +2500,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2399,9 +2515,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2409,7 +2525,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2427,7 +2543,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2442,9 +2558,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2452,7 +2568,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2470,7 +2586,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.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: # <<<<<<<<<<<<<< @@ -2493,18 +2609,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2513,7 +2630,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2522,7 +2639,7 @@ 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":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2530,31 +2647,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2563,20 +2685,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} + #endif + } else if (1) { + __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -2584,99 +2735,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), 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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * 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_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), 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_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2684,16 +2834,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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2702,7 +2851,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2711,430 +2860,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.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_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.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_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), 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_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.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 = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.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_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -3142,25 +3274,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_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __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_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3189,7 +3321,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3201,9 +3333,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3213,7 +3345,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3225,7 +3357,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3234,7 +3366,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3245,7 +3377,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3254,7 +3386,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3266,7 +3398,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3278,9 +3410,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3290,7 +3422,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3305,7 +3437,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3325,7 +3457,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } static struct __pyx_vtabstruct_7sklearn_5utils_12arraybuilder_ArrayBuilder __pyx_vtable_7sklearn_5utils_12arraybuilder_ArrayBuilder; -static PyObject *__pyx_tp_new_7sklearn_5utils_12arraybuilder_ArrayBuilder(PyTypeObject *t, PyObject *a, PyObject *k) { +static PyObject *__pyx_tp_new_7sklearn_5utils_12arraybuilder_ArrayBuilder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *p; PyObject *o = (*t->tp_alloc)(t, 0); if (!o) return 0; @@ -3337,7 +3469,9 @@ static PyObject *__pyx_tp_new_7sklearn_5utils_12arraybuilder_ArrayBuilder(PyType static void __pyx_tp_dealloc_7sklearn_5utils_12arraybuilder_ArrayBuilder(PyObject *o) { struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *p = (struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *)o; - Py_XDECREF(p->_arr); + PyObject_GC_UnTrack(o); + Py_CLEAR(p->_arr); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -3360,8 +3494,8 @@ static int __pyx_tp_clear_7sklearn_5utils_12arraybuilder_ArrayBuilder(PyObject * } static PyMethodDef __pyx_methods_7sklearn_5utils_12arraybuilder_ArrayBuilder[] = { - {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2append, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_12arraybuilder_12ArrayBuilder_2append)}, - {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3get, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3get)}, + {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_5append, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_12arraybuilder_12ArrayBuilder_4append)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_7get, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_12arraybuilder_12ArrayBuilder_6get)}, {0, 0, 0, 0} }; @@ -3424,7 +3558,7 @@ static PyNumberMethods __pyx_tp_as_number_ArrayBuilder = { }; static PySequenceMethods __pyx_tp_as_sequence_ArrayBuilder = { - __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_1__len__, /*sq_length*/ + __pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ 0, /*sq_item*/ @@ -3437,7 +3571,7 @@ static PySequenceMethods __pyx_tp_as_sequence_ArrayBuilder = { }; static PyMappingMethods __pyx_tp_as_mapping_ArrayBuilder = { - __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder_1__len__, /*mp_length*/ + __pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_3__len__, /*mp_length*/ 0, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; @@ -3503,7 +3637,7 @@ static PyTypeObject __pyx_type_7sklearn_5utils_12arraybuilder_ArrayBuilder = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pf_7sklearn_5utils_12arraybuilder_12ArrayBuilder___init__, /*tp_init*/ + __pyx_pw_7sklearn_5utils_12arraybuilder_12ArrayBuilder_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_7sklearn_5utils_12arraybuilder_ArrayBuilder, /*tp_new*/ 0, /*tp_free*/ @@ -3560,9 +3694,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3570,86 +3704,86 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numpy.pxd":211 + /* "numpy.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_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "numpy.pxd":215 + /* "numpy.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_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "numpy.pxd":819 + /* "numpy.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_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); @@ -3692,13 +3826,19 @@ PyMODINIT_FUNC PyInit_arraybuilder(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_arraybuilder(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_arraybuilder(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS @@ -3708,16 +3848,23 @@ PyMODINIT_FUNC PyInit_arraybuilder(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("arraybuilder"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("arraybuilder"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__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.utils.arraybuilder")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.utils.arraybuilder", __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); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3734,56 +3881,72 @@ PyMODINIT_FUNC PyInit_arraybuilder(void) /*--- Type init code ---*/ __pyx_vtabptr_7sklearn_5utils_12arraybuilder_ArrayBuilder = &__pyx_vtable_7sklearn_5utils_12arraybuilder_ArrayBuilder; __pyx_vtable_7sklearn_5utils_12arraybuilder_ArrayBuilder._grow = (PyObject *(*)(struct __pyx_obj_7sklearn_5utils_12arraybuilder_ArrayBuilder *))__pyx_f_7sklearn_5utils_12arraybuilder_12ArrayBuilder__grow; - if (PyType_Ready(&__pyx_type_7sklearn_5utils_12arraybuilder_ArrayBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_12arraybuilder_ArrayBuilder.tp_dict, __pyx_vtabptr_7sklearn_5utils_12arraybuilder_ArrayBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ArrayBuilder", (PyObject *)&__pyx_type_7sklearn_5utils_12arraybuilder_ArrayBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5utils_12arraybuilder_ArrayBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_12arraybuilder_ArrayBuilder.tp_dict, __pyx_vtabptr_7sklearn_5utils_12arraybuilder_ArrayBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ArrayBuilder", (PyObject *)&__pyx_type_7sklearn_5utils_12arraybuilder_ArrayBuilder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5utils_12arraybuilder_ArrayBuilder = &__pyx_type_7sklearn_5utils_12arraybuilder_ArrayBuilder; /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "sklearn/utils/arraybuilder.pyx":3 + /* "sklearn/utils/arraybuilder.pyx":6 * cimport cython * cimport numpy as np * import 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 = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/arraybuilder.pyx":10 + /* "sklearn/utils/arraybuilder.pyx":8 + * import numpy as np + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/utils/arraybuilder.pyx":15 * # Or: let's reinvent the wheel! * * GROWTH_FACTOR = 1.5 # <<<<<<<<<<<<<< * * cdef Py_ssize_t _nelems */ - __pyx_t_1 = PyFloat_FromDouble(1.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_ptype_7sklearn_5utils_12arraybuilder_ArrayBuilder->tp_dict, __pyx_n_s__GROWTH_FACTOR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_7sklearn_5utils_12arraybuilder_ArrayBuilder->tp_dict, __pyx_n_s__GROWTH_FACTOR, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7sklearn_5utils_12arraybuilder_ArrayBuilder); /* "sklearn/utils/arraybuilder.pyx":1 - * cimport cython # <<<<<<<<<<<<<< - * cimport numpy as np - * import numpy as np + * # Author: Lars Buitinck # <<<<<<<<<<<<<< + * # License: BSD-style + * */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3809,7 +3972,6 @@ PyMODINIT_FUNC PyInit_arraybuilder(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -3835,7 +3997,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -3851,55 +4013,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -3927,7 +4111,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -3939,7 +4122,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -3959,11 +4142,10 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { return result; } - static CYTHON_INLINE void __Pyx_ErrRestore(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->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -3973,55 +4155,60 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -4044,7 +4231,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -4053,10 +4239,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -4066,7 +4251,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -4075,13 +4259,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } 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; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -4098,14 +4305,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -4115,35 +4317,70 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +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 { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { @@ -4184,12 +4421,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -4882,6 +5140,23 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -4891,7 +5166,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; @@ -4911,7 +5185,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -4921,7 +5195,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -4935,47 +5209,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -4986,8 +5318,6 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ @@ -4995,17 +5325,38 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -5013,11 +5364,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -5052,6 +5401,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/sklearn/utils/arraybuilder.pyx b/sklearn/utils/arraybuilder.pyx index be37e59481670..e125417aa646a 100644 --- a/sklearn/utils/arraybuilder.pyx +++ b/sklearn/utils/arraybuilder.pyx @@ -5,6 +5,8 @@ cimport cython cimport numpy as np import numpy as np +np.import_array() + cdef class ArrayBuilder(object): """Helper class to incrementally build a 1-d numpy.ndarray""" diff --git a/sklearn/utils/arrayfuncs.c b/sklearn/utils/arrayfuncs.c index 1d196cc2cd6d9..03ac7ca8f4924 100644 --- a/sklearn/utils/arrayfuncs.c +++ b/sklearn/utils/arrayfuncs.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.2 on Thu Jan 3 15:03:20 2013 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:51:01 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -559,7 +559,7 @@ typedef npy_double __pyx_t_5numpy_double_t; */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* "sklearn/utils/arrayfuncs.pyx":42 +/* "sklearn/utils/arrayfuncs.pyx":44 * int cholesky_delete_flt(int m, int n, float *L, int go_out) * * ctypedef np.float64_t DOUBLE # <<<<<<<<<<<<<< @@ -931,7 +931,7 @@ static char __pyx_k_12[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_13[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_16[] = "Format string allocated too short."; static char __pyx_k_18[] = "\nSmall collection of auxiliary functions that operate on arrays\n\n"; -static char __pyx_k_21[] = "/home/lars/src/scikit-learn/sklearn/utils/arrayfuncs.pyx"; +static char __pyx_k_21[] = "/scratch/apps/src/scikit-learn/sklearn/utils/arrayfuncs.pyx"; static char __pyx_k_22[] = "sklearn.utils.arrayfuncs"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; @@ -1030,7 +1030,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10arrayfuncs_1min_pos(PyObject *__pyx_ PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("min_pos (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5utils_10arrayfuncs_min_pos(__pyx_self, ((PyArrayObject *)__pyx_v_X)); goto __pyx_L0; __pyx_L1_error:; @@ -1040,7 +1040,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10arrayfuncs_1min_pos(PyObject *__pyx_ return __pyx_r; } -/* "sklearn/utils/arrayfuncs.pyx":45 +/* "sklearn/utils/arrayfuncs.pyx":47 * * * def min_pos(np.ndarray X): # <<<<<<<<<<<<<< @@ -1060,25 +1060,25 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_min_pos(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("min_pos", 0); - /* "sklearn/utils/arrayfuncs.pyx":51 + /* "sklearn/utils/arrayfuncs.pyx":53 * Returns a huge value if none of the values are positive * """ * if X.dtype.name == 'float32': # <<<<<<<<<<<<<< * return _float_min_pos( X.data, X.size) * elif X.dtype.name == 'float64': */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float32), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float32), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "sklearn/utils/arrayfuncs.pyx":52 + /* "sklearn/utils/arrayfuncs.pyx":54 * """ * if X.dtype.name == 'float32': * return _float_min_pos( X.data, X.size) # <<<<<<<<<<<<<< @@ -1086,11 +1086,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_min_pos(CYTHON_UNUSED PyO * return _double_min_pos( X.data, X.size) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5utils_10arrayfuncs__float_min_pos(((float *)__pyx_v_X->data), __pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5utils_10arrayfuncs__float_min_pos(((float *)__pyx_v_X->data), __pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1098,25 +1098,25 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_min_pos(CYTHON_UNUSED PyO goto __pyx_L3; } - /* "sklearn/utils/arrayfuncs.pyx":53 + /* "sklearn/utils/arrayfuncs.pyx":55 * if X.dtype.name == 'float32': * return _float_min_pos( X.data, X.size) * elif X.dtype.name == 'float64': # <<<<<<<<<<<<<< * return _double_min_pos( X.data, X.size) * else: */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float64), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float64), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "sklearn/utils/arrayfuncs.pyx":54 + /* "sklearn/utils/arrayfuncs.pyx":56 * return _float_min_pos( X.data, X.size) * elif X.dtype.name == 'float64': * return _double_min_pos( X.data, X.size) # <<<<<<<<<<<<<< @@ -1124,11 +1124,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_min_pos(CYTHON_UNUSED PyO * raise ValueError('Unsupported dtype for array X') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5utils_10arrayfuncs__double_min_pos(((double *)__pyx_v_X->data), __pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5utils_10arrayfuncs__double_min_pos(((double *)__pyx_v_X->data), __pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1137,18 +1137,18 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_min_pos(CYTHON_UNUSED PyO } /*else*/ { - /* "sklearn/utils/arrayfuncs.pyx":56 + /* "sklearn/utils/arrayfuncs.pyx":58 * return _double_min_pos( X.data, X.size) * else: * raise ValueError('Unsupported dtype for array X') # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __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 = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -1165,7 +1165,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_min_pos(CYTHON_UNUSED PyO return __pyx_r; } -/* "sklearn/utils/arrayfuncs.pyx":59 +/* "sklearn/utils/arrayfuncs.pyx":61 * * * cdef float _float_min_pos(float *X, Py_ssize_t size): # <<<<<<<<<<<<<< @@ -1185,7 +1185,7 @@ static float __pyx_f_7sklearn_5utils_10arrayfuncs__float_min_pos(float *__pyx_v_ int __pyx_t_5; __Pyx_RefNannySetupContext("_float_min_pos", 0); - /* "sklearn/utils/arrayfuncs.pyx":61 + /* "sklearn/utils/arrayfuncs.pyx":63 * cdef float _float_min_pos(float *X, Py_ssize_t size): * cdef Py_ssize_t i * cdef float min_val = DBL_MAX # <<<<<<<<<<<<<< @@ -1194,7 +1194,7 @@ static float __pyx_f_7sklearn_5utils_10arrayfuncs__float_min_pos(float *__pyx_v_ */ __pyx_v_min_val = DBL_MAX; - /* "sklearn/utils/arrayfuncs.pyx":62 + /* "sklearn/utils/arrayfuncs.pyx":64 * cdef Py_ssize_t i * cdef float min_val = DBL_MAX * for i in range(size): # <<<<<<<<<<<<<< @@ -1205,7 +1205,7 @@ static float __pyx_f_7sklearn_5utils_10arrayfuncs__float_min_pos(float *__pyx_v_ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/utils/arrayfuncs.pyx":63 + /* "sklearn/utils/arrayfuncs.pyx":65 * cdef float min_val = DBL_MAX * for i in range(size): * if X[i] > 0. and X[i] < min_val: # <<<<<<<<<<<<<< @@ -1221,7 +1221,7 @@ static float __pyx_f_7sklearn_5utils_10arrayfuncs__float_min_pos(float *__pyx_v_ } if (__pyx_t_5) { - /* "sklearn/utils/arrayfuncs.pyx":64 + /* "sklearn/utils/arrayfuncs.pyx":66 * for i in range(size): * if X[i] > 0. and X[i] < min_val: * min_val = X[i] # <<<<<<<<<<<<<< @@ -1234,7 +1234,7 @@ static float __pyx_f_7sklearn_5utils_10arrayfuncs__float_min_pos(float *__pyx_v_ __pyx_L5:; } - /* "sklearn/utils/arrayfuncs.pyx":65 + /* "sklearn/utils/arrayfuncs.pyx":67 * if X[i] > 0. and X[i] < min_val: * min_val = X[i] * return min_val # <<<<<<<<<<<<<< @@ -1250,7 +1250,7 @@ static float __pyx_f_7sklearn_5utils_10arrayfuncs__float_min_pos(float *__pyx_v_ return __pyx_r; } -/* "sklearn/utils/arrayfuncs.pyx":68 +/* "sklearn/utils/arrayfuncs.pyx":70 * * * cdef double _double_min_pos(double *X, Py_ssize_t size): # <<<<<<<<<<<<<< @@ -1270,7 +1270,7 @@ static double __pyx_f_7sklearn_5utils_10arrayfuncs__double_min_pos(double *__pyx int __pyx_t_5; __Pyx_RefNannySetupContext("_double_min_pos", 0); - /* "sklearn/utils/arrayfuncs.pyx":70 + /* "sklearn/utils/arrayfuncs.pyx":72 * cdef double _double_min_pos(double *X, Py_ssize_t size): * cdef Py_ssize_t i * cdef np.float64_t min_val = FLT_MAX # <<<<<<<<<<<<<< @@ -1279,7 +1279,7 @@ static double __pyx_f_7sklearn_5utils_10arrayfuncs__double_min_pos(double *__pyx */ __pyx_v_min_val = FLT_MAX; - /* "sklearn/utils/arrayfuncs.pyx":71 + /* "sklearn/utils/arrayfuncs.pyx":73 * cdef Py_ssize_t i * cdef np.float64_t min_val = FLT_MAX * for i in range(size): # <<<<<<<<<<<<<< @@ -1290,7 +1290,7 @@ static double __pyx_f_7sklearn_5utils_10arrayfuncs__double_min_pos(double *__pyx for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/utils/arrayfuncs.pyx":72 + /* "sklearn/utils/arrayfuncs.pyx":74 * cdef np.float64_t min_val = FLT_MAX * for i in range(size): * if X[i] > 0. and X[i] < min_val: # <<<<<<<<<<<<<< @@ -1306,7 +1306,7 @@ static double __pyx_f_7sklearn_5utils_10arrayfuncs__double_min_pos(double *__pyx } if (__pyx_t_5) { - /* "sklearn/utils/arrayfuncs.pyx":73 + /* "sklearn/utils/arrayfuncs.pyx":75 * for i in range(size): * if X[i] > 0. and X[i] < min_val: * min_val = X[i] # <<<<<<<<<<<<<< @@ -1319,7 +1319,7 @@ static double __pyx_f_7sklearn_5utils_10arrayfuncs__double_min_pos(double *__pyx __pyx_L5:; } - /* "sklearn/utils/arrayfuncs.pyx":74 + /* "sklearn/utils/arrayfuncs.pyx":76 * if X[i] > 0. and X[i] < min_val: * min_val = X[i] * return min_val # <<<<<<<<<<<<<< @@ -1365,11 +1365,11 @@ static PyObject *__pyx_pw_7sklearn_5utils_10arrayfuncs_3solve_triangular(PyObjec case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("solve_triangular", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("solve_triangular", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solve_triangular") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solve_triangular") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1382,14 +1382,14 @@ static PyObject *__pyx_pw_7sklearn_5utils_10arrayfuncs_3solve_triangular(PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("solve_triangular", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("solve_triangular", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.arrayfuncs.solve_triangular", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __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 = 77; __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 = 79; __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 = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5utils_10arrayfuncs_2solve_triangular(__pyx_self, __pyx_v_X, __pyx_v_y); goto __pyx_L0; __pyx_L1_error:; @@ -1399,7 +1399,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10arrayfuncs_3solve_triangular(PyObjec return __pyx_r; } -/* "sklearn/utils/arrayfuncs.pyx":77 +/* "sklearn/utils/arrayfuncs.pyx":79 * * * def solve_triangular(np.ndarray X, np.ndarray y): # <<<<<<<<<<<<<< @@ -1422,31 +1422,31 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_2solve_triangular(CYTHON_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("solve_triangular", 0); - /* "sklearn/utils/arrayfuncs.pyx":86 + /* "sklearn/utils/arrayfuncs.pyx":88 * cdef int lda * * if X.dtype.name == 'float64' and y.dtype.name == 'float64': # <<<<<<<<<<<<<< * lda = X.strides[0] / sizeof(double) * */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float64), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float64), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float64), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float64), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __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 = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __pyx_t_4; } else { @@ -1454,7 +1454,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_2solve_triangular(CYTHON_ } if (__pyx_t_5) { - /* "sklearn/utils/arrayfuncs.pyx":87 + /* "sklearn/utils/arrayfuncs.pyx":89 * * if X.dtype.name == 'float64' and y.dtype.name == 'float64': * lda = X.strides[0] / sizeof(double) # <<<<<<<<<<<<<< @@ -1464,11 +1464,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_2solve_triangular(CYTHON_ __pyx_t_6 = (sizeof(double)); if (unlikely(__pyx_t_6 == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_lda = (((int)(__pyx_v_X->strides[0])) / __pyx_t_6); - /* "sklearn/utils/arrayfuncs.pyx":91 + /* "sklearn/utils/arrayfuncs.pyx":93 * cblas_dtrsv(CblasRowMajor, CblasLower, CblasNoTrans, * CblasNonUnit, X.shape[0], X.data, * lda, y.data, 1) # <<<<<<<<<<<<<< @@ -1479,31 +1479,31 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_2solve_triangular(CYTHON_ goto __pyx_L3; } - /* "sklearn/utils/arrayfuncs.pyx":93 + /* "sklearn/utils/arrayfuncs.pyx":95 * lda, y.data, 1) * * elif X.dtype.name == 'float32' and y.dtype.name == 'float32': # <<<<<<<<<<<<<< * lda = X.strides[0] / sizeof(float) * */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float32), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float32), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float32), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float32), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __pyx_t_3; } else { @@ -1511,7 +1511,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_2solve_triangular(CYTHON_ } if (__pyx_t_4) { - /* "sklearn/utils/arrayfuncs.pyx":94 + /* "sklearn/utils/arrayfuncs.pyx":96 * * elif X.dtype.name == 'float32' and y.dtype.name == 'float32': * lda = X.strides[0] / sizeof(float) # <<<<<<<<<<<<<< @@ -1521,11 +1521,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_2solve_triangular(CYTHON_ __pyx_t_6 = (sizeof(float)); if (unlikely(__pyx_t_6 == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_lda = (((int)(__pyx_v_X->strides[0])) / __pyx_t_6); - /* "sklearn/utils/arrayfuncs.pyx":98 + /* "sklearn/utils/arrayfuncs.pyx":100 * cblas_strsv(CblasRowMajor, CblasLower, CblasNoTrans, * CblasNonUnit, X.shape[0], X.data, * lda, y.data, 1) # <<<<<<<<<<<<<< @@ -1537,18 +1537,18 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_2solve_triangular(CYTHON_ } /*else*/ { - /* "sklearn/utils/arrayfuncs.pyx":100 + /* "sklearn/utils/arrayfuncs.pyx":102 * lda, y.data, 1) * else: * raise ValueError('Unsupported or inconsistent dtype in arrays X, y') # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __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 = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -1594,11 +1594,11 @@ static PyObject *__pyx_pw_7sklearn_5utils_10arrayfuncs_5cholesky_delete(PyObject case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__go_out)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("cholesky_delete", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cholesky_delete", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cholesky_delete") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cholesky_delete") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1607,17 +1607,17 @@ static PyObject *__pyx_pw_7sklearn_5utils_10arrayfuncs_5cholesky_delete(PyObject values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_L = ((PyArrayObject *)values[0]); - __pyx_v_go_out = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_go_out == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_go_out = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_go_out == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cholesky_delete", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cholesky_delete", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.arrayfuncs.cholesky_delete", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_L), __pyx_ptype_5numpy_ndarray, 1, "L", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_L), __pyx_ptype_5numpy_ndarray, 1, "L", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5utils_10arrayfuncs_4cholesky_delete(__pyx_self, __pyx_v_L, __pyx_v_go_out); goto __pyx_L0; __pyx_L1_error:; @@ -1627,7 +1627,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10arrayfuncs_5cholesky_delete(PyObject return __pyx_r; } -/* "sklearn/utils/arrayfuncs.pyx":104 +/* "sklearn/utils/arrayfuncs.pyx":106 * * # we should be using np.npy_intp or Py_ssize_t for indices, but BLAS wants int * def cholesky_delete(np.ndarray L, int go_out): # <<<<<<<<<<<<<< @@ -1649,7 +1649,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_4cholesky_delete(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cholesky_delete", 0); - /* "sklearn/utils/arrayfuncs.pyx":105 + /* "sklearn/utils/arrayfuncs.pyx":107 * # we should be using np.npy_intp or Py_ssize_t for indices, but BLAS wants int * def cholesky_delete(np.ndarray L, int go_out): * cdef int n = L.shape[0] # <<<<<<<<<<<<<< @@ -1658,7 +1658,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_4cholesky_delete(CYTHON_U */ __pyx_v_n = ((int)(__pyx_v_L->dimensions[0])); - /* "sklearn/utils/arrayfuncs.pyx":106 + /* "sklearn/utils/arrayfuncs.pyx":108 * def cholesky_delete(np.ndarray L, int go_out): * cdef int n = L.shape[0] * cdef int m = L.strides[0] # <<<<<<<<<<<<<< @@ -1667,25 +1667,25 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_4cholesky_delete(CYTHON_U */ __pyx_v_m = ((int)(__pyx_v_L->strides[0])); - /* "sklearn/utils/arrayfuncs.pyx":108 + /* "sklearn/utils/arrayfuncs.pyx":110 * cdef int m = L.strides[0] * * if L.dtype.name == 'float64': # <<<<<<<<<<<<<< * cholesky_delete_dbl(m / sizeof(double), n, L.data, go_out) * elif L.dtype.name == 'float32': */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_L), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_L), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float64), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float64), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "sklearn/utils/arrayfuncs.pyx":109 + /* "sklearn/utils/arrayfuncs.pyx":111 * * if L.dtype.name == 'float64': * cholesky_delete_dbl(m / sizeof(double), n, L.data, go_out) # <<<<<<<<<<<<<< @@ -1695,31 +1695,31 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_4cholesky_delete(CYTHON_U __pyx_t_4 = (sizeof(double)); if (unlikely(__pyx_t_4 == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } cholesky_delete_dbl((__pyx_v_m / __pyx_t_4), __pyx_v_n, ((double *)__pyx_v_L->data), __pyx_v_go_out); goto __pyx_L3; } - /* "sklearn/utils/arrayfuncs.pyx":110 + /* "sklearn/utils/arrayfuncs.pyx":112 * if L.dtype.name == 'float64': * cholesky_delete_dbl(m / sizeof(double), n, L.data, go_out) * elif L.dtype.name == 'float32': # <<<<<<<<<<<<<< * cholesky_delete_flt(m / sizeof(float), n, L.data, go_out) * else: */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_L), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_L), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__name); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float32), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float32), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "sklearn/utils/arrayfuncs.pyx":111 + /* "sklearn/utils/arrayfuncs.pyx":113 * cholesky_delete_dbl(m / sizeof(double), n, L.data, go_out) * elif L.dtype.name == 'float32': * cholesky_delete_flt(m / sizeof(float), n, L.data, go_out) # <<<<<<<<<<<<<< @@ -1729,34 +1729,34 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_4cholesky_delete(CYTHON_U __pyx_t_4 = (sizeof(float)); if (unlikely(__pyx_t_4 == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } cholesky_delete_flt((__pyx_v_m / __pyx_t_4), __pyx_v_n, ((float *)__pyx_v_L->data), __pyx_v_go_out); goto __pyx_L3; } /*else*/ { - /* "sklearn/utils/arrayfuncs.pyx":113 + /* "sklearn/utils/arrayfuncs.pyx":115 * cholesky_delete_flt(m / sizeof(float), n, L.data, go_out) * else: * raise TypeError("unsupported dtype %r." % L.dtype) # <<<<<<<<<<<<<< */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_L), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_L), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__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 = 113; __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 = 115; __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)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -1774,8 +1774,8 @@ static PyObject *__pyx_pf_7sklearn_5utils_10arrayfuncs_4cholesky_delete(CYTHON_U } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -2593,8 +2593,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -3802,9 +3802,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; @@ -3815,28 +3815,28 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/utils/arrayfuncs.pyx":56 + /* "sklearn/utils/arrayfuncs.pyx":58 * return _double_min_pos( X.data, X.size) * else: * raise ValueError('Unsupported dtype for array X') # <<<<<<<<<<<<<< * * */ - __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "sklearn/utils/arrayfuncs.pyx":100 + /* "sklearn/utils/arrayfuncs.pyx":102 * lda, y.data, 1) * else: * raise ValueError('Unsupported or inconsistent dtype in arrays X, y') # <<<<<<<<<<<<<< * * */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); @@ -3927,29 +3927,29 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); - /* "sklearn/utils/arrayfuncs.pyx":45 + /* "sklearn/utils/arrayfuncs.pyx":47 * * * def min_pos(np.ndarray X): # <<<<<<<<<<<<<< * """ * Find the minimum value of an array over positive values */ - __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_19); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__X)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); - __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__min_pos, 45, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__min_pos, 47, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/utils/arrayfuncs.pyx":77 + /* "sklearn/utils/arrayfuncs.pyx":79 * * * def solve_triangular(np.ndarray X, np.ndarray y): # <<<<<<<<<<<<<< * """ * Solves a triangular system (overwrites y) */ - __pyx_k_tuple_23 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_23 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_23); __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__X)); @@ -3961,16 +3961,16 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_23, 2, ((PyObject *)__pyx_n_s__lda)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lda)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); - __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__solve_triangular, 77, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__solve_triangular, 79, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/utils/arrayfuncs.pyx":104 + /* "sklearn/utils/arrayfuncs.pyx":106 * * # we should be using np.npy_intp or Py_ssize_t for indices, but BLAS wants int * def cholesky_delete(np.ndarray L, int go_out): # <<<<<<<<<<<<<< * cdef int n = L.shape[0] * cdef int m = L.strides[0] */ - __pyx_k_tuple_25 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_25 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_INCREF(((PyObject *)__pyx_n_s__L)); PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_n_s__L)); @@ -3985,7 +3985,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_25, 3, ((PyObject *)__pyx_n_s__m)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); - __pyx_k_codeobj_26 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__cholesky_delete, 104, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_26 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__cholesky_delete, 106, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -4102,40 +4102,49 @@ PyMODINIT_FUNC PyInit_arrayfuncs(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/arrayfuncs.pyx":45 + /* "sklearn/utils/arrayfuncs.pyx":12 + * from libc.float cimport DBL_MAX, FLT_MAX + * + * np.import_array() # <<<<<<<<<<<<<< + * + * cdef extern from "cblas.h": + */ + import_array(); + + /* "sklearn/utils/arrayfuncs.pyx":47 * * * def min_pos(np.ndarray X): # <<<<<<<<<<<<<< * """ * Find the minimum value of an array over positive values */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10arrayfuncs_1min_pos, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10arrayfuncs_1min_pos, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__min_pos, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__min_pos, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/arrayfuncs.pyx":77 + /* "sklearn/utils/arrayfuncs.pyx":79 * * * def solve_triangular(np.ndarray X, np.ndarray y): # <<<<<<<<<<<<<< * """ * Solves a triangular system (overwrites y) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10arrayfuncs_3solve_triangular, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10arrayfuncs_3solve_triangular, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__solve_triangular, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__solve_triangular, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/arrayfuncs.pyx":104 + /* "sklearn/utils/arrayfuncs.pyx":106 * * # we should be using np.npy_intp or Py_ssize_t for indices, but BLAS wants int * def cholesky_delete(np.ndarray L, int go_out): # <<<<<<<<<<<<<< * cdef int n = L.shape[0] * cdef int m = L.strides[0] */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10arrayfuncs_5cholesky_delete, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10arrayfuncs_5cholesky_delete, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cholesky_delete, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cholesky_delete, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/utils/arrayfuncs.pyx":1 diff --git a/sklearn/utils/arrayfuncs.pyx b/sklearn/utils/arrayfuncs.pyx index f8379a12fe9df..fe41692d6e72f 100644 --- a/sklearn/utils/arrayfuncs.pyx +++ b/sklearn/utils/arrayfuncs.pyx @@ -9,6 +9,8 @@ cimport cython from libc.float cimport DBL_MAX, FLT_MAX +np.import_array() + cdef extern from "cblas.h": enum CBLAS_ORDER: CblasRowMajor=101 diff --git a/sklearn/utils/graph_shortest_path.c b/sklearn/utils/graph_shortest_path.c index 27a9c6e686a95..4973a3c7211dc 100644 --- a/sklearn/utils/graph_shortest_path.c +++ b/sklearn/utils/graph_shortest_path.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Sat Feb 25 08:12:27 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:53 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #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 PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #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) #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) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 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_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])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -266,7 +285,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -290,8 +309,12 @@ 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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -316,7 +339,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -326,7 +348,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -334,18 +355,54 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "graph_shortest_path.pyx", "numpy.pxd", + "type.pxd", }; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + -/* "numpy.pxd":719 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -354,7 +411,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -363,7 +420,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -372,7 +429,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -381,7 +438,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -390,7 +447,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -399,7 +456,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -408,7 +465,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -417,7 +474,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -426,7 +483,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -435,7 +492,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.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 # <<<<<<<<<<<<<< @@ -444,7 +501,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -453,7 +510,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -462,7 +519,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -471,7 +528,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -480,7 +537,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -489,7 +546,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -498,7 +555,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -507,7 +564,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -516,7 +573,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -525,7 +582,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -534,7 +591,7 @@ typedef npy_double __pyx_t_5numpy_double_t; */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* "sklearn/utils/graph_shortest_path.pyx":22 +/* "sklearn/utils/graph_shortest_path.pyx":24 * * DTYPE = np.float64 * ctypedef np.float64_t DTYPE_t # <<<<<<<<<<<<<< @@ -543,7 +600,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t; -/* "sklearn/utils/graph_shortest_path.pyx":25 +/* "sklearn/utils/graph_shortest_path.pyx":27 * * ITYPE = np.int32 * ctypedef np.int32_t ITYPE_t # <<<<<<<<<<<<<< @@ -551,7 +608,6 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5utils_19graph_shortest_path_D * */ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -572,9 +628,10 @@ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_5utils_19graph_shortest_path_ITY typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -583,7 +640,7 @@ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_5utils_19graph_shortest_path_ITY */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -592,7 +649,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -601,7 +658,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -615,7 +672,7 @@ struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode; struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_initialize_node; struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciHeap; -/* "sklearn/utils/graph_shortest_path.pyx":94 +/* "sklearn/utils/graph_shortest_path.pyx":96 * * @cython.boundscheck(False) * cdef np.ndarray floyd_warshall(np.ndarray[DTYPE_t, ndim=2, mode='c'] graph, # <<<<<<<<<<<<<< @@ -627,7 +684,7 @@ struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_floyd_warshall { int directed; }; -/* "sklearn/utils/graph_shortest_path.pyx":156 +/* "sklearn/utils/graph_shortest_path.pyx":158 * * @cython.boundscheck(False) * cdef np.ndarray dijkstra(dist_matrix, # <<<<<<<<<<<<<< @@ -639,7 +696,7 @@ struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_dijkstra { int directed; }; -/* "sklearn/utils/graph_shortest_path.pyx":242 +/* "sklearn/utils/graph_shortest_path.pyx":244 * # * * cdef struct FibonacciNode: # <<<<<<<<<<<<<< @@ -657,7 +714,7 @@ struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode { struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *children; }; -/* "sklearn/utils/graph_shortest_path.pyx":253 +/* "sklearn/utils/graph_shortest_path.pyx":255 * * * cdef void initialize_node(FibonacciNode* node, # <<<<<<<<<<<<<< @@ -669,7 +726,7 @@ struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_initialize_node { __pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t val; }; -/* "sklearn/utils/graph_shortest_path.pyx":339 +/* "sklearn/utils/graph_shortest_path.pyx":341 * # routines to implement a Fibonacci heap * * ctypedef FibonacciNode* pFibonacciNode # <<<<<<<<<<<<<< @@ -678,7 +735,7 @@ struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_initialize_node { */ typedef struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_t_7sklearn_5utils_19graph_shortest_path_pFibonacciNode; -/* "sklearn/utils/graph_shortest_path.pyx":342 +/* "sklearn/utils/graph_shortest_path.pyx":344 * * * cdef struct FibonacciHeap: # <<<<<<<<<<<<<< @@ -689,12 +746,9 @@ struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciHeap { struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *min_node; __pyx_t_7sklearn_5utils_19graph_shortest_path_pFibonacciNode roots_by_rank[100]; }; - - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -707,8 +761,21 @@ struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciHeap { static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -719,7 +786,7 @@ struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciHeap { #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -730,18 +797,20 @@ struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciHeap { #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; @@ -749,70 +818,83 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j Py_DECREF(j); return r; } - - #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - - #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { /* inlined PySequence_GetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } + return m->sq_item(o, i); + } } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); } - return r; +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ @@ -822,64 +904,50 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); + #define __Pyx_BufPtrCContig2d(type, buf, i0, s0, i1, s1) ((type)((char*)buf + i0 * s0) + i1) #define __Pyx_BufPtrCContig1d(type, buf, i0, s0) ((type)buf + i0) +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + #if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); #else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release #endif -Py_ssize_t __Pyx_zeros[] = {0, 0}; -Py_ssize_t __Pyx_minusones[] = {-1, -1}; - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ - -#include -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ +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 int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -893,7 +961,6 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -1017,15 +1084,38 @@ static void __Pyx_WriteUnraisable(const char *name, int clineno, static int __Pyx_check_binary_version(void); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -1034,6 +1124,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -1044,16 +1139,7 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ - -/* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ @@ -1072,8 +1158,8 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_f_7sklearn_5utils_19graph_shortest_path_remove_min(struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciHeap *); /*proto*/ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_row(unsigned int, PyArrayObject *, PyArrayObject *, PyArrayObject *, PyArrayObject *, struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciHeap *, struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *); /*proto*/ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsigned int, PyArrayObject *, PyArrayObject *, PyArrayObject *, PyArrayObject *, PyArrayObject *, PyArrayObject *, PyArrayObject *, struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciHeap *, struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t = { "ITYPE_t", NULL, sizeof(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t), { 0 }, 0, 'R', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t = { "ITYPE_t", NULL, sizeof(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t), 0 }; #define __Pyx_MODULE_NAME "sklearn.utils.graph_shortest_path" int __pyx_module_is_main_sklearn__utils__graph_shortest_path = 0; @@ -1081,6 +1167,9 @@ int __pyx_module_is_main_sklearn__utils__graph_shortest_path = 0; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_path(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dist_matrix, PyObject *__pyx_v_directed, PyObject *__pyx_v_method); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_2[] = "unrecognized method '%s'"; static char __pyx_k_3[] = "ndarray is not C contiguous"; static char __pyx_k_5[] = "ndarray is not Fortran contiguous"; @@ -1090,13 +1179,15 @@ static char __pyx_k_10[] = "Format string allocated too short, see comment in nu static char __pyx_k_13[] = "Format string allocated too short."; static char __pyx_k_15[] = "\nRoutines for performing shortest-path graph searches\n\nThe main interface is in the function `graph_shortest_path`. This\ncalls cython routines that compute the shortest path using either\nthe Floyd-Warshall algorithm, or Dykstra's algorithm with Fibonacci Heaps.\n"; static char __pyx_k_16[] = "scipy.sparse"; -static char __pyx_k_17[] = "sklearn.utils.graph_shortest_path"; +static char __pyx_k_19[] = "/scratch/apps/src/scikit-learn/sklearn/utils/graph_shortest_path.pyx"; +static char __pyx_k_20[] = "sklearn.utils.graph_shortest_path"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; static char __pyx_k__D[] = "D"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; +static char __pyx_k__N[] = "N"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__T[] = "T"; @@ -1109,6 +1200,7 @@ static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__FW[] = "FW"; +static char __pyx_k__Nk[] = "Nk"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; @@ -1120,6 +1212,7 @@ static char __pyx_k__flat[] = "flat"; static char __pyx_k__DTYPE[] = "DTYPE"; static char __pyx_k__ITYPE[] = "ITYPE"; static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__graph[] = "graph"; static char __pyx_k__int32[] = "int32"; static char __pyx_k__isinf[] = "isinf"; static char __pyx_k__numpy[] = "numpy"; @@ -1148,8 +1241,9 @@ static char __pyx_k__graph_shortest_path[] = "graph_shortest_path"; static PyObject *__pyx_kp_u_10; static PyObject *__pyx_kp_u_13; static PyObject *__pyx_n_s_16; -static PyObject *__pyx_n_s_17; +static PyObject *__pyx_kp_s_19; static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_n_s_20; static PyObject *__pyx_kp_u_3; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; @@ -1159,6 +1253,8 @@ static PyObject *__pyx_n_s__D; static PyObject *__pyx_n_s__DTYPE; static PyObject *__pyx_n_s__FW; static PyObject *__pyx_n_s__ITYPE; +static PyObject *__pyx_n_s__N; +static PyObject *__pyx_n_s__Nk; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__T; static PyObject *__pyx_n_s__ValueError; @@ -1173,6 +1269,7 @@ static PyObject *__pyx_n_s__dist_matrix; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__flat; static PyObject *__pyx_n_s__float64; +static PyObject *__pyx_n_s__graph; static PyObject *__pyx_n_s__graph_shortest_path; static PyObject *__pyx_n_s__indices; static PyObject *__pyx_n_s__indptr; @@ -1201,50 +1298,29 @@ 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_17; +static PyObject *__pyx_k_codeobj_18; -/* "sklearn/utils/graph_shortest_path.pyx":28 - * - * - * def graph_shortest_path(dist_matrix, directed=True, method='auto'): # <<<<<<<<<<<<<< - * """ - * Perform a shortest-path graph search on a positive directed or - */ - -static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_path(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_19graph_shortest_path_1graph_shortest_path(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7sklearn_5utils_19graph_shortest_path_graph_shortest_path[] = "\n Perform a shortest-path graph search on a positive directed or\n undirected graph.\n\n Parameters\n ----------\n dist_matrix : arraylike or sparse matrix, shape = (N,N)\n Array of positive distances.\n If vertex i is connected to vertex j, then dist_matrix[i,j] gives\n the distance between the vertices.\n If vertex i is not connected to vertex j, then dist_matrix[i,j] = 0\n directed : boolean\n if True, then find the shortest path on a directed graph: only\n progress from a point to its neighbors, not the other way around.\n if False, then find the shortest path on an undirected graph: the\n algorithm can progress from a point to its neighbors and vice versa.\n method : string ['auto'|'FW'|'D']\n method to use. Options are\n 'auto' : attempt to choose the best method for the current problem\n 'FW' : Floyd-Warshall algorithm. O[N^3]\n 'D' : Dijkstra's algorithm with Fibonacci stacks. O[(k+log(N))N^2]\n\n Returns\n -------\n G : np.ndarray, float, shape = [N,N]\n G[i,j] gives the shortest distance from point i to point j\n along the graph.\n\n Notes\n -----\n As currently implemented, Dijkstra's algorithm does not work for\n graphs with direction-dependent distances when directed == False.\n i.e., if dist_matrix[i,j] and dist_matrix[j,i] are not equal and\n both are nonzero, method='D' will not necessarily yield the correct\n result.\n\n Also, these routines have not been tested for graphs with negative\n distances. Negative distances can lead to infinite cycles that must\n be handled by specialized algorithms.\n "; -static PyMethodDef __pyx_mdef_7sklearn_5utils_19graph_shortest_path_graph_shortest_path = {__Pyx_NAMESTR("graph_shortest_path"), (PyCFunction)__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_path, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_19graph_shortest_path_graph_shortest_path)}; -static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_path(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyMethodDef __pyx_mdef_7sklearn_5utils_19graph_shortest_path_1graph_shortest_path = {__Pyx_NAMESTR("graph_shortest_path"), (PyCFunction)__pyx_pw_7sklearn_5utils_19graph_shortest_path_1graph_shortest_path, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_19graph_shortest_path_graph_shortest_path)}; +static PyObject *__pyx_pw_7sklearn_5utils_19graph_shortest_path_1graph_shortest_path(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_dist_matrix = 0; PyObject *__pyx_v_directed = 0; PyObject *__pyx_v_method = 0; - PyObject *__pyx_v_N = NULL; - Py_ssize_t __pyx_v_Nk; - PyObject *__pyx_v_graph = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - Py_ssize_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_floyd_warshall __pyx_t_9; - struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_dijkstra __pyx_t_10; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dist_matrix,&__pyx_n_s__directed,&__pyx_n_s__method,0}; - __Pyx_RefNannySetupContext("graph_shortest_path"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("graph_shortest_path (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dist_matrix,&__pyx_n_s__directed,&__pyx_n_s__method,0}; PyObject* values[3] = {0,0,0}; values[1] = __pyx_k_1; values[2] = ((PyObject *)__pyx_n_s__auto); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -1252,10 +1328,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_p default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dist_matrix); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dist_matrix)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -1269,7 +1344,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_p } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "graph_shortest_path") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "graph_shortest_path") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1286,124 +1361,158 @@ static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_p } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("graph_shortest_path", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("graph_shortest_path", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.graph_shortest_path.graph_shortest_path", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_path(__pyx_self, __pyx_v_dist_matrix, __pyx_v_directed, __pyx_v_method); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/graph_shortest_path.pyx":30 + * + * + * def graph_shortest_path(dist_matrix, directed=True, method='auto'): # <<<<<<<<<<<<<< + * """ + * Perform a shortest-path graph search on a positive directed or + */ + +static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_path(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dist_matrix, PyObject *__pyx_v_directed, PyObject *__pyx_v_method) { + PyObject *__pyx_v_N = NULL; + PyObject *__pyx_v_Nk = NULL; + PyObject *__pyx_v_graph = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_floyd_warshall __pyx_t_9; + struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_dijkstra __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("graph_shortest_path", 0); __Pyx_INCREF(__pyx_v_dist_matrix); __Pyx_INCREF(__pyx_v_method); - /* "sklearn/utils/graph_shortest_path.pyx":69 + /* "sklearn/utils/graph_shortest_path.pyx":71 * be handled by specialized algorithms. * """ * if not isspmatrix_csr(dist_matrix): # <<<<<<<<<<<<<< * dist_matrix = csr_matrix(dist_matrix) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__isspmatrix_csr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__isspmatrix_csr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_dist_matrix); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dist_matrix); __Pyx_GIVEREF(__pyx_v_dist_matrix); - __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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __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_2)); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = (!__pyx_t_4); if (__pyx_t_5) { - /* "sklearn/utils/graph_shortest_path.pyx":70 + /* "sklearn/utils/graph_shortest_path.pyx":72 * """ * if not isspmatrix_csr(dist_matrix): * dist_matrix = csr_matrix(dist_matrix) # <<<<<<<<<<<<<< * * N = dist_matrix.shape[0] */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_dist_matrix); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dist_matrix); __Pyx_GIVEREF(__pyx_v_dist_matrix); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_dist_matrix); __pyx_v_dist_matrix = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "sklearn/utils/graph_shortest_path.pyx":72 + /* "sklearn/utils/graph_shortest_path.pyx":74 * dist_matrix = csr_matrix(dist_matrix) * * N = dist_matrix.shape[0] # <<<<<<<<<<<<<< * Nk = len(dist_matrix.data) * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_N = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":73 + /* "sklearn/utils/graph_shortest_path.pyx":75 * * N = dist_matrix.shape[0] * Nk = len(dist_matrix.data) # <<<<<<<<<<<<<< * * if method == 'auto': */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_Nk = __pyx_t_6; + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_Nk = __pyx_t_2; + __pyx_t_2 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":75 + /* "sklearn/utils/graph_shortest_path.pyx":77 * Nk = len(dist_matrix.data) * * if method == 'auto': # <<<<<<<<<<<<<< * if Nk < N * N / 4: * method = 'D' */ - __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_method, ((PyObject *)__pyx_n_s__auto), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__auto), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_5) { - /* "sklearn/utils/graph_shortest_path.pyx":76 + /* "sklearn/utils/graph_shortest_path.pyx":78 * * if method == 'auto': * if Nk < N * N / 4: # <<<<<<<<<<<<<< * method = 'D' * else: */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_Nk); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_v_N, __pyx_v_N); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Multiply(__pyx_v_N, __pyx_v_N); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_int_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __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_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_int_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_Nk, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_5) { - /* "sklearn/utils/graph_shortest_path.pyx":77 + /* "sklearn/utils/graph_shortest_path.pyx":79 * if method == 'auto': * if Nk < N * N / 4: * method = 'D' # <<<<<<<<<<<<<< @@ -1413,11 +1522,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_p __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); __Pyx_DECREF(__pyx_v_method); __pyx_v_method = ((PyObject *)__pyx_n_s__D); - goto __pyx_L8; + goto __pyx_L5; } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":79 + /* "sklearn/utils/graph_shortest_path.pyx":81 * method = 'D' * else: * method = 'FW' # <<<<<<<<<<<<<< @@ -1428,173 +1537,177 @@ static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_p __Pyx_DECREF(__pyx_v_method); __pyx_v_method = ((PyObject *)__pyx_n_s__FW); } - __pyx_L8:; - goto __pyx_L7; + __pyx_L5:; + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; - /* "sklearn/utils/graph_shortest_path.pyx":81 + /* "sklearn/utils/graph_shortest_path.pyx":83 * method = 'FW' * * if method == 'FW': # <<<<<<<<<<<<<< * graph = np.asarray(dist_matrix.toarray(), dtype=DTYPE, order='C') * floyd_warshall(graph, directed) */ - __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_method, ((PyObject *)__pyx_n_s__FW), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__FW), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_5) { - /* "sklearn/utils/graph_shortest_path.pyx":82 + /* "sklearn/utils/graph_shortest_path.pyx":84 * * if method == 'FW': * graph = np.asarray(dist_matrix.toarray(), dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * floyd_warshall(graph, directed) * elif method == 'D': */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__toarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__toarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 84; __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - 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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_v_graph = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":83 + /* "sklearn/utils/graph_shortest_path.pyx":85 * if method == 'FW': * graph = np.asarray(dist_matrix.toarray(), dtype=DTYPE, order='C') * floyd_warshall(graph, directed) # <<<<<<<<<<<<<< * elif method == 'D': * graph = np.zeros((N, N), dtype=DTYPE, order='C') */ - if (!(likely(((__pyx_v_graph) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_graph, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_graph) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_graph, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = __pyx_v_graph; __Pyx_INCREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_directed); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_directed); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9.__pyx_n = 1; __pyx_t_9.directed = __pyx_t_8; - __pyx_t_2 = ((PyObject *)__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warshall(((PyArrayObject *)__pyx_t_7), &__pyx_t_9)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warshall(((PyArrayObject *)__pyx_t_7), &__pyx_t_9)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L9; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L6; } - /* "sklearn/utils/graph_shortest_path.pyx":84 + /* "sklearn/utils/graph_shortest_path.pyx":86 * graph = np.asarray(dist_matrix.toarray(), dtype=DTYPE, order='C') * floyd_warshall(graph, directed) * elif method == 'D': # <<<<<<<<<<<<<< * graph = np.zeros((N, N), dtype=DTYPE, order='C') * dijkstra(dist_matrix, graph, directed) */ - __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_method, ((PyObject *)__pyx_n_s__D), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_method, ((PyObject *)__pyx_n_s__D), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { - /* "sklearn/utils/graph_shortest_path.pyx":85 + /* "sklearn/utils/graph_shortest_path.pyx":87 * floyd_warshall(graph, directed) * elif method == 'D': * graph = np.zeros((N, N), dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * dijkstra(dist_matrix, graph, directed) * else: */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_N); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_N); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_N); __Pyx_GIVEREF(__pyx_v_N); __Pyx_INCREF(__pyx_v_N); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_N); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_N); __Pyx_GIVEREF(__pyx_v_N); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_graph = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_graph = __pyx_t_1; + __pyx_t_1 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":86 + /* "sklearn/utils/graph_shortest_path.pyx":88 * elif method == 'D': * graph = np.zeros((N, N), dtype=DTYPE, order='C') * dijkstra(dist_matrix, graph, directed) # <<<<<<<<<<<<<< * else: * raise ValueError("unrecognized method '%s'" % method) */ - if (!(likely(((__pyx_v_graph) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_graph, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __pyx_v_graph; - __Pyx_INCREF(__pyx_t_3); - __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_directed); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_graph) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_graph, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_v_graph; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_directed); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10.__pyx_n = 1; __pyx_t_10.directed = __pyx_t_8; - __pyx_t_2 = ((PyObject *)__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(__pyx_v_dist_matrix, ((PyArrayObject *)__pyx_t_3), &__pyx_t_10)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = ((PyObject *)__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(__pyx_v_dist_matrix, ((PyArrayObject *)__pyx_t_1), &__pyx_t_10)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L9; + goto __pyx_L6; } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":88 + /* "sklearn/utils/graph_shortest_path.pyx":90 * dijkstra(dist_matrix, graph, directed) * else: * raise ValueError("unrecognized method '%s'" % method) # <<<<<<<<<<<<<< * * return graph */ - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_v_method); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_v_method); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__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[0]; __pyx_lineno = 88; __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 = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L9:; + __pyx_L6:; - /* "sklearn/utils/graph_shortest_path.pyx":90 + /* "sklearn/utils/graph_shortest_path.pyx":92 * raise ValueError("unrecognized method '%s'" % method) * * return graph # <<<<<<<<<<<<<< @@ -1617,6 +1730,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_p __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_N); + __Pyx_XDECREF(__pyx_v_Nk); __Pyx_XDECREF(__pyx_v_graph); __Pyx_XDECREF(__pyx_v_dist_matrix); __Pyx_XDECREF(__pyx_v_method); @@ -1625,7 +1739,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_19graph_shortest_path_graph_shortest_p return __pyx_r; } -/* "sklearn/utils/graph_shortest_path.pyx":94 +/* "sklearn/utils/graph_shortest_path.pyx":96 * * @cython.boundscheck(False) * cdef np.ndarray floyd_warshall(np.ndarray[DTYPE_t, ndim=2, mode='c'] graph, # <<<<<<<<<<<<<< @@ -1641,11 +1755,8 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha unsigned int __pyx_v_k; __pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t __pyx_v_infinity; __pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t __pyx_v_sum_ijk; - Py_buffer __pyx_bstruct_graph; - Py_ssize_t __pyx_bstride_0_graph = 0; - Py_ssize_t __pyx_bstride_1_graph = 0; - Py_ssize_t __pyx_bshape_0_graph = 0; - Py_ssize_t __pyx_bshape_1_graph = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_graph; + __Pyx_Buffer __pyx_pybuffer_graph; PyArrayObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1682,21 +1793,23 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("floyd_warshall"); + __Pyx_RefNannySetupContext("floyd_warshall", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_directed = __pyx_optional_args->directed; } } - __pyx_bstruct_graph.buf = NULL; + __pyx_pybuffer_graph.pybuffer.buf = NULL; + __pyx_pybuffer_graph.refcount = 0; + __pyx_pybuffernd_graph.data = NULL; + __pyx_pybuffernd_graph.rcbuffer = &__pyx_pybuffer_graph; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_graph, (PyObject*)__pyx_v_graph, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_graph.rcbuffer->pybuffer, (PyObject*)__pyx_v_graph, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_graph = __pyx_bstruct_graph.strides[0]; __pyx_bstride_1_graph = __pyx_bstruct_graph.strides[1]; - __pyx_bshape_0_graph = __pyx_bstruct_graph.shape[0]; __pyx_bshape_1_graph = __pyx_bstruct_graph.shape[1]; + __pyx_pybuffernd_graph.diminfo[0].strides = __pyx_pybuffernd_graph.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_graph.diminfo[0].shape = __pyx_pybuffernd_graph.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_graph.diminfo[1].strides = __pyx_pybuffernd_graph.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_graph.diminfo[1].shape = __pyx_pybuffernd_graph.rcbuffer->pybuffer.shape[1]; - /* "sklearn/utils/graph_shortest_path.pyx":117 + /* "sklearn/utils/graph_shortest_path.pyx":119 * If no path exists, the path length is zero * """ * cdef int N = graph.shape[0] # <<<<<<<<<<<<<< @@ -1705,7 +1818,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha */ __pyx_v_N = (__pyx_v_graph->dimensions[0]); - /* "sklearn/utils/graph_shortest_path.pyx":118 + /* "sklearn/utils/graph_shortest_path.pyx":120 * """ * cdef int N = graph.shape[0] * assert graph.shape[1] == N # <<<<<<<<<<<<<< @@ -1715,74 +1828,73 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!((__pyx_v_graph->dimensions[1]) == __pyx_v_N))) { PyErr_SetNone(PyExc_AssertionError); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif - /* "sklearn/utils/graph_shortest_path.pyx":122 + /* "sklearn/utils/graph_shortest_path.pyx":124 * cdef unsigned int i, j, k, m * * cdef DTYPE_t infinity = np.inf # <<<<<<<<<<<<<< * cdef DTYPE_t sum_ijk * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __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 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_infinity = __pyx_t_3; - /* "sklearn/utils/graph_shortest_path.pyx":126 + /* "sklearn/utils/graph_shortest_path.pyx":128 * * #initialize all distances to infinity * graph[np.where(graph == 0)] = infinity # <<<<<<<<<<<<<< * * #graph[i,i] should be zero */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_infinity); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_infinity); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__where); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__where); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_graph), __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_graph), __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __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 = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_graph), __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_graph), __pyx_t_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __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; - /* "sklearn/utils/graph_shortest_path.pyx":129 + /* "sklearn/utils/graph_shortest_path.pyx":131 * * #graph[i,i] should be zero * graph.flat[::N + 1] = 0 # <<<<<<<<<<<<<< * * # for a non-directed graph, we need to symmetrize the distances */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_graph), __pyx_n_s__flat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_graph), __pyx_n_s__flat); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyInt_FromLong((__pyx_v_N + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong((__pyx_v_N + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PySlice_New(Py_None, Py_None, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySlice_New(Py_None, Py_None, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetItem(__pyx_t_2, __pyx_t_5, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_2, __pyx_t_5, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":132 + /* "sklearn/utils/graph_shortest_path.pyx":134 * * # for a non-directed graph, we need to symmetrize the distances * if not directed: # <<<<<<<<<<<<<< @@ -1792,7 +1904,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_6 = (!__pyx_v_directed); if (__pyx_t_6) { - /* "sklearn/utils/graph_shortest_path.pyx":133 + /* "sklearn/utils/graph_shortest_path.pyx":135 * # for a non-directed graph, we need to symmetrize the distances * if not directed: * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -1802,7 +1914,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_7 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":134 + /* "sklearn/utils/graph_shortest_path.pyx":136 * if not directed: * for i from 0 <= i < N: * for j from i + 1 <= j < N: # <<<<<<<<<<<<<< @@ -1812,7 +1924,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_8 = __pyx_v_N; for (__pyx_v_j = (__pyx_v_i + 1); __pyx_v_j < __pyx_t_8; __pyx_v_j++) { - /* "sklearn/utils/graph_shortest_path.pyx":135 + /* "sklearn/utils/graph_shortest_path.pyx":137 * for i from 0 <= i < N: * for j from i + 1 <= j < N: * if graph[j, i] <= graph[i, j]: # <<<<<<<<<<<<<< @@ -1823,10 +1935,10 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_10 = __pyx_v_i; __pyx_t_11 = __pyx_v_i; __pyx_t_12 = __pyx_v_j; - __pyx_t_6 = ((*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_9, __pyx_bstride_0_graph, __pyx_t_10, __pyx_bstride_1_graph)) <= (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_11, __pyx_bstride_0_graph, __pyx_t_12, __pyx_bstride_1_graph))); + __pyx_t_6 = ((*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_graph.diminfo[1].strides)) <= (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_graph.diminfo[1].strides))); if (__pyx_t_6) { - /* "sklearn/utils/graph_shortest_path.pyx":136 + /* "sklearn/utils/graph_shortest_path.pyx":138 * for j from i + 1 <= j < N: * if graph[j, i] <= graph[i, j]: * graph[i, j] = graph[j, i] # <<<<<<<<<<<<<< @@ -1837,12 +1949,12 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_14 = __pyx_v_i; __pyx_t_15 = __pyx_v_i; __pyx_t_16 = __pyx_v_j; - *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_15, __pyx_bstride_0_graph, __pyx_t_16, __pyx_bstride_1_graph) = (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_13, __pyx_bstride_0_graph, __pyx_t_14, __pyx_bstride_1_graph)); + *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_graph.diminfo[1].strides) = (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_graph.diminfo[1].strides)); goto __pyx_L8; } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":138 + /* "sklearn/utils/graph_shortest_path.pyx":140 * graph[i, j] = graph[j, i] * else: * graph[j, i] = graph[i, j] # <<<<<<<<<<<<<< @@ -1853,7 +1965,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_18 = __pyx_v_j; __pyx_t_19 = __pyx_v_j; __pyx_t_20 = __pyx_v_i; - *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_19, __pyx_bstride_0_graph, __pyx_t_20, __pyx_bstride_1_graph) = (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_17, __pyx_bstride_0_graph, __pyx_t_18, __pyx_bstride_1_graph)); + *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_graph.diminfo[1].strides) = (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_graph.diminfo[1].strides)); } __pyx_L8:; } @@ -1862,7 +1974,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha } __pyx_L3:; - /* "sklearn/utils/graph_shortest_path.pyx":141 + /* "sklearn/utils/graph_shortest_path.pyx":143 * * #now perform the Floyd-Warshall algorithm * for k from 0 <= k < N: # <<<<<<<<<<<<<< @@ -1872,7 +1984,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_7 = __pyx_v_N; for (__pyx_v_k = 0; __pyx_v_k < __pyx_t_7; __pyx_v_k++) { - /* "sklearn/utils/graph_shortest_path.pyx":142 + /* "sklearn/utils/graph_shortest_path.pyx":144 * #now perform the Floyd-Warshall algorithm * for k from 0 <= k < N: * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -1882,7 +1994,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_8 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_8; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":143 + /* "sklearn/utils/graph_shortest_path.pyx":145 * for k from 0 <= k < N: * for i from 0 <= i < N: * if graph[i, k] == infinity: # <<<<<<<<<<<<<< @@ -1891,10 +2003,10 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha */ __pyx_t_21 = __pyx_v_i; __pyx_t_22 = __pyx_v_k; - __pyx_t_6 = ((*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_21, __pyx_bstride_0_graph, __pyx_t_22, __pyx_bstride_1_graph)) == __pyx_v_infinity); + __pyx_t_6 = ((*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_graph.diminfo[1].strides)) == __pyx_v_infinity); if (__pyx_t_6) { - /* "sklearn/utils/graph_shortest_path.pyx":144 + /* "sklearn/utils/graph_shortest_path.pyx":146 * for i from 0 <= i < N: * if graph[i, k] == infinity: * continue # <<<<<<<<<<<<<< @@ -1906,7 +2018,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha } __pyx_L13:; - /* "sklearn/utils/graph_shortest_path.pyx":145 + /* "sklearn/utils/graph_shortest_path.pyx":147 * if graph[i, k] == infinity: * continue * for j from 0 <= j < N: # <<<<<<<<<<<<<< @@ -1916,7 +2028,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_23 = __pyx_v_N; for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_23; __pyx_v_j++) { - /* "sklearn/utils/graph_shortest_path.pyx":146 + /* "sklearn/utils/graph_shortest_path.pyx":148 * continue * for j from 0 <= j < N: * sum_ijk = graph[i, k] + graph[k, j] # <<<<<<<<<<<<<< @@ -1927,9 +2039,9 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __pyx_t_25 = __pyx_v_k; __pyx_t_26 = __pyx_v_k; __pyx_t_27 = __pyx_v_j; - __pyx_v_sum_ijk = ((*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_24, __pyx_bstride_0_graph, __pyx_t_25, __pyx_bstride_1_graph)) + (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_26, __pyx_bstride_0_graph, __pyx_t_27, __pyx_bstride_1_graph))); + __pyx_v_sum_ijk = ((*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_graph.diminfo[1].strides)) + (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_graph.diminfo[1].strides))); - /* "sklearn/utils/graph_shortest_path.pyx":147 + /* "sklearn/utils/graph_shortest_path.pyx":149 * for j from 0 <= j < N: * sum_ijk = graph[i, k] + graph[k, j] * if sum_ijk < graph[i, j]: # <<<<<<<<<<<<<< @@ -1938,10 +2050,10 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha */ __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_j; - __pyx_t_6 = (__pyx_v_sum_ijk < (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_28, __pyx_bstride_0_graph, __pyx_t_29, __pyx_bstride_1_graph))); + __pyx_t_6 = (__pyx_v_sum_ijk < (*__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_graph.diminfo[1].strides))); if (__pyx_t_6) { - /* "sklearn/utils/graph_shortest_path.pyx":148 + /* "sklearn/utils/graph_shortest_path.pyx":150 * sum_ijk = graph[i, k] + graph[k, j] * if sum_ijk < graph[i, j]: * graph[i, j] = sum_ijk # <<<<<<<<<<<<<< @@ -1950,7 +2062,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha */ __pyx_t_30 = __pyx_v_i; __pyx_t_31 = __pyx_v_j; - *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_30, __pyx_bstride_0_graph, __pyx_t_31, __pyx_bstride_1_graph) = __pyx_v_sum_ijk; + *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_graph.diminfo[1].strides) = __pyx_v_sum_ijk; goto __pyx_L16; } __pyx_L16:; @@ -1959,45 +2071,45 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha } } - /* "sklearn/utils/graph_shortest_path.pyx":150 + /* "sklearn/utils/graph_shortest_path.pyx":152 * graph[i, j] = sum_ijk * * graph[np.where(np.isinf(graph))] = 0 # <<<<<<<<<<<<<< * * return graph */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__where); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__where); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__isinf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__isinf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __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 = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_graph)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_graph)); __Pyx_GIVEREF(((PyObject *)__pyx_v_graph)); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __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_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_graph), __pyx_t_4, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_graph), __pyx_t_4, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":152 + /* "sklearn/utils/graph_shortest_path.pyx":154 * graph[np.where(np.isinf(graph))] = 0 * * return graph # <<<<<<<<<<<<<< @@ -2018,20 +2130,20 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_floyd_warsha __Pyx_XDECREF(__pyx_t_5); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_graph); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_graph.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.utils.graph_shortest_path.floyd_warshall", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_graph); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_graph.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/utils/graph_shortest_path.pyx":156 +/* "sklearn/utils/graph_shortest_path.pyx":158 * * @cython.boundscheck(False) * cdef np.ndarray dijkstra(dist_matrix, # <<<<<<<<<<<<<< @@ -2052,11 +2164,8 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO PyArrayObject *__pyx_v_neighbors2 = 0; PyArrayObject *__pyx_v_indptr2 = 0; PyObject *__pyx_v_dist_matrix_T = NULL; - Py_buffer __pyx_bstruct_graph; - Py_ssize_t __pyx_bstride_0_graph = 0; - Py_ssize_t __pyx_bstride_1_graph = 0; - Py_ssize_t __pyx_bshape_0_graph = 0; - Py_ssize_t __pyx_bshape_1_graph = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_graph; + __Pyx_Buffer __pyx_pybuffer_graph; PyArrayObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2069,22 +2178,24 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dijkstra"); + __Pyx_RefNannySetupContext("dijkstra", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_directed = __pyx_optional_args->directed; } } __Pyx_INCREF(__pyx_v_dist_matrix); - __pyx_bstruct_graph.buf = NULL; + __pyx_pybuffer_graph.pybuffer.buf = NULL; + __pyx_pybuffer_graph.refcount = 0; + __pyx_pybuffernd_graph.data = NULL; + __pyx_pybuffernd_graph.rcbuffer = &__pyx_pybuffer_graph; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_graph, (PyObject*)__pyx_v_graph, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_graph.rcbuffer->pybuffer, (PyObject*)__pyx_v_graph, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_graph = __pyx_bstruct_graph.strides[0]; __pyx_bstride_1_graph = __pyx_bstruct_graph.strides[1]; - __pyx_bshape_0_graph = __pyx_bstruct_graph.shape[0]; __pyx_bshape_1_graph = __pyx_bstruct_graph.shape[1]; + __pyx_pybuffernd_graph.diminfo[0].strides = __pyx_pybuffernd_graph.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_graph.diminfo[0].shape = __pyx_pybuffernd_graph.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_graph.diminfo[1].strides = __pyx_pybuffernd_graph.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_graph.diminfo[1].shape = __pyx_pybuffernd_graph.rcbuffer->pybuffer.shape[1]; - /* "sklearn/utils/graph_shortest_path.pyx":187 + /* "sklearn/utils/graph_shortest_path.pyx":189 * If no path exists, the path length is zero * """ * cdef unsigned int N = graph.shape[0] # <<<<<<<<<<<<<< @@ -2093,7 +2204,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO */ __pyx_v_N = (__pyx_v_graph->dimensions[0]); - /* "sklearn/utils/graph_shortest_path.pyx":193 + /* "sklearn/utils/graph_shortest_path.pyx":195 * * cdef FibonacciNode* nodes = malloc(N * * sizeof(FibonacciNode)) # <<<<<<<<<<<<<< @@ -2102,44 +2213,44 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO */ __pyx_v_nodes = ((struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *)malloc((__pyx_v_N * (sizeof(struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode))))); - /* "sklearn/utils/graph_shortest_path.pyx":198 + /* "sklearn/utils/graph_shortest_path.pyx":200 * cdef np.ndarray distances2, neighbors2, indptr2 * * if not isspmatrix_csr(dist_matrix): # <<<<<<<<<<<<<< * dist_matrix = csr_matrix(dist_matrix) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__isspmatrix_csr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__isspmatrix_csr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __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 = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_dist_matrix); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dist_matrix); __Pyx_GIVEREF(__pyx_v_dist_matrix); - __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 = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __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_2)); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = (!__pyx_t_4); if (__pyx_t_5) { - /* "sklearn/utils/graph_shortest_path.pyx":199 + /* "sklearn/utils/graph_shortest_path.pyx":201 * * if not isspmatrix_csr(dist_matrix): * dist_matrix = csr_matrix(dist_matrix) # <<<<<<<<<<<<<< * * distances = np.asarray(dist_matrix.data, dtype=DTYPE, order='C') */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_dist_matrix); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dist_matrix); __Pyx_GIVEREF(__pyx_v_dist_matrix); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -2150,112 +2261,112 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO } __pyx_L3:; - /* "sklearn/utils/graph_shortest_path.pyx":201 + /* "sklearn/utils/graph_shortest_path.pyx":203 * dist_matrix = csr_matrix(dist_matrix) * * distances = np.asarray(dist_matrix.data, dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * neighbors = np.asarray(dist_matrix.indices, dtype=ITYPE, order='C') * indptr = np.asarray(dist_matrix.indptr, dtype=ITYPE, order='C') */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __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 = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __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; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_distances = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":202 + /* "sklearn/utils/graph_shortest_path.pyx":204 * * distances = np.asarray(dist_matrix.data, dtype=DTYPE, order='C') * neighbors = np.asarray(dist_matrix.indices, dtype=ITYPE, order='C') # <<<<<<<<<<<<<< * indptr = np.asarray(dist_matrix.indptr, dtype=ITYPE, order='C') * */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 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 = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __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(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_neighbors = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":203 + /* "sklearn/utils/graph_shortest_path.pyx":205 * distances = np.asarray(dist_matrix.data, dtype=DTYPE, order='C') * neighbors = np.asarray(dist_matrix.indices, dtype=ITYPE, order='C') * indptr = np.asarray(dist_matrix.indptr, dtype=ITYPE, order='C') # <<<<<<<<<<<<<< * * for i from 0 <= i < N: */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__indptr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__indptr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __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 = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __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 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__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 = 203; __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 = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":205 + /* "sklearn/utils/graph_shortest_path.pyx":207 * indptr = np.asarray(dist_matrix.indptr, dtype=ITYPE, order='C') * * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -2265,7 +2376,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO __pyx_t_7 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":206 + /* "sklearn/utils/graph_shortest_path.pyx":208 * * for i from 0 <= i < N: * initialize_node(&nodes[i], i) # <<<<<<<<<<<<<< @@ -2275,7 +2386,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node((&(__pyx_v_nodes[__pyx_v_i])), __pyx_v_i, NULL); } - /* "sklearn/utils/graph_shortest_path.pyx":208 + /* "sklearn/utils/graph_shortest_path.pyx":210 * initialize_node(&nodes[i], i) * * heap.min_node = NULL # <<<<<<<<<<<<<< @@ -2284,7 +2395,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO */ __pyx_v_heap.min_node = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":210 + /* "sklearn/utils/graph_shortest_path.pyx":212 * heap.min_node = NULL * * if directed: # <<<<<<<<<<<<<< @@ -2293,7 +2404,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO */ if (__pyx_v_directed) { - /* "sklearn/utils/graph_shortest_path.pyx":211 + /* "sklearn/utils/graph_shortest_path.pyx":213 * * if directed: * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -2303,7 +2414,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO __pyx_t_7 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":213 + /* "sklearn/utils/graph_shortest_path.pyx":215 * for i from 0 <= i < N: * dijkstra_directed_one_row(i, neighbors, distances, indptr, * graph, &heap, nodes) # <<<<<<<<<<<<<< @@ -2316,154 +2427,154 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":217 + /* "sklearn/utils/graph_shortest_path.pyx":219 * #use the csr -> csc sparse matrix conversion to quickly get * # both directions of neigbors * dist_matrix_T = dist_matrix.T.tocsr() # <<<<<<<<<<<<<< * * distances2 = np.asarray(dist_matrix_T.data, */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_dist_matrix, __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__tocsr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__tocsr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_dist_matrix_T = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":219 + /* "sklearn/utils/graph_shortest_path.pyx":221 * dist_matrix_T = dist_matrix.T.tocsr() * * distances2 = np.asarray(dist_matrix_T.data, # <<<<<<<<<<<<<< * dtype=DTYPE, order='C') * neighbors2 = np.asarray(dist_matrix_T.indices, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_dist_matrix_T, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_dist_matrix_T, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __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 = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __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 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - /* "sklearn/utils/graph_shortest_path.pyx":220 + /* "sklearn/utils/graph_shortest_path.pyx":222 * * distances2 = np.asarray(dist_matrix_T.data, * dtype=DTYPE, order='C') # <<<<<<<<<<<<<< * neighbors2 = np.asarray(dist_matrix_T.indices, * dtype=ITYPE, order='C') */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __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; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_distances2 = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":221 + /* "sklearn/utils/graph_shortest_path.pyx":223 * distances2 = np.asarray(dist_matrix_T.data, * dtype=DTYPE, order='C') * neighbors2 = np.asarray(dist_matrix_T.indices, # <<<<<<<<<<<<<< * dtype=ITYPE, order='C') * indptr2 = np.asarray(dist_matrix_T.indptr, */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_GetAttr(__pyx_v_dist_matrix_T, __pyx_n_s__indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_dist_matrix_T, __pyx_n_s__indices); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 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 = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - /* "sklearn/utils/graph_shortest_path.pyx":222 + /* "sklearn/utils/graph_shortest_path.pyx":224 * dtype=DTYPE, order='C') * neighbors2 = np.asarray(dist_matrix_T.indices, * dtype=ITYPE, order='C') # <<<<<<<<<<<<<< * indptr2 = np.asarray(dist_matrix_T.indptr, * dtype=ITYPE, order='C') */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __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(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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 = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_neighbors2 = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":223 + /* "sklearn/utils/graph_shortest_path.pyx":225 * neighbors2 = np.asarray(dist_matrix_T.indices, * dtype=ITYPE, order='C') * indptr2 = np.asarray(dist_matrix_T.indptr, # <<<<<<<<<<<<<< * dtype=ITYPE, order='C') * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asarray); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_v_dist_matrix_T, __pyx_n_s__indptr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_dist_matrix_T, __pyx_n_s__indptr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __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 = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __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 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - /* "sklearn/utils/graph_shortest_path.pyx":224 + /* "sklearn/utils/graph_shortest_path.pyx":226 * dtype=ITYPE, order='C') * indptr2 = np.asarray(dist_matrix_T.indptr, * dtype=ITYPE, order='C') # <<<<<<<<<<<<<< * * for i from 0 <= i < N: */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ITYPE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__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 = 223; __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 = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_indptr2 = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":226 + /* "sklearn/utils/graph_shortest_path.pyx":228 * dtype=ITYPE, order='C') * * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -2473,7 +2584,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO __pyx_t_7 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_7; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":229 + /* "sklearn/utils/graph_shortest_path.pyx":231 * dijkstra_one_row(i, neighbors, distances, indptr, * neighbors2, distances2, indptr2, * graph, &heap, nodes) # <<<<<<<<<<<<<< @@ -2485,7 +2596,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO } __pyx_L6:; - /* "sklearn/utils/graph_shortest_path.pyx":231 + /* "sklearn/utils/graph_shortest_path.pyx":233 * graph, &heap, nodes) * * free(nodes) # <<<<<<<<<<<<<< @@ -2494,7 +2605,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO */ free(__pyx_v_nodes); - /* "sklearn/utils/graph_shortest_path.pyx":233 + /* "sklearn/utils/graph_shortest_path.pyx":235 * free(nodes) * * return graph # <<<<<<<<<<<<<< @@ -2515,13 +2626,13 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO __Pyx_XDECREF(__pyx_t_6); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_graph); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_graph.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.utils.graph_shortest_path.dijkstra", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_graph); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_graph.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_distances); __Pyx_XDECREF((PyObject *)__pyx_v_neighbors); @@ -2536,7 +2647,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO return __pyx_r; } -/* "sklearn/utils/graph_shortest_path.pyx":253 +/* "sklearn/utils/graph_shortest_path.pyx":255 * * * cdef void initialize_node(FibonacciNode* node, # <<<<<<<<<<<<<< @@ -2546,7 +2657,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra(PyO static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_node, unsigned int __pyx_v_index, struct __pyx_opt_args_7sklearn_5utils_19graph_shortest_path_initialize_node *__pyx_optional_args) { - /* "sklearn/utils/graph_shortest_path.pyx":255 + /* "sklearn/utils/graph_shortest_path.pyx":257 * cdef void initialize_node(FibonacciNode* node, * unsigned int index, * DTYPE_t val=0): # <<<<<<<<<<<<<< @@ -2555,14 +2666,14 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct */ __pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t __pyx_v_val = ((__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t)0.0); __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("initialize_node"); + __Pyx_RefNannySetupContext("initialize_node", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_val = __pyx_optional_args->val; } } - /* "sklearn/utils/graph_shortest_path.pyx":258 + /* "sklearn/utils/graph_shortest_path.pyx":260 * # Assumptions: - node is a valid pointer * # - node is not currently part of a heap * node.index = index # <<<<<<<<<<<<<< @@ -2571,7 +2682,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct */ __pyx_v_node->index = __pyx_v_index; - /* "sklearn/utils/graph_shortest_path.pyx":259 + /* "sklearn/utils/graph_shortest_path.pyx":261 * # - node is not currently part of a heap * node.index = index * node.val = val # <<<<<<<<<<<<<< @@ -2580,7 +2691,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct */ __pyx_v_node->val = __pyx_v_val; - /* "sklearn/utils/graph_shortest_path.pyx":260 + /* "sklearn/utils/graph_shortest_path.pyx":262 * node.index = index * node.val = val * node.rank = 0 # <<<<<<<<<<<<<< @@ -2589,7 +2700,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct */ __pyx_v_node->rank = 0; - /* "sklearn/utils/graph_shortest_path.pyx":261 + /* "sklearn/utils/graph_shortest_path.pyx":263 * node.val = val * node.rank = 0 * node.state = 0 # 0 -> NOT_IN_HEAP # <<<<<<<<<<<<<< @@ -2598,7 +2709,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct */ __pyx_v_node->state = 0; - /* "sklearn/utils/graph_shortest_path.pyx":263 + /* "sklearn/utils/graph_shortest_path.pyx":265 * node.state = 0 # 0 -> NOT_IN_HEAP * * node.parent = NULL # <<<<<<<<<<<<<< @@ -2607,7 +2718,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct */ __pyx_v_node->parent = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":264 + /* "sklearn/utils/graph_shortest_path.pyx":266 * * node.parent = NULL * node.left_sibling = NULL # <<<<<<<<<<<<<< @@ -2616,7 +2727,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct */ __pyx_v_node->left_sibling = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":265 + /* "sklearn/utils/graph_shortest_path.pyx":267 * node.parent = NULL * node.left_sibling = NULL * node.right_sibling = NULL # <<<<<<<<<<<<<< @@ -2625,7 +2736,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct */ __pyx_v_node->right_sibling = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":266 + /* "sklearn/utils/graph_shortest_path.pyx":268 * node.left_sibling = NULL * node.right_sibling = NULL * node.children = NULL # <<<<<<<<<<<<<< @@ -2637,7 +2748,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node(struct __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/graph_shortest_path.pyx":269 +/* "sklearn/utils/graph_shortest_path.pyx":271 * * * cdef FibonacciNode* rightmost_sibling(FibonacciNode* node): # <<<<<<<<<<<<<< @@ -2650,9 +2761,10 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("rightmost_sibling"); + struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_t_2; + __Pyx_RefNannySetupContext("rightmost_sibling", 0); - /* "sklearn/utils/graph_shortest_path.pyx":271 + /* "sklearn/utils/graph_shortest_path.pyx":273 * cdef FibonacciNode* rightmost_sibling(FibonacciNode* node): * # Assumptions: - node is a valid pointer * cdef FibonacciNode* temp = node # <<<<<<<<<<<<<< @@ -2661,7 +2773,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_v_temp = __pyx_v_node; - /* "sklearn/utils/graph_shortest_path.pyx":272 + /* "sklearn/utils/graph_shortest_path.pyx":274 * # Assumptions: - node is a valid pointer * cdef FibonacciNode* temp = node * while(temp.right_sibling): # <<<<<<<<<<<<<< @@ -2672,17 +2784,18 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_t_1 = (__pyx_v_temp->right_sibling != 0); if (!__pyx_t_1) break; - /* "sklearn/utils/graph_shortest_path.pyx":273 + /* "sklearn/utils/graph_shortest_path.pyx":275 * cdef FibonacciNode* temp = node * while(temp.right_sibling): * temp = temp.right_sibling # <<<<<<<<<<<<<< * return temp * */ - __pyx_v_temp = __pyx_v_temp->right_sibling; + __pyx_t_2 = __pyx_v_temp->right_sibling; + __pyx_v_temp = __pyx_t_2; } - /* "sklearn/utils/graph_shortest_path.pyx":274 + /* "sklearn/utils/graph_shortest_path.pyx":276 * while(temp.right_sibling): * temp = temp.right_sibling * return temp # <<<<<<<<<<<<<< @@ -2698,7 +2811,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx return __pyx_r; } -/* "sklearn/utils/graph_shortest_path.pyx":277 +/* "sklearn/utils/graph_shortest_path.pyx":279 * * * cdef FibonacciNode* leftmost_sibling(FibonacciNode* node): # <<<<<<<<<<<<<< @@ -2711,9 +2824,10 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("leftmost_sibling"); + struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_t_2; + __Pyx_RefNannySetupContext("leftmost_sibling", 0); - /* "sklearn/utils/graph_shortest_path.pyx":279 + /* "sklearn/utils/graph_shortest_path.pyx":281 * cdef FibonacciNode* leftmost_sibling(FibonacciNode* node): * # Assumptions: - node is a valid pointer * cdef FibonacciNode* temp = node # <<<<<<<<<<<<<< @@ -2722,7 +2836,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_v_temp = __pyx_v_node; - /* "sklearn/utils/graph_shortest_path.pyx":280 + /* "sklearn/utils/graph_shortest_path.pyx":282 * # Assumptions: - node is a valid pointer * cdef FibonacciNode* temp = node * while(temp.left_sibling): # <<<<<<<<<<<<<< @@ -2733,17 +2847,18 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_t_1 = (__pyx_v_temp->left_sibling != 0); if (!__pyx_t_1) break; - /* "sklearn/utils/graph_shortest_path.pyx":281 + /* "sklearn/utils/graph_shortest_path.pyx":283 * cdef FibonacciNode* temp = node * while(temp.left_sibling): * temp = temp.left_sibling # <<<<<<<<<<<<<< * return temp * */ - __pyx_v_temp = __pyx_v_temp->left_sibling; + __pyx_t_2 = __pyx_v_temp->left_sibling; + __pyx_v_temp = __pyx_t_2; } - /* "sklearn/utils/graph_shortest_path.pyx":282 + /* "sklearn/utils/graph_shortest_path.pyx":284 * while(temp.left_sibling): * temp = temp.left_sibling * return temp # <<<<<<<<<<<<<< @@ -2759,7 +2874,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx return __pyx_r; } -/* "sklearn/utils/graph_shortest_path.pyx":285 +/* "sklearn/utils/graph_shortest_path.pyx":287 * * * cdef void add_child(FibonacciNode* node, FibonacciNode* new_child): # <<<<<<<<<<<<<< @@ -2770,9 +2885,9 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_node, struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_new_child) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("add_child"); + __Pyx_RefNannySetupContext("add_child", 0); - /* "sklearn/utils/graph_shortest_path.pyx":289 + /* "sklearn/utils/graph_shortest_path.pyx":291 * # - new_child is a valid pointer * # - new_child is not the sibling or child of another node * new_child.parent = node # <<<<<<<<<<<<<< @@ -2781,7 +2896,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(struct __pyx */ __pyx_v_new_child->parent = __pyx_v_node; - /* "sklearn/utils/graph_shortest_path.pyx":291 + /* "sklearn/utils/graph_shortest_path.pyx":293 * new_child.parent = node * * if node.children: # <<<<<<<<<<<<<< @@ -2791,7 +2906,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(struct __pyx __pyx_t_1 = (__pyx_v_node->children != 0); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":292 + /* "sklearn/utils/graph_shortest_path.pyx":294 * * if node.children: * add_sibling(node.children, new_child) # <<<<<<<<<<<<<< @@ -2803,7 +2918,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(struct __pyx } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":294 + /* "sklearn/utils/graph_shortest_path.pyx":296 * add_sibling(node.children, new_child) * else: * node.children = new_child # <<<<<<<<<<<<<< @@ -2812,7 +2927,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(struct __pyx */ __pyx_v_node->children = __pyx_v_new_child; - /* "sklearn/utils/graph_shortest_path.pyx":295 + /* "sklearn/utils/graph_shortest_path.pyx":297 * else: * node.children = new_child * new_child.right_sibling = NULL # <<<<<<<<<<<<<< @@ -2821,7 +2936,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(struct __pyx */ __pyx_v_new_child->right_sibling = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":296 + /* "sklearn/utils/graph_shortest_path.pyx":298 * node.children = new_child * new_child.right_sibling = NULL * new_child.left_sibling = NULL # <<<<<<<<<<<<<< @@ -2830,7 +2945,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(struct __pyx */ __pyx_v_new_child->left_sibling = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":297 + /* "sklearn/utils/graph_shortest_path.pyx":299 * new_child.right_sibling = NULL * new_child.left_sibling = NULL * node.rank = 1 # <<<<<<<<<<<<<< @@ -2844,7 +2959,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(struct __pyx __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/graph_shortest_path.pyx":300 +/* "sklearn/utils/graph_shortest_path.pyx":302 * * * cdef void add_sibling(FibonacciNode* node, FibonacciNode* new_sibling): # <<<<<<<<<<<<<< @@ -2855,10 +2970,11 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(struct __pyx static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_sibling(struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_node, struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_new_sibling) { struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_temp; __Pyx_RefNannyDeclarations - int __pyx_t_1; - __Pyx_RefNannySetupContext("add_sibling"); + struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("add_sibling", 0); - /* "sklearn/utils/graph_shortest_path.pyx":304 + /* "sklearn/utils/graph_shortest_path.pyx":306 * # - new_sibling is a valid pointer * # - new_sibling is not the child or sibling of another node * cdef FibonacciNode* temp = rightmost_sibling(node) # <<<<<<<<<<<<<< @@ -2867,7 +2983,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_sibling(struct __p */ __pyx_v_temp = __pyx_f_7sklearn_5utils_19graph_shortest_path_rightmost_sibling(__pyx_v_node); - /* "sklearn/utils/graph_shortest_path.pyx":305 + /* "sklearn/utils/graph_shortest_path.pyx":307 * # - new_sibling is not the child or sibling of another node * cdef FibonacciNode* temp = rightmost_sibling(node) * temp.right_sibling = new_sibling # <<<<<<<<<<<<<< @@ -2876,7 +2992,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_sibling(struct __p */ __pyx_v_temp->right_sibling = __pyx_v_new_sibling; - /* "sklearn/utils/graph_shortest_path.pyx":306 + /* "sklearn/utils/graph_shortest_path.pyx":308 * cdef FibonacciNode* temp = rightmost_sibling(node) * temp.right_sibling = new_sibling * new_sibling.left_sibling = temp # <<<<<<<<<<<<<< @@ -2885,7 +3001,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_sibling(struct __p */ __pyx_v_new_sibling->left_sibling = __pyx_v_temp; - /* "sklearn/utils/graph_shortest_path.pyx":307 + /* "sklearn/utils/graph_shortest_path.pyx":309 * temp.right_sibling = new_sibling * new_sibling.left_sibling = temp * new_sibling.right_sibling = NULL # <<<<<<<<<<<<<< @@ -2894,26 +3010,27 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_sibling(struct __p */ __pyx_v_new_sibling->right_sibling = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":308 + /* "sklearn/utils/graph_shortest_path.pyx":310 * new_sibling.left_sibling = temp * new_sibling.right_sibling = NULL * new_sibling.parent = node.parent # <<<<<<<<<<<<<< * if new_sibling.parent: * new_sibling.parent.rank += 1 */ - __pyx_v_new_sibling->parent = __pyx_v_node->parent; + __pyx_t_1 = __pyx_v_node->parent; + __pyx_v_new_sibling->parent = __pyx_t_1; - /* "sklearn/utils/graph_shortest_path.pyx":309 + /* "sklearn/utils/graph_shortest_path.pyx":311 * new_sibling.right_sibling = NULL * new_sibling.parent = node.parent * if new_sibling.parent: # <<<<<<<<<<<<<< * new_sibling.parent.rank += 1 * */ - __pyx_t_1 = (__pyx_v_new_sibling->parent != 0); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_new_sibling->parent != 0); + if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":310 + /* "sklearn/utils/graph_shortest_path.pyx":312 * new_sibling.parent = node.parent * if new_sibling.parent: * new_sibling.parent.rank += 1 # <<<<<<<<<<<<<< @@ -2928,7 +3045,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_sibling(struct __p __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/graph_shortest_path.pyx":313 +/* "sklearn/utils/graph_shortest_path.pyx":315 * * * cdef void remove(FibonacciNode* node): # <<<<<<<<<<<<<< @@ -2939,9 +3056,10 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_add_sibling(struct __p static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_node) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("remove"); + struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_t_2; + __Pyx_RefNannySetupContext("remove", 0); - /* "sklearn/utils/graph_shortest_path.pyx":315 + /* "sklearn/utils/graph_shortest_path.pyx":317 * cdef void remove(FibonacciNode* node): * # Assumptions: - node is a valid pointer * if node.parent: # <<<<<<<<<<<<<< @@ -2951,7 +3069,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ __pyx_t_1 = (__pyx_v_node->parent != 0); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":316 + /* "sklearn/utils/graph_shortest_path.pyx":318 * # Assumptions: - node is a valid pointer * if node.parent: * node.parent.rank -= 1 # <<<<<<<<<<<<<< @@ -2960,7 +3078,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ */ __pyx_v_node->parent->rank = (__pyx_v_node->parent->rank - 1); - /* "sklearn/utils/graph_shortest_path.pyx":317 + /* "sklearn/utils/graph_shortest_path.pyx":319 * if node.parent: * node.parent.rank -= 1 * if node.left_sibling: # <<<<<<<<<<<<<< @@ -2970,18 +3088,19 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ __pyx_t_1 = (__pyx_v_node->left_sibling != 0); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":318 + /* "sklearn/utils/graph_shortest_path.pyx":320 * node.parent.rank -= 1 * if node.left_sibling: * node.parent.children = node.left_sibling # <<<<<<<<<<<<<< * elif node.right_sibling: * node.parent.children = node.right_sibling */ - __pyx_v_node->parent->children = __pyx_v_node->left_sibling; + __pyx_t_2 = __pyx_v_node->left_sibling; + __pyx_v_node->parent->children = __pyx_t_2; goto __pyx_L4; } - /* "sklearn/utils/graph_shortest_path.pyx":319 + /* "sklearn/utils/graph_shortest_path.pyx":321 * if node.left_sibling: * node.parent.children = node.left_sibling * elif node.right_sibling: # <<<<<<<<<<<<<< @@ -2991,19 +3110,20 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ __pyx_t_1 = (__pyx_v_node->right_sibling != 0); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":320 + /* "sklearn/utils/graph_shortest_path.pyx":322 * node.parent.children = node.left_sibling * elif node.right_sibling: * node.parent.children = node.right_sibling # <<<<<<<<<<<<<< * else: * node.parent.children = NULL */ - __pyx_v_node->parent->children = __pyx_v_node->right_sibling; + __pyx_t_2 = __pyx_v_node->right_sibling; + __pyx_v_node->parent->children = __pyx_t_2; goto __pyx_L4; } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":322 + /* "sklearn/utils/graph_shortest_path.pyx":324 * node.parent.children = node.right_sibling * else: * node.parent.children = NULL # <<<<<<<<<<<<<< @@ -3017,7 +3137,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ } __pyx_L3:; - /* "sklearn/utils/graph_shortest_path.pyx":324 + /* "sklearn/utils/graph_shortest_path.pyx":326 * node.parent.children = NULL * * if node.left_sibling: # <<<<<<<<<<<<<< @@ -3027,19 +3147,20 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ __pyx_t_1 = (__pyx_v_node->left_sibling != 0); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":325 + /* "sklearn/utils/graph_shortest_path.pyx":327 * * if node.left_sibling: * node.left_sibling.right_sibling = node.right_sibling # <<<<<<<<<<<<<< * if node.right_sibling: * node.right_sibling.left_sibling = node.left_sibling */ - __pyx_v_node->left_sibling->right_sibling = __pyx_v_node->right_sibling; + __pyx_t_2 = __pyx_v_node->right_sibling; + __pyx_v_node->left_sibling->right_sibling = __pyx_t_2; goto __pyx_L5; } __pyx_L5:; - /* "sklearn/utils/graph_shortest_path.pyx":326 + /* "sklearn/utils/graph_shortest_path.pyx":328 * if node.left_sibling: * node.left_sibling.right_sibling = node.right_sibling * if node.right_sibling: # <<<<<<<<<<<<<< @@ -3049,19 +3170,20 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ __pyx_t_1 = (__pyx_v_node->right_sibling != 0); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":327 + /* "sklearn/utils/graph_shortest_path.pyx":329 * node.left_sibling.right_sibling = node.right_sibling * if node.right_sibling: * node.right_sibling.left_sibling = node.left_sibling # <<<<<<<<<<<<<< * * node.left_sibling = NULL */ - __pyx_v_node->right_sibling->left_sibling = __pyx_v_node->left_sibling; + __pyx_t_2 = __pyx_v_node->left_sibling; + __pyx_v_node->right_sibling->left_sibling = __pyx_t_2; goto __pyx_L6; } __pyx_L6:; - /* "sklearn/utils/graph_shortest_path.pyx":329 + /* "sklearn/utils/graph_shortest_path.pyx":331 * node.right_sibling.left_sibling = node.left_sibling * * node.left_sibling = NULL # <<<<<<<<<<<<<< @@ -3070,7 +3192,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ */ __pyx_v_node->left_sibling = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":330 + /* "sklearn/utils/graph_shortest_path.pyx":332 * * node.left_sibling = NULL * node.right_sibling = NULL # <<<<<<<<<<<<<< @@ -3079,7 +3201,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ */ __pyx_v_node->right_sibling = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":331 + /* "sklearn/utils/graph_shortest_path.pyx":333 * node.left_sibling = NULL * node.right_sibling = NULL * node.parent = NULL # <<<<<<<<<<<<<< @@ -3091,7 +3213,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/graph_shortest_path.pyx":347 +/* "sklearn/utils/graph_shortest_path.pyx":349 * * * cdef void insert_node(FibonacciHeap* heap, # <<<<<<<<<<<<<< @@ -3102,9 +3224,9 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(struct __pyx_t_ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_insert_node(struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciHeap *__pyx_v_heap, struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_node) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("insert_node"); + __Pyx_RefNannySetupContext("insert_node", 0); - /* "sklearn/utils/graph_shortest_path.pyx":352 + /* "sklearn/utils/graph_shortest_path.pyx":354 * # - node is a valid pointer * # - node is not the child or sibling of another node * if heap.min_node: # <<<<<<<<<<<<<< @@ -3114,7 +3236,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_insert_node(struct __p __pyx_t_1 = (__pyx_v_heap->min_node != 0); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":353 + /* "sklearn/utils/graph_shortest_path.pyx":355 * # - node is not the child or sibling of another node * if heap.min_node: * add_sibling(heap.min_node, node) # <<<<<<<<<<<<<< @@ -3123,7 +3245,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_insert_node(struct __p */ __pyx_f_7sklearn_5utils_19graph_shortest_path_add_sibling(__pyx_v_heap->min_node, __pyx_v_node); - /* "sklearn/utils/graph_shortest_path.pyx":354 + /* "sklearn/utils/graph_shortest_path.pyx":356 * if heap.min_node: * add_sibling(heap.min_node, node) * if node.val < heap.min_node.val: # <<<<<<<<<<<<<< @@ -3133,7 +3255,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_insert_node(struct __p __pyx_t_1 = (__pyx_v_node->val < __pyx_v_heap->min_node->val); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":355 + /* "sklearn/utils/graph_shortest_path.pyx":357 * add_sibling(heap.min_node, node) * if node.val < heap.min_node.val: * heap.min_node = node # <<<<<<<<<<<<<< @@ -3148,7 +3270,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_insert_node(struct __p } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":357 + /* "sklearn/utils/graph_shortest_path.pyx":359 * heap.min_node = node * else: * heap.min_node = node # <<<<<<<<<<<<<< @@ -3162,7 +3284,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_insert_node(struct __p __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/graph_shortest_path.pyx":360 +/* "sklearn/utils/graph_shortest_path.pyx":362 * * * cdef void decrease_val(FibonacciHeap* heap, # <<<<<<<<<<<<<< @@ -3174,9 +3296,9 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_decrease_val(struct __ __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("decrease_val"); + __Pyx_RefNannySetupContext("decrease_val", 0); - /* "sklearn/utils/graph_shortest_path.pyx":367 + /* "sklearn/utils/graph_shortest_path.pyx":369 * # - node is a valid pointer * # - node is not the child or sibling of another node * node.val = newval # <<<<<<<<<<<<<< @@ -3185,7 +3307,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_decrease_val(struct __ */ __pyx_v_node->val = __pyx_v_newval; - /* "sklearn/utils/graph_shortest_path.pyx":368 + /* "sklearn/utils/graph_shortest_path.pyx":370 * # - node is not the child or sibling of another node * node.val = newval * if node.parent and (node.parent.val >= newval): # <<<<<<<<<<<<<< @@ -3200,7 +3322,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_decrease_val(struct __ } if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":369 + /* "sklearn/utils/graph_shortest_path.pyx":371 * node.val = newval * if node.parent and (node.parent.val >= newval): * remove(node) # <<<<<<<<<<<<<< @@ -3209,7 +3331,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_decrease_val(struct __ */ __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(__pyx_v_node); - /* "sklearn/utils/graph_shortest_path.pyx":370 + /* "sklearn/utils/graph_shortest_path.pyx":372 * if node.parent and (node.parent.val >= newval): * remove(node) * insert_node(heap, node) # <<<<<<<<<<<<<< @@ -3220,7 +3342,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_decrease_val(struct __ goto __pyx_L3; } - /* "sklearn/utils/graph_shortest_path.pyx":371 + /* "sklearn/utils/graph_shortest_path.pyx":373 * remove(node) * insert_node(heap, node) * elif heap.min_node.val > node.val: # <<<<<<<<<<<<<< @@ -3230,7 +3352,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_decrease_val(struct __ __pyx_t_2 = (__pyx_v_heap->min_node->val > __pyx_v_node->val); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":372 + /* "sklearn/utils/graph_shortest_path.pyx":374 * insert_node(heap, node) * elif heap.min_node.val > node.val: * heap.min_node = node # <<<<<<<<<<<<<< @@ -3245,7 +3367,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_decrease_val(struct __ __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/graph_shortest_path.pyx":375 +/* "sklearn/utils/graph_shortest_path.pyx":377 * * * cdef void link(FibonacciHeap* heap, FibonacciNode* node): # <<<<<<<<<<<<<< @@ -3259,9 +3381,9 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("link"); + __Pyx_RefNannySetupContext("link", 0); - /* "sklearn/utils/graph_shortest_path.pyx":382 + /* "sklearn/utils/graph_shortest_path.pyx":384 * cdef FibonacciNode *linknode, *parent, *child * * if heap.roots_by_rank[node.rank] == NULL: # <<<<<<<<<<<<<< @@ -3271,7 +3393,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s __pyx_t_1 = ((__pyx_v_heap->roots_by_rank[__pyx_v_node->rank]) == NULL); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":383 + /* "sklearn/utils/graph_shortest_path.pyx":385 * * if heap.roots_by_rank[node.rank] == NULL: * heap.roots_by_rank[node.rank] = node # <<<<<<<<<<<<<< @@ -3283,7 +3405,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":385 + /* "sklearn/utils/graph_shortest_path.pyx":387 * heap.roots_by_rank[node.rank] = node * else: * linknode = heap.roots_by_rank[node.rank] # <<<<<<<<<<<<<< @@ -3292,7 +3414,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s */ __pyx_v_linknode = (__pyx_v_heap->roots_by_rank[__pyx_v_node->rank]); - /* "sklearn/utils/graph_shortest_path.pyx":386 + /* "sklearn/utils/graph_shortest_path.pyx":388 * else: * linknode = heap.roots_by_rank[node.rank] * heap.roots_by_rank[node.rank] = NULL # <<<<<<<<<<<<<< @@ -3301,7 +3423,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s */ (__pyx_v_heap->roots_by_rank[__pyx_v_node->rank]) = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":388 + /* "sklearn/utils/graph_shortest_path.pyx":390 * heap.roots_by_rank[node.rank] = NULL * * if node.val < linknode.val or node == heap.min_node: # <<<<<<<<<<<<<< @@ -3317,7 +3439,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s } if (__pyx_t_3) { - /* "sklearn/utils/graph_shortest_path.pyx":389 + /* "sklearn/utils/graph_shortest_path.pyx":391 * * if node.val < linknode.val or node == heap.min_node: * remove(linknode) # <<<<<<<<<<<<<< @@ -3326,7 +3448,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s */ __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(__pyx_v_linknode); - /* "sklearn/utils/graph_shortest_path.pyx":390 + /* "sklearn/utils/graph_shortest_path.pyx":392 * if node.val < linknode.val or node == heap.min_node: * remove(linknode) * add_child(node, linknode) # <<<<<<<<<<<<<< @@ -3335,7 +3457,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s */ __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(__pyx_v_node, __pyx_v_linknode); - /* "sklearn/utils/graph_shortest_path.pyx":391 + /* "sklearn/utils/graph_shortest_path.pyx":393 * remove(linknode) * add_child(node, linknode) * link(heap, node) # <<<<<<<<<<<<<< @@ -3347,7 +3469,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":393 + /* "sklearn/utils/graph_shortest_path.pyx":395 * link(heap, node) * else: * remove(node) # <<<<<<<<<<<<<< @@ -3356,7 +3478,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s */ __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(__pyx_v_node); - /* "sklearn/utils/graph_shortest_path.pyx":394 + /* "sklearn/utils/graph_shortest_path.pyx":396 * else: * remove(node) * add_child(linknode, node) # <<<<<<<<<<<<<< @@ -3365,7 +3487,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s */ __pyx_f_7sklearn_5utils_19graph_shortest_path_add_child(__pyx_v_linknode, __pyx_v_node); - /* "sklearn/utils/graph_shortest_path.pyx":395 + /* "sklearn/utils/graph_shortest_path.pyx":397 * remove(node) * add_child(linknode, node) * link(heap, linknode) # <<<<<<<<<<<<<< @@ -3381,7 +3503,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_link(struct __pyx_t_7s __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/graph_shortest_path.pyx":398 +/* "sklearn/utils/graph_shortest_path.pyx":400 * * * cdef FibonacciNode* remove_min(FibonacciHeap* heap): # <<<<<<<<<<<<<< @@ -3397,9 +3519,10 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("remove_min"); + struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_t_2; + __Pyx_RefNannySetupContext("remove_min", 0); - /* "sklearn/utils/graph_shortest_path.pyx":405 + /* "sklearn/utils/graph_shortest_path.pyx":407 * * # make all min_node children into root nodes * if heap.min_node.children: # <<<<<<<<<<<<<< @@ -3409,7 +3532,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_t_1 = (__pyx_v_heap->min_node->children != 0); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":406 + /* "sklearn/utils/graph_shortest_path.pyx":408 * # make all min_node children into root nodes * if heap.min_node.children: * temp = leftmost_sibling(heap.min_node.children) # <<<<<<<<<<<<<< @@ -3418,7 +3541,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_v_temp = __pyx_f_7sklearn_5utils_19graph_shortest_path_leftmost_sibling(__pyx_v_heap->min_node->children); - /* "sklearn/utils/graph_shortest_path.pyx":407 + /* "sklearn/utils/graph_shortest_path.pyx":409 * if heap.min_node.children: * temp = leftmost_sibling(heap.min_node.children) * temp_right = NULL # <<<<<<<<<<<<<< @@ -3427,7 +3550,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_v_temp_right = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":409 + /* "sklearn/utils/graph_shortest_path.pyx":411 * temp_right = NULL * * while temp: # <<<<<<<<<<<<<< @@ -3438,16 +3561,17 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_t_1 = (__pyx_v_temp != 0); if (!__pyx_t_1) break; - /* "sklearn/utils/graph_shortest_path.pyx":410 + /* "sklearn/utils/graph_shortest_path.pyx":412 * * while temp: * temp_right = temp.right_sibling # <<<<<<<<<<<<<< * remove(temp) * add_sibling(heap.min_node, temp) */ - __pyx_v_temp_right = __pyx_v_temp->right_sibling; + __pyx_t_2 = __pyx_v_temp->right_sibling; + __pyx_v_temp_right = __pyx_t_2; - /* "sklearn/utils/graph_shortest_path.pyx":411 + /* "sklearn/utils/graph_shortest_path.pyx":413 * while temp: * temp_right = temp.right_sibling * remove(temp) # <<<<<<<<<<<<<< @@ -3456,7 +3580,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(__pyx_v_temp); - /* "sklearn/utils/graph_shortest_path.pyx":412 + /* "sklearn/utils/graph_shortest_path.pyx":414 * temp_right = temp.right_sibling * remove(temp) * add_sibling(heap.min_node, temp) # <<<<<<<<<<<<<< @@ -3465,7 +3589,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_f_7sklearn_5utils_19graph_shortest_path_add_sibling(__pyx_v_heap->min_node, __pyx_v_temp); - /* "sklearn/utils/graph_shortest_path.pyx":413 + /* "sklearn/utils/graph_shortest_path.pyx":415 * remove(temp) * add_sibling(heap.min_node, temp) * temp = temp_right # <<<<<<<<<<<<<< @@ -3475,7 +3599,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_v_temp = __pyx_v_temp_right; } - /* "sklearn/utils/graph_shortest_path.pyx":415 + /* "sklearn/utils/graph_shortest_path.pyx":417 * temp = temp_right * * heap.min_node.children = NULL # <<<<<<<<<<<<<< @@ -3487,7 +3611,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx } __pyx_L3:; - /* "sklearn/utils/graph_shortest_path.pyx":418 + /* "sklearn/utils/graph_shortest_path.pyx":420 * * # choose a root node other than min_node * temp = leftmost_sibling(heap.min_node) # <<<<<<<<<<<<<< @@ -3496,7 +3620,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_v_temp = __pyx_f_7sklearn_5utils_19graph_shortest_path_leftmost_sibling(__pyx_v_heap->min_node); - /* "sklearn/utils/graph_shortest_path.pyx":419 + /* "sklearn/utils/graph_shortest_path.pyx":421 * # choose a root node other than min_node * temp = leftmost_sibling(heap.min_node) * if temp == heap.min_node: # <<<<<<<<<<<<<< @@ -3506,7 +3630,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_t_1 = (__pyx_v_temp == __pyx_v_heap->min_node); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":420 + /* "sklearn/utils/graph_shortest_path.pyx":422 * temp = leftmost_sibling(heap.min_node) * if temp == heap.min_node: * if heap.min_node.right_sibling: # <<<<<<<<<<<<<< @@ -3516,28 +3640,30 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_t_1 = (__pyx_v_heap->min_node->right_sibling != 0); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":421 + /* "sklearn/utils/graph_shortest_path.pyx":423 * if temp == heap.min_node: * if heap.min_node.right_sibling: * temp = heap.min_node.right_sibling # <<<<<<<<<<<<<< * else: * out = heap.min_node */ - __pyx_v_temp = __pyx_v_heap->min_node->right_sibling; + __pyx_t_2 = __pyx_v_heap->min_node->right_sibling; + __pyx_v_temp = __pyx_t_2; goto __pyx_L7; } /*else*/ { - /* "sklearn/utils/graph_shortest_path.pyx":423 + /* "sklearn/utils/graph_shortest_path.pyx":425 * temp = heap.min_node.right_sibling * else: * out = heap.min_node # <<<<<<<<<<<<<< * heap.min_node = NULL * return out */ - __pyx_v_out = __pyx_v_heap->min_node; + __pyx_t_2 = __pyx_v_heap->min_node; + __pyx_v_out = __pyx_t_2; - /* "sklearn/utils/graph_shortest_path.pyx":424 + /* "sklearn/utils/graph_shortest_path.pyx":426 * else: * out = heap.min_node * heap.min_node = NULL # <<<<<<<<<<<<<< @@ -3546,7 +3672,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_v_heap->min_node = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":425 + /* "sklearn/utils/graph_shortest_path.pyx":427 * out = heap.min_node * heap.min_node = NULL * return out # <<<<<<<<<<<<<< @@ -3561,16 +3687,17 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx } __pyx_L6:; - /* "sklearn/utils/graph_shortest_path.pyx":428 + /* "sklearn/utils/graph_shortest_path.pyx":430 * * # remove min_node, and point heap to the new min * out = heap.min_node # <<<<<<<<<<<<<< * remove(heap.min_node) * heap.min_node = temp */ - __pyx_v_out = __pyx_v_heap->min_node; + __pyx_t_2 = __pyx_v_heap->min_node; + __pyx_v_out = __pyx_t_2; - /* "sklearn/utils/graph_shortest_path.pyx":429 + /* "sklearn/utils/graph_shortest_path.pyx":431 * # remove min_node, and point heap to the new min * out = heap.min_node * remove(heap.min_node) # <<<<<<<<<<<<<< @@ -3579,7 +3706,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_f_7sklearn_5utils_19graph_shortest_path_remove(__pyx_v_heap->min_node); - /* "sklearn/utils/graph_shortest_path.pyx":430 + /* "sklearn/utils/graph_shortest_path.pyx":432 * out = heap.min_node * remove(heap.min_node) * heap.min_node = temp # <<<<<<<<<<<<<< @@ -3588,7 +3715,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_v_heap->min_node = __pyx_v_temp; - /* "sklearn/utils/graph_shortest_path.pyx":433 + /* "sklearn/utils/graph_shortest_path.pyx":435 * * # re-link the heap * for i from 0 <= i < 100: # <<<<<<<<<<<<<< @@ -3597,7 +3724,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ for (__pyx_v_i = 0; __pyx_v_i < 100; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":434 + /* "sklearn/utils/graph_shortest_path.pyx":436 * # re-link the heap * for i from 0 <= i < 100: * heap.roots_by_rank[i] = NULL # <<<<<<<<<<<<<< @@ -3607,7 +3734,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx (__pyx_v_heap->roots_by_rank[__pyx_v_i]) = NULL; } - /* "sklearn/utils/graph_shortest_path.pyx":436 + /* "sklearn/utils/graph_shortest_path.pyx":438 * heap.roots_by_rank[i] = NULL * * while temp: # <<<<<<<<<<<<<< @@ -3618,7 +3745,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_t_1 = (__pyx_v_temp != 0); if (!__pyx_t_1) break; - /* "sklearn/utils/graph_shortest_path.pyx":437 + /* "sklearn/utils/graph_shortest_path.pyx":439 * * while temp: * if temp.val < heap.min_node.val: # <<<<<<<<<<<<<< @@ -3628,7 +3755,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_t_1 = (__pyx_v_temp->val < __pyx_v_heap->min_node->val); if (__pyx_t_1) { - /* "sklearn/utils/graph_shortest_path.pyx":438 + /* "sklearn/utils/graph_shortest_path.pyx":440 * while temp: * if temp.val < heap.min_node.val: * heap.min_node = temp # <<<<<<<<<<<<<< @@ -3640,16 +3767,17 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx } __pyx_L12:; - /* "sklearn/utils/graph_shortest_path.pyx":439 + /* "sklearn/utils/graph_shortest_path.pyx":441 * if temp.val < heap.min_node.val: * heap.min_node = temp * temp_right = temp.right_sibling # <<<<<<<<<<<<<< * link(heap, temp) * temp = temp_right */ - __pyx_v_temp_right = __pyx_v_temp->right_sibling; + __pyx_t_2 = __pyx_v_temp->right_sibling; + __pyx_v_temp_right = __pyx_t_2; - /* "sklearn/utils/graph_shortest_path.pyx":440 + /* "sklearn/utils/graph_shortest_path.pyx":442 * heap.min_node = temp * temp_right = temp.right_sibling * link(heap, temp) # <<<<<<<<<<<<<< @@ -3658,7 +3786,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx */ __pyx_f_7sklearn_5utils_19graph_shortest_path_link(__pyx_v_heap, __pyx_v_temp); - /* "sklearn/utils/graph_shortest_path.pyx":441 + /* "sklearn/utils/graph_shortest_path.pyx":443 * temp_right = temp.right_sibling * link(heap, temp) * temp = temp_right # <<<<<<<<<<<<<< @@ -3668,7 +3796,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx __pyx_v_temp = __pyx_v_temp_right; } - /* "sklearn/utils/graph_shortest_path.pyx":443 + /* "sklearn/utils/graph_shortest_path.pyx":445 * temp = temp_right * * return out # <<<<<<<<<<<<<< @@ -3684,7 +3812,7 @@ static struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx return __pyx_r; } -/* "sklearn/utils/graph_shortest_path.pyx":466 +/* "sklearn/utils/graph_shortest_path.pyx":468 * * @cython.boundscheck(False) * cdef void dijkstra_directed_one_row( # <<<<<<<<<<<<<< @@ -3698,20 +3826,14 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_v; struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_current_neighbor; __pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t __pyx_v_dist; - Py_buffer __pyx_bstruct_neighbors; - Py_ssize_t __pyx_bstride_0_neighbors = 0; - Py_ssize_t __pyx_bshape_0_neighbors = 0; - Py_buffer __pyx_bstruct_distances; - Py_ssize_t __pyx_bstride_0_distances = 0; - Py_ssize_t __pyx_bshape_0_distances = 0; - Py_buffer __pyx_bstruct_graph; - Py_ssize_t __pyx_bstride_0_graph = 0; - Py_ssize_t __pyx_bstride_1_graph = 0; - Py_ssize_t __pyx_bshape_0_graph = 0; - Py_ssize_t __pyx_bshape_1_graph = 0; - Py_buffer __pyx_bstruct_indptr; - Py_ssize_t __pyx_bstride_0_indptr = 0; - Py_ssize_t __pyx_bshape_0_indptr = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; + __Pyx_Buffer __pyx_pybuffer_distances; + __Pyx_LocalBuf_ND __pyx_pybuffernd_graph; + __Pyx_Buffer __pyx_pybuffer_graph; + __Pyx_LocalBuf_ND __pyx_pybuffernd_indptr; + __Pyx_Buffer __pyx_pybuffer_indptr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbors; + __Pyx_Buffer __pyx_pybuffer_neighbors; __Pyx_RefNannyDeclarations unsigned int __pyx_t_1; int __pyx_t_2; @@ -3719,42 +3841,51 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ __pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t __pyx_t_4; unsigned int __pyx_t_5; unsigned int __pyx_t_6; - unsigned int __pyx_t_7; + __pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t __pyx_t_7; unsigned int __pyx_t_8; + unsigned int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dijkstra_directed_one_row"); - __pyx_bstruct_neighbors.buf = NULL; - __pyx_bstruct_distances.buf = NULL; - __pyx_bstruct_indptr.buf = NULL; - __pyx_bstruct_graph.buf = NULL; + __Pyx_RefNannySetupContext("dijkstra_directed_one_row", 0); + __pyx_pybuffer_neighbors.pybuffer.buf = NULL; + __pyx_pybuffer_neighbors.refcount = 0; + __pyx_pybuffernd_neighbors.data = NULL; + __pyx_pybuffernd_neighbors.rcbuffer = &__pyx_pybuffer_neighbors; + __pyx_pybuffer_distances.pybuffer.buf = NULL; + __pyx_pybuffer_distances.refcount = 0; + __pyx_pybuffernd_distances.data = NULL; + __pyx_pybuffernd_distances.rcbuffer = &__pyx_pybuffer_distances; + __pyx_pybuffer_indptr.pybuffer.buf = NULL; + __pyx_pybuffer_indptr.refcount = 0; + __pyx_pybuffernd_indptr.data = NULL; + __pyx_pybuffernd_indptr.rcbuffer = &__pyx_pybuffer_indptr; + __pyx_pybuffer_graph.pybuffer.buf = NULL; + __pyx_pybuffer_graph.refcount = 0; + __pyx_pybuffernd_graph.data = NULL; + __pyx_pybuffernd_graph.rcbuffer = &__pyx_pybuffer_graph; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_neighbors, (PyObject*)__pyx_v_neighbors, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbors.rcbuffer->pybuffer, (PyObject*)__pyx_v_neighbors, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_neighbors = __pyx_bstruct_neighbors.strides[0]; - __pyx_bshape_0_neighbors = __pyx_bstruct_neighbors.shape[0]; + __pyx_pybuffernd_neighbors.diminfo[0].strides = __pyx_pybuffernd_neighbors.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighbors.diminfo[0].shape = __pyx_pybuffernd_neighbors.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_distances, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_distances = __pyx_bstruct_distances.strides[0]; - __pyx_bshape_0_distances = __pyx_bstruct_distances.shape[0]; + __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indptr, (PyObject*)__pyx_v_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_indptr = __pyx_bstruct_indptr.strides[0]; - __pyx_bshape_0_indptr = __pyx_bstruct_indptr.shape[0]; + __pyx_pybuffernd_indptr.diminfo[0].strides = __pyx_pybuffernd_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indptr.diminfo[0].shape = __pyx_pybuffernd_indptr.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_graph, (PyObject*)__pyx_v_graph, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_graph.rcbuffer->pybuffer, (PyObject*)__pyx_v_graph, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_graph = __pyx_bstruct_graph.strides[0]; __pyx_bstride_1_graph = __pyx_bstruct_graph.strides[1]; - __pyx_bshape_0_graph = __pyx_bstruct_graph.shape[0]; __pyx_bshape_1_graph = __pyx_bstruct_graph.shape[1]; + __pyx_pybuffernd_graph.diminfo[0].strides = __pyx_pybuffernd_graph.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_graph.diminfo[0].shape = __pyx_pybuffernd_graph.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_graph.diminfo[1].strides = __pyx_pybuffernd_graph.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_graph.diminfo[1].shape = __pyx_pybuffernd_graph.rcbuffer->pybuffer.shape[1]; - /* "sklearn/utils/graph_shortest_path.pyx":494 + /* "sklearn/utils/graph_shortest_path.pyx":496 * nodes : the array of nodes to use * """ * cdef unsigned int N = graph.shape[0] # <<<<<<<<<<<<<< @@ -3763,7 +3894,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ */ __pyx_v_N = (__pyx_v_graph->dimensions[0]); - /* "sklearn/utils/graph_shortest_path.pyx":500 + /* "sklearn/utils/graph_shortest_path.pyx":502 * * # initialize nodes * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -3773,7 +3904,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ __pyx_t_1 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":501 + /* "sklearn/utils/graph_shortest_path.pyx":503 * # initialize nodes * for i from 0 <= i < N: * initialize_node(&nodes[i], i) # <<<<<<<<<<<<<< @@ -3783,7 +3914,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ __pyx_f_7sklearn_5utils_19graph_shortest_path_initialize_node((&(__pyx_v_nodes[__pyx_v_i])), __pyx_v_i, NULL); } - /* "sklearn/utils/graph_shortest_path.pyx":503 + /* "sklearn/utils/graph_shortest_path.pyx":505 * initialize_node(&nodes[i], i) * * heap.min_node = NULL # <<<<<<<<<<<<<< @@ -3792,7 +3923,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ */ __pyx_v_heap->min_node = NULL; - /* "sklearn/utils/graph_shortest_path.pyx":504 + /* "sklearn/utils/graph_shortest_path.pyx":506 * * heap.min_node = NULL * insert_node(heap, &nodes[i_node]) # <<<<<<<<<<<<<< @@ -3801,7 +3932,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ */ __pyx_f_7sklearn_5utils_19graph_shortest_path_insert_node(__pyx_v_heap, (&(__pyx_v_nodes[__pyx_v_i_node]))); - /* "sklearn/utils/graph_shortest_path.pyx":506 + /* "sklearn/utils/graph_shortest_path.pyx":508 * insert_node(heap, &nodes[i_node]) * * while heap.min_node: # <<<<<<<<<<<<<< @@ -3812,7 +3943,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ __pyx_t_2 = (__pyx_v_heap->min_node != 0); if (!__pyx_t_2) break; - /* "sklearn/utils/graph_shortest_path.pyx":507 + /* "sklearn/utils/graph_shortest_path.pyx":509 * * while heap.min_node: * v = remove_min(heap) # <<<<<<<<<<<<<< @@ -3821,7 +3952,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ */ __pyx_v_v = __pyx_f_7sklearn_5utils_19graph_shortest_path_remove_min(__pyx_v_heap); - /* "sklearn/utils/graph_shortest_path.pyx":508 + /* "sklearn/utils/graph_shortest_path.pyx":510 * while heap.min_node: * v = remove_min(heap) * v.state = 2 # 2 -> SCANNED # <<<<<<<<<<<<<< @@ -3830,7 +3961,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ */ __pyx_v_v->state = 2; - /* "sklearn/utils/graph_shortest_path.pyx":510 + /* "sklearn/utils/graph_shortest_path.pyx":512 * v.state = 2 # 2 -> SCANNED * * for i from indptr[v.index] <= i < indptr[v.index + 1]: # <<<<<<<<<<<<<< @@ -3839,11 +3970,11 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ */ __pyx_t_1 = __pyx_v_v->index; __pyx_t_3 = (__pyx_v_v->index + 1); - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_indptr; - __pyx_t_4 = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_bstruct_indptr.buf, __pyx_t_3, __pyx_bstride_0_indptr)); - for (__pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_bstruct_indptr.buf, __pyx_t_1, __pyx_bstride_0_indptr)); __pyx_v_i < __pyx_t_4; __pyx_v_i++) { + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_pybuffernd_indptr.diminfo[0].shape; + __pyx_t_4 = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_pybuffernd_indptr.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_indptr.diminfo[0].strides)); + for (__pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_pybuffernd_indptr.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_indptr.diminfo[0].strides)); __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":511 + /* "sklearn/utils/graph_shortest_path.pyx":513 * * for i from indptr[v.index] <= i < indptr[v.index + 1]: * current_neighbor = &nodes[neighbors[i]] # <<<<<<<<<<<<<< @@ -3851,9 +3982,9 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ * dist = distances[i] */ __pyx_t_5 = __pyx_v_i; - __pyx_v_current_neighbor = (&(__pyx_v_nodes[(*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_bstruct_neighbors.buf, __pyx_t_5, __pyx_bstride_0_neighbors))])); + __pyx_v_current_neighbor = (&(__pyx_v_nodes[(*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_pybuffernd_neighbors.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_neighbors.diminfo[0].strides))])); - /* "sklearn/utils/graph_shortest_path.pyx":512 + /* "sklearn/utils/graph_shortest_path.pyx":514 * for i from indptr[v.index] <= i < indptr[v.index + 1]: * current_neighbor = &nodes[neighbors[i]] * if current_neighbor.state != 2: # 2 -> SCANNED # <<<<<<<<<<<<<< @@ -3863,7 +3994,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ __pyx_t_2 = (__pyx_v_current_neighbor->state != 2); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":513 + /* "sklearn/utils/graph_shortest_path.pyx":515 * current_neighbor = &nodes[neighbors[i]] * if current_neighbor.state != 2: # 2 -> SCANNED * dist = distances[i] # <<<<<<<<<<<<<< @@ -3871,9 +4002,9 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ * current_neighbor.state = 1 # 1 -> IN_HEAP */ __pyx_t_6 = __pyx_v_i; - __pyx_v_dist = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_distances.buf, __pyx_t_6, __pyx_bstride_0_distances)); + __pyx_v_dist = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_distances.diminfo[0].strides)); - /* "sklearn/utils/graph_shortest_path.pyx":514 + /* "sklearn/utils/graph_shortest_path.pyx":516 * if current_neighbor.state != 2: # 2 -> SCANNED * dist = distances[i] * if current_neighbor.state == 0: # 0 -> NOT_IN_HEAP # <<<<<<<<<<<<<< @@ -3883,7 +4014,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ __pyx_t_2 = (__pyx_v_current_neighbor->state == 0); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":515 + /* "sklearn/utils/graph_shortest_path.pyx":517 * dist = distances[i] * if current_neighbor.state == 0: # 0 -> NOT_IN_HEAP * current_neighbor.state = 1 # 1 -> IN_HEAP # <<<<<<<<<<<<<< @@ -3892,7 +4023,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ */ __pyx_v_current_neighbor->state = 1; - /* "sklearn/utils/graph_shortest_path.pyx":516 + /* "sklearn/utils/graph_shortest_path.pyx":518 * if current_neighbor.state == 0: # 0 -> NOT_IN_HEAP * current_neighbor.state = 1 # 1 -> IN_HEAP * current_neighbor.val = v.val + dist # <<<<<<<<<<<<<< @@ -3901,7 +4032,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ */ __pyx_v_current_neighbor->val = (__pyx_v_v->val + __pyx_v_dist); - /* "sklearn/utils/graph_shortest_path.pyx":517 + /* "sklearn/utils/graph_shortest_path.pyx":519 * current_neighbor.state = 1 # 1 -> IN_HEAP * current_neighbor.val = v.val + dist * insert_node(heap, current_neighbor) # <<<<<<<<<<<<<< @@ -3912,7 +4043,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ goto __pyx_L10; } - /* "sklearn/utils/graph_shortest_path.pyx":518 + /* "sklearn/utils/graph_shortest_path.pyx":520 * current_neighbor.val = v.val + dist * insert_node(heap, current_neighbor) * elif current_neighbor.val > v.val + dist: # <<<<<<<<<<<<<< @@ -3922,7 +4053,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ __pyx_t_2 = (__pyx_v_current_neighbor->val > (__pyx_v_v->val + __pyx_v_dist)); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":520 + /* "sklearn/utils/graph_shortest_path.pyx":522 * elif current_neighbor.val > v.val + dist: * decrease_val(heap, current_neighbor, * v.val + dist) # <<<<<<<<<<<<<< @@ -3938,39 +4069,40 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_directed_one_ __pyx_L9:; } - /* "sklearn/utils/graph_shortest_path.pyx":523 + /* "sklearn/utils/graph_shortest_path.pyx":525 * * #v has now been scanned: add the distance to the results * graph[i_node, v.index] = v.val # <<<<<<<<<<<<<< * * */ - __pyx_t_7 = __pyx_v_i_node; - __pyx_t_8 = __pyx_v_v->index; - *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_7, __pyx_bstride_0_graph, __pyx_t_8, __pyx_bstride_1_graph) = __pyx_v_v->val; + __pyx_t_7 = __pyx_v_v->val; + __pyx_t_8 = __pyx_v_i_node; + __pyx_t_9 = __pyx_v_v->index; + *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_graph.diminfo[1].strides) = __pyx_t_7; } goto __pyx_L0; __pyx_L1_error:; { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_neighbors); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_distances); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_graph); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indptr); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_distances.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_graph.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_WriteUnraisable("sklearn.utils.graph_shortest_path.dijkstra_directed_one_row", __pyx_clineno, __pyx_lineno, __pyx_filename); goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_neighbors); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_distances); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_graph); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indptr); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_distances.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_graph.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors.rcbuffer->pybuffer); __pyx_L2:; __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/graph_shortest_path.pyx":527 +/* "sklearn/utils/graph_shortest_path.pyx":529 * * @cython.boundscheck(False) * cdef void dijkstra_one_row(unsigned int i_node, # <<<<<<<<<<<<<< @@ -3984,29 +4116,20 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_v; struct __pyx_t_7sklearn_5utils_19graph_shortest_path_FibonacciNode *__pyx_v_current_neighbor; __pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t __pyx_v_dist; - Py_buffer __pyx_bstruct_neighbors1; - Py_ssize_t __pyx_bstride_0_neighbors1 = 0; - Py_ssize_t __pyx_bshape_0_neighbors1 = 0; - Py_buffer __pyx_bstruct_distances2; - Py_ssize_t __pyx_bstride_0_distances2 = 0; - Py_ssize_t __pyx_bshape_0_distances2 = 0; - Py_buffer __pyx_bstruct_neighbors2; - Py_ssize_t __pyx_bstride_0_neighbors2 = 0; - Py_ssize_t __pyx_bshape_0_neighbors2 = 0; - Py_buffer __pyx_bstruct_graph; - Py_ssize_t __pyx_bstride_0_graph = 0; - Py_ssize_t __pyx_bstride_1_graph = 0; - Py_ssize_t __pyx_bshape_0_graph = 0; - Py_ssize_t __pyx_bshape_1_graph = 0; - Py_buffer __pyx_bstruct_indptr2; - Py_ssize_t __pyx_bstride_0_indptr2 = 0; - Py_ssize_t __pyx_bshape_0_indptr2 = 0; - Py_buffer __pyx_bstruct_distances1; - Py_ssize_t __pyx_bstride_0_distances1 = 0; - Py_ssize_t __pyx_bshape_0_distances1 = 0; - Py_buffer __pyx_bstruct_indptr1; - Py_ssize_t __pyx_bstride_0_indptr1 = 0; - Py_ssize_t __pyx_bshape_0_indptr1 = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_distances1; + __Pyx_Buffer __pyx_pybuffer_distances1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_distances2; + __Pyx_Buffer __pyx_pybuffer_distances2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_graph; + __Pyx_Buffer __pyx_pybuffer_graph; + __Pyx_LocalBuf_ND __pyx_pybuffernd_indptr1; + __Pyx_Buffer __pyx_pybuffer_indptr1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_indptr2; + __Pyx_Buffer __pyx_pybuffer_indptr2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbors1; + __Pyx_Buffer __pyx_pybuffer_neighbors1; + __Pyx_LocalBuf_ND __pyx_pybuffernd_neighbors2; + __Pyx_Buffer __pyx_pybuffer_neighbors2; __Pyx_RefNannyDeclarations unsigned int __pyx_t_1; int __pyx_t_2; @@ -4018,63 +4141,78 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig long __pyx_t_8; unsigned int __pyx_t_9; unsigned int __pyx_t_10; - unsigned int __pyx_t_11; + __pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t __pyx_t_11; unsigned int __pyx_t_12; + unsigned int __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("dijkstra_one_row"); - __pyx_bstruct_neighbors1.buf = NULL; - __pyx_bstruct_distances1.buf = NULL; - __pyx_bstruct_indptr1.buf = NULL; - __pyx_bstruct_neighbors2.buf = NULL; - __pyx_bstruct_distances2.buf = NULL; - __pyx_bstruct_indptr2.buf = NULL; - __pyx_bstruct_graph.buf = NULL; + __Pyx_RefNannySetupContext("dijkstra_one_row", 0); + __pyx_pybuffer_neighbors1.pybuffer.buf = NULL; + __pyx_pybuffer_neighbors1.refcount = 0; + __pyx_pybuffernd_neighbors1.data = NULL; + __pyx_pybuffernd_neighbors1.rcbuffer = &__pyx_pybuffer_neighbors1; + __pyx_pybuffer_distances1.pybuffer.buf = NULL; + __pyx_pybuffer_distances1.refcount = 0; + __pyx_pybuffernd_distances1.data = NULL; + __pyx_pybuffernd_distances1.rcbuffer = &__pyx_pybuffer_distances1; + __pyx_pybuffer_indptr1.pybuffer.buf = NULL; + __pyx_pybuffer_indptr1.refcount = 0; + __pyx_pybuffernd_indptr1.data = NULL; + __pyx_pybuffernd_indptr1.rcbuffer = &__pyx_pybuffer_indptr1; + __pyx_pybuffer_neighbors2.pybuffer.buf = NULL; + __pyx_pybuffer_neighbors2.refcount = 0; + __pyx_pybuffernd_neighbors2.data = NULL; + __pyx_pybuffernd_neighbors2.rcbuffer = &__pyx_pybuffer_neighbors2; + __pyx_pybuffer_distances2.pybuffer.buf = NULL; + __pyx_pybuffer_distances2.refcount = 0; + __pyx_pybuffernd_distances2.data = NULL; + __pyx_pybuffernd_distances2.rcbuffer = &__pyx_pybuffer_distances2; + __pyx_pybuffer_indptr2.pybuffer.buf = NULL; + __pyx_pybuffer_indptr2.refcount = 0; + __pyx_pybuffernd_indptr2.data = NULL; + __pyx_pybuffernd_indptr2.rcbuffer = &__pyx_pybuffer_indptr2; + __pyx_pybuffer_graph.pybuffer.buf = NULL; + __pyx_pybuffer_graph.refcount = 0; + __pyx_pybuffernd_graph.data = NULL; + __pyx_pybuffernd_graph.rcbuffer = &__pyx_pybuffer_graph; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_neighbors1, (PyObject*)__pyx_v_neighbors1, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbors1.rcbuffer->pybuffer, (PyObject*)__pyx_v_neighbors1, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_neighbors1 = __pyx_bstruct_neighbors1.strides[0]; - __pyx_bshape_0_neighbors1 = __pyx_bstruct_neighbors1.shape[0]; + __pyx_pybuffernd_neighbors1.diminfo[0].strides = __pyx_pybuffernd_neighbors1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighbors1.diminfo[0].shape = __pyx_pybuffernd_neighbors1.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_distances1, (PyObject*)__pyx_v_distances1, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances1.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances1, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_distances1 = __pyx_bstruct_distances1.strides[0]; - __pyx_bshape_0_distances1 = __pyx_bstruct_distances1.shape[0]; + __pyx_pybuffernd_distances1.diminfo[0].strides = __pyx_pybuffernd_distances1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances1.diminfo[0].shape = __pyx_pybuffernd_distances1.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indptr1, (PyObject*)__pyx_v_indptr1, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indptr1.rcbuffer->pybuffer, (PyObject*)__pyx_v_indptr1, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_indptr1 = __pyx_bstruct_indptr1.strides[0]; - __pyx_bshape_0_indptr1 = __pyx_bstruct_indptr1.shape[0]; + __pyx_pybuffernd_indptr1.diminfo[0].strides = __pyx_pybuffernd_indptr1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indptr1.diminfo[0].shape = __pyx_pybuffernd_indptr1.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_neighbors2, (PyObject*)__pyx_v_neighbors2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighbors2.rcbuffer->pybuffer, (PyObject*)__pyx_v_neighbors2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_neighbors2 = __pyx_bstruct_neighbors2.strides[0]; - __pyx_bshape_0_neighbors2 = __pyx_bstruct_neighbors2.shape[0]; + __pyx_pybuffernd_neighbors2.diminfo[0].strides = __pyx_pybuffernd_neighbors2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighbors2.diminfo[0].shape = __pyx_pybuffernd_neighbors2.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_distances2, (PyObject*)__pyx_v_distances2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances2.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_distances2 = __pyx_bstruct_distances2.strides[0]; - __pyx_bshape_0_distances2 = __pyx_bstruct_distances2.shape[0]; + __pyx_pybuffernd_distances2.diminfo[0].strides = __pyx_pybuffernd_distances2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances2.diminfo[0].shape = __pyx_pybuffernd_distances2.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_indptr2, (PyObject*)__pyx_v_indptr2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indptr2.rcbuffer->pybuffer, (PyObject*)__pyx_v_indptr2, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_indptr2 = __pyx_bstruct_indptr2.strides[0]; - __pyx_bshape_0_indptr2 = __pyx_bstruct_indptr2.shape[0]; + __pyx_pybuffernd_indptr2.diminfo[0].strides = __pyx_pybuffernd_indptr2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indptr2.diminfo[0].shape = __pyx_pybuffernd_indptr2.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_graph, (PyObject*)__pyx_v_graph, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_graph.rcbuffer->pybuffer, (PyObject*)__pyx_v_graph, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_graph = __pyx_bstruct_graph.strides[0]; __pyx_bstride_1_graph = __pyx_bstruct_graph.strides[1]; - __pyx_bshape_0_graph = __pyx_bstruct_graph.shape[0]; __pyx_bshape_1_graph = __pyx_bstruct_graph.shape[1]; + __pyx_pybuffernd_graph.diminfo[0].strides = __pyx_pybuffernd_graph.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_graph.diminfo[0].shape = __pyx_pybuffernd_graph.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_graph.diminfo[1].strides = __pyx_pybuffernd_graph.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_graph.diminfo[1].shape = __pyx_pybuffernd_graph.rcbuffer->pybuffer.shape[1]; - /* "sklearn/utils/graph_shortest_path.pyx":558 + /* "sklearn/utils/graph_shortest_path.pyx":560 * nodes : the array of nodes to use * """ * cdef unsigned int N = graph.shape[0] # <<<<<<<<<<<<<< @@ -4083,7 +4221,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_v_N = (__pyx_v_graph->dimensions[0]); - /* "sklearn/utils/graph_shortest_path.pyx":567 + /* "sklearn/utils/graph_shortest_path.pyx":569 * # rank should already be 0, index will already be set * # we just need to re-set state and val * for i from 0 <= i < N: # <<<<<<<<<<<<<< @@ -4093,7 +4231,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_t_1 = __pyx_v_N; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":568 + /* "sklearn/utils/graph_shortest_path.pyx":570 * # we just need to re-set state and val * for i from 0 <= i < N: * nodes[i].state = 0 # 0 -> NOT_IN_HEAP # <<<<<<<<<<<<<< @@ -4102,7 +4240,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ (__pyx_v_nodes[__pyx_v_i]).state = 0; - /* "sklearn/utils/graph_shortest_path.pyx":569 + /* "sklearn/utils/graph_shortest_path.pyx":571 * for i from 0 <= i < N: * nodes[i].state = 0 # 0 -> NOT_IN_HEAP * nodes[i].val = 0 # <<<<<<<<<<<<<< @@ -4112,7 +4250,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig (__pyx_v_nodes[__pyx_v_i]).val = 0.0; } - /* "sklearn/utils/graph_shortest_path.pyx":571 + /* "sklearn/utils/graph_shortest_path.pyx":573 * nodes[i].val = 0 * * insert_node(heap, &nodes[i_node]) # <<<<<<<<<<<<<< @@ -4121,7 +4259,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_f_7sklearn_5utils_19graph_shortest_path_insert_node(__pyx_v_heap, (&(__pyx_v_nodes[__pyx_v_i_node]))); - /* "sklearn/utils/graph_shortest_path.pyx":573 + /* "sklearn/utils/graph_shortest_path.pyx":575 * insert_node(heap, &nodes[i_node]) * * while heap.min_node: # <<<<<<<<<<<<<< @@ -4132,7 +4270,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_t_2 = (__pyx_v_heap->min_node != 0); if (!__pyx_t_2) break; - /* "sklearn/utils/graph_shortest_path.pyx":574 + /* "sklearn/utils/graph_shortest_path.pyx":576 * * while heap.min_node: * v = remove_min(heap) # <<<<<<<<<<<<<< @@ -4141,7 +4279,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_v_v = __pyx_f_7sklearn_5utils_19graph_shortest_path_remove_min(__pyx_v_heap); - /* "sklearn/utils/graph_shortest_path.pyx":575 + /* "sklearn/utils/graph_shortest_path.pyx":577 * while heap.min_node: * v = remove_min(heap) * v.state = 2 # 2 -> SCANNED # <<<<<<<<<<<<<< @@ -4150,7 +4288,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_v_v->state = 2; - /* "sklearn/utils/graph_shortest_path.pyx":577 + /* "sklearn/utils/graph_shortest_path.pyx":579 * v.state = 2 # 2 -> SCANNED * * for i from indptr1[v.index] <= i < indptr1[v.index + 1]: # <<<<<<<<<<<<<< @@ -4159,11 +4297,11 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_t_1 = __pyx_v_v->index; __pyx_t_3 = (__pyx_v_v->index + 1); - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_indptr1; - __pyx_t_4 = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_bstruct_indptr1.buf, __pyx_t_3, __pyx_bstride_0_indptr1)); - for (__pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_bstruct_indptr1.buf, __pyx_t_1, __pyx_bstride_0_indptr1)); __pyx_v_i < __pyx_t_4; __pyx_v_i++) { + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_pybuffernd_indptr1.diminfo[0].shape; + __pyx_t_4 = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_pybuffernd_indptr1.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_indptr1.diminfo[0].strides)); + for (__pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_pybuffernd_indptr1.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_indptr1.diminfo[0].strides)); __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":578 + /* "sklearn/utils/graph_shortest_path.pyx":580 * * for i from indptr1[v.index] <= i < indptr1[v.index + 1]: * current_neighbor = &nodes[neighbors1[i]] # <<<<<<<<<<<<<< @@ -4171,9 +4309,9 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig * dist = distances1[i] */ __pyx_t_5 = __pyx_v_i; - __pyx_v_current_neighbor = (&(__pyx_v_nodes[(*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_bstruct_neighbors1.buf, __pyx_t_5, __pyx_bstride_0_neighbors1))])); + __pyx_v_current_neighbor = (&(__pyx_v_nodes[(*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_pybuffernd_neighbors1.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_neighbors1.diminfo[0].strides))])); - /* "sklearn/utils/graph_shortest_path.pyx":579 + /* "sklearn/utils/graph_shortest_path.pyx":581 * for i from indptr1[v.index] <= i < indptr1[v.index + 1]: * current_neighbor = &nodes[neighbors1[i]] * if current_neighbor.state != 2: # 2 -> SCANNED # <<<<<<<<<<<<<< @@ -4183,7 +4321,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_t_2 = (__pyx_v_current_neighbor->state != 2); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":580 + /* "sklearn/utils/graph_shortest_path.pyx":582 * current_neighbor = &nodes[neighbors1[i]] * if current_neighbor.state != 2: # 2 -> SCANNED * dist = distances1[i] # <<<<<<<<<<<<<< @@ -4191,9 +4329,9 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig * current_neighbor.state = 1 # 1 -> IN_HEAP */ __pyx_t_6 = __pyx_v_i; - __pyx_v_dist = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_distances1.buf, __pyx_t_6, __pyx_bstride_0_distances1)); + __pyx_v_dist = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_distances1.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_distances1.diminfo[0].strides)); - /* "sklearn/utils/graph_shortest_path.pyx":581 + /* "sklearn/utils/graph_shortest_path.pyx":583 * if current_neighbor.state != 2: # 2 -> SCANNED * dist = distances1[i] * if current_neighbor.state == 0: # 0 -> NOT_IN_HEAP # <<<<<<<<<<<<<< @@ -4203,7 +4341,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_t_2 = (__pyx_v_current_neighbor->state == 0); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":582 + /* "sklearn/utils/graph_shortest_path.pyx":584 * dist = distances1[i] * if current_neighbor.state == 0: # 0 -> NOT_IN_HEAP * current_neighbor.state = 1 # 1 -> IN_HEAP # <<<<<<<<<<<<<< @@ -4212,7 +4350,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_v_current_neighbor->state = 1; - /* "sklearn/utils/graph_shortest_path.pyx":583 + /* "sklearn/utils/graph_shortest_path.pyx":585 * if current_neighbor.state == 0: # 0 -> NOT_IN_HEAP * current_neighbor.state = 1 # 1 -> IN_HEAP * current_neighbor.val = v.val + dist # <<<<<<<<<<<<<< @@ -4221,7 +4359,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_v_current_neighbor->val = (__pyx_v_v->val + __pyx_v_dist); - /* "sklearn/utils/graph_shortest_path.pyx":584 + /* "sklearn/utils/graph_shortest_path.pyx":586 * current_neighbor.state = 1 # 1 -> IN_HEAP * current_neighbor.val = v.val + dist * insert_node(heap, current_neighbor) # <<<<<<<<<<<<<< @@ -4232,7 +4370,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig goto __pyx_L10; } - /* "sklearn/utils/graph_shortest_path.pyx":585 + /* "sklearn/utils/graph_shortest_path.pyx":587 * current_neighbor.val = v.val + dist * insert_node(heap, current_neighbor) * elif current_neighbor.val > v.val + dist: # <<<<<<<<<<<<<< @@ -4242,7 +4380,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_t_2 = (__pyx_v_current_neighbor->val > (__pyx_v_v->val + __pyx_v_dist)); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":587 + /* "sklearn/utils/graph_shortest_path.pyx":589 * elif current_neighbor.val > v.val + dist: * decrease_val(heap, current_neighbor, * v.val + dist) # <<<<<<<<<<<<<< @@ -4258,7 +4396,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_L9:; } - /* "sklearn/utils/graph_shortest_path.pyx":589 + /* "sklearn/utils/graph_shortest_path.pyx":591 * v.val + dist) * * for i from indptr2[v.index] <= i < indptr2[v.index + 1]: # <<<<<<<<<<<<<< @@ -4267,11 +4405,11 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_t_7 = __pyx_v_v->index; __pyx_t_8 = (__pyx_v_v->index + 1); - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_indptr2; - __pyx_t_4 = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_bstruct_indptr2.buf, __pyx_t_8, __pyx_bstride_0_indptr2)); - for (__pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_bstruct_indptr2.buf, __pyx_t_7, __pyx_bstride_0_indptr2)); __pyx_v_i < __pyx_t_4; __pyx_v_i++) { + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_indptr2.diminfo[0].shape; + __pyx_t_4 = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_pybuffernd_indptr2.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_indptr2.diminfo[0].strides)); + for (__pyx_v_i = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_pybuffernd_indptr2.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_indptr2.diminfo[0].strides)); __pyx_v_i < __pyx_t_4; __pyx_v_i++) { - /* "sklearn/utils/graph_shortest_path.pyx":590 + /* "sklearn/utils/graph_shortest_path.pyx":592 * * for i from indptr2[v.index] <= i < indptr2[v.index + 1]: * current_neighbor = &nodes[neighbors2[i]] # <<<<<<<<<<<<<< @@ -4279,9 +4417,9 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig * dist = distances2[i] */ __pyx_t_9 = __pyx_v_i; - __pyx_v_current_neighbor = (&(__pyx_v_nodes[(*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_bstruct_neighbors2.buf, __pyx_t_9, __pyx_bstride_0_neighbors2))])); + __pyx_v_current_neighbor = (&(__pyx_v_nodes[(*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_ITYPE_t *, __pyx_pybuffernd_neighbors2.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_neighbors2.diminfo[0].strides))])); - /* "sklearn/utils/graph_shortest_path.pyx":591 + /* "sklearn/utils/graph_shortest_path.pyx":593 * for i from indptr2[v.index] <= i < indptr2[v.index + 1]: * current_neighbor = &nodes[neighbors2[i]] * if current_neighbor.state != 2: # 2 -> SCANNED # <<<<<<<<<<<<<< @@ -4291,7 +4429,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_t_2 = (__pyx_v_current_neighbor->state != 2); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":592 + /* "sklearn/utils/graph_shortest_path.pyx":594 * current_neighbor = &nodes[neighbors2[i]] * if current_neighbor.state != 2: # 2 -> SCANNED * dist = distances2[i] # <<<<<<<<<<<<<< @@ -4299,9 +4437,9 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig * current_neighbor.state = 1 # 1 -> IN_HEAP */ __pyx_t_10 = __pyx_v_i; - __pyx_v_dist = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_distances2.buf, __pyx_t_10, __pyx_bstride_0_distances2)); + __pyx_v_dist = (*__Pyx_BufPtrCContig1d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_distances2.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_distances2.diminfo[0].strides)); - /* "sklearn/utils/graph_shortest_path.pyx":593 + /* "sklearn/utils/graph_shortest_path.pyx":595 * if current_neighbor.state != 2: # 2 -> SCANNED * dist = distances2[i] * if current_neighbor.state == 0: # 0 -> NOT_IN_HEAP # <<<<<<<<<<<<<< @@ -4311,7 +4449,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_t_2 = (__pyx_v_current_neighbor->state == 0); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":594 + /* "sklearn/utils/graph_shortest_path.pyx":596 * dist = distances2[i] * if current_neighbor.state == 0: # 0 -> NOT_IN_HEAP * current_neighbor.state = 1 # 1 -> IN_HEAP # <<<<<<<<<<<<<< @@ -4320,7 +4458,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_v_current_neighbor->state = 1; - /* "sklearn/utils/graph_shortest_path.pyx":595 + /* "sklearn/utils/graph_shortest_path.pyx":597 * if current_neighbor.state == 0: # 0 -> NOT_IN_HEAP * current_neighbor.state = 1 # 1 -> IN_HEAP * current_neighbor.val = v.val + dist # <<<<<<<<<<<<<< @@ -4329,7 +4467,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig */ __pyx_v_current_neighbor->val = (__pyx_v_v->val + __pyx_v_dist); - /* "sklearn/utils/graph_shortest_path.pyx":596 + /* "sklearn/utils/graph_shortest_path.pyx":598 * current_neighbor.state = 1 # 1 -> IN_HEAP * current_neighbor.val = v.val + dist * insert_node(heap, current_neighbor) # <<<<<<<<<<<<<< @@ -4340,7 +4478,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig goto __pyx_L14; } - /* "sklearn/utils/graph_shortest_path.pyx":597 + /* "sklearn/utils/graph_shortest_path.pyx":599 * current_neighbor.val = v.val + dist * insert_node(heap, current_neighbor) * elif current_neighbor.val > v.val + dist: # <<<<<<<<<<<<<< @@ -4350,7 +4488,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_t_2 = (__pyx_v_current_neighbor->val > (__pyx_v_v->val + __pyx_v_dist)); if (__pyx_t_2) { - /* "sklearn/utils/graph_shortest_path.pyx":599 + /* "sklearn/utils/graph_shortest_path.pyx":601 * elif current_neighbor.val > v.val + dist: * decrease_val(heap, current_neighbor, * v.val + dist) # <<<<<<<<<<<<<< @@ -4366,43 +4504,55 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig __pyx_L13:; } - /* "sklearn/utils/graph_shortest_path.pyx":602 + /* "sklearn/utils/graph_shortest_path.pyx":604 * * #v has now been scanned: add the distance to the results * graph[i_node, v.index] = v.val # <<<<<<<<<<<<<< */ - __pyx_t_11 = __pyx_v_i_node; - __pyx_t_12 = __pyx_v_v->index; - *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_bstruct_graph.buf, __pyx_t_11, __pyx_bstride_0_graph, __pyx_t_12, __pyx_bstride_1_graph) = __pyx_v_v->val; + __pyx_t_11 = __pyx_v_v->val; + __pyx_t_12 = __pyx_v_i_node; + __pyx_t_13 = __pyx_v_v->index; + *__Pyx_BufPtrCContig2d(__pyx_t_7sklearn_5utils_19graph_shortest_path_DTYPE_t *, __pyx_pybuffernd_graph.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_graph.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_graph.diminfo[1].strides) = __pyx_t_11; } goto __pyx_L0; __pyx_L1_error:; { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_neighbors1); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_distances2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_neighbors2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_graph); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indptr2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_distances1); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indptr1); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_distances1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_distances2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_graph.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indptr1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indptr2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors2.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_WriteUnraisable("sklearn.utils.graph_shortest_path.dijkstra_one_row", __pyx_clineno, __pyx_lineno, __pyx_filename); goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_neighbors1); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_distances2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_neighbors2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_graph); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indptr2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_distances1); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_indptr1); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_distances1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_distances2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_graph.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indptr1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indptr2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors1.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighbors2.rcbuffer->pybuffer); __pyx_L2:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":190 +/* 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) { + int __pyx_r; + __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)); + __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): # <<<<<<<<<<<<<< @@ -4410,8 +4560,7 @@ static void __pyx_f_7sklearn_5utils_19graph_shortest_path_dijkstra_one_row(unsig * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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; int __pyx_v_ndim; @@ -4436,13 +4585,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -4453,11 +4602,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -4466,7 +4615,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -4475,16 +4624,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -4494,7 +4643,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -4502,11 +4651,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -4515,9 +4664,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -4527,37 +4676,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * 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") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -4567,46 +4716,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * 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") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -4615,7 +4764,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -4624,7 +4773,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.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) # <<<<<<<<<<<<<< @@ -4633,7 +4782,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.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 # <<<<<<<<<<<<<< @@ -4642,7 +4791,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -4653,49 +4802,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -4704,25 +4853,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -4731,17 +4880,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -4750,7 +4901,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -4766,7 +4917,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -4778,49 +4929,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -4831,10 +4983,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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" */ @@ -4851,24 +5003,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (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" @@ -4877,10 +5029,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -4890,10 +5042,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -4903,10 +5055,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -4916,10 +5068,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -4929,10 +5081,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -4942,10 +5094,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -4955,10 +5107,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -4968,10 +5120,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -4981,10 +5133,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -4994,10 +5146,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -5007,10 +5159,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -5020,10 +5172,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -5033,10 +5185,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -5046,10 +5198,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -5059,10 +5211,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -5072,10 +5224,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -5085,37 +5237,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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)); __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -5124,7 +5276,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -5133,57 +5285,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -5208,31 +5360,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* 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)); + __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 CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -5240,11 +5400,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -5254,7 +5414,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -5262,14 +5422,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -5284,9 +5444,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -5294,7 +5454,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5312,7 +5472,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -5327,9 +5487,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -5337,7 +5497,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5355,7 +5515,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -5370,9 +5530,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -5380,7 +5540,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5398,7 +5558,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -5413,9 +5573,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -5423,7 +5583,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5441,7 +5601,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -5456,9 +5616,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -5466,7 +5626,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5484,7 +5644,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.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: # <<<<<<<<<<<<<< @@ -5507,18 +5667,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -5527,7 +5688,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -5536,7 +5697,7 @@ 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":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -5544,31 +5705,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -5577,20 +5743,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} + #endif + } else if (1) { + __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -5598,99 +5793,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * 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 = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * 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_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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 = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -5698,16 +5892,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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -5716,7 +5909,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -5725,430 +5918,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.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_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.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 = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.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 = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -6156,25 +6332,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_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __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_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -6203,7 +6379,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -6215,9 +6391,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -6227,7 +6403,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -6239,7 +6415,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -6248,7 +6424,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -6259,7 +6435,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -6268,7 +6444,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -6280,7 +6456,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -6292,9 +6468,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -6304,7 +6480,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -6319,7 +6495,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -6360,8 +6536,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_n_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 1}, - {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, + {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, @@ -6371,6 +6548,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, {&__pyx_n_s__FW, __pyx_k__FW, sizeof(__pyx_k__FW), 0, 0, 1, 1}, {&__pyx_n_s__ITYPE, __pyx_k__ITYPE, sizeof(__pyx_k__ITYPE), 0, 0, 1, 1}, + {&__pyx_n_s__N, __pyx_k__N, sizeof(__pyx_k__N), 0, 0, 1, 1}, + {&__pyx_n_s__Nk, __pyx_k__Nk, sizeof(__pyx_k__Nk), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, @@ -6385,6 +6564,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__flat, __pyx_k__flat, sizeof(__pyx_k__flat), 0, 0, 1, 1}, {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, + {&__pyx_n_s__graph, __pyx_k__graph, sizeof(__pyx_k__graph), 0, 0, 1, 1}, {&__pyx_n_s__graph_shortest_path, __pyx_k__graph_shortest_path, sizeof(__pyx_k__graph_shortest_path), 0, 0, 1, 1}, {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1}, {&__pyx_n_s__indptr, __pyx_k__indptr, sizeof(__pyx_k__indptr), 0, 0, 1, 1}, @@ -6406,9 +6586,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -6416,91 +6596,121 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numpy.pxd":211 + /* "numpy.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_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __pyx_k_tuple_4 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_kp_u_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "numpy.pxd":215 + /* "numpy.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_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __pyx_k_tuple_6 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __pyx_k_tuple_8 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __pyx_k_tuple_11 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_kp_u_10)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __pyx_k_tuple_12 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "numpy.pxd":819 + /* "numpy.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_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_k_tuple_14 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_kp_u_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "sklearn/utils/graph_shortest_path.pyx":30 + * + * + * def graph_shortest_path(dist_matrix, directed=True, method='auto'): # <<<<<<<<<<<<<< + * """ + * Perform a shortest-path graph search on a positive directed or + */ + __pyx_k_tuple_17 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dist_matrix)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_n_s__dist_matrix)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dist_matrix)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__directed)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 1, ((PyObject *)__pyx_n_s__directed)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__directed)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__method)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 2, ((PyObject *)__pyx_n_s__method)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__method)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__N)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 3, ((PyObject *)__pyx_n_s__N)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__N)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Nk)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 4, ((PyObject *)__pyx_n_s__Nk)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Nk)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__graph)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 5, ((PyObject *)__pyx_n_s__graph)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__graph)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + __pyx_k_codeobj_18 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s__graph_shortest_path, 30, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -6538,12 +6748,18 @@ PyMODINIT_FUNC PyInit_graph_shortest_path(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_graph_shortest_path(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_graph_shortest_path(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -6554,16 +6770,23 @@ PyMODINIT_FUNC PyInit_graph_shortest_path(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("graph_shortest_path"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_15), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("graph_shortest_path"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_15), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__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.utils.graph_shortest_path")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.utils.graph_shortest_path", __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); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -6579,11 +6802,18 @@ PyMODINIT_FUNC PyInit_graph_shortest_path(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -6608,7 +6838,7 @@ PyMODINIT_FUNC PyInit_graph_shortest_path(void) * cimport cython */ __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__csr_matrix)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__csr_matrix)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__csr_matrix)); @@ -6621,15 +6851,27 @@ PyMODINIT_FUNC PyInit_graph_shortest_path(void) __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_16), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __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 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__csr_matrix); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__csr_matrix); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__csr_matrix, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isspmatrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isspmatrix); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__isspmatrix); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isspmatrix, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isspmatrix_csr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isspmatrix_csr); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__isspmatrix_csr); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__isspmatrix_csr, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6638,48 +6880,57 @@ PyMODINIT_FUNC PyInit_graph_shortest_path(void) /* "sklearn/utils/graph_shortest_path.pyx":21 * from libc.stdlib cimport malloc, free * + * np.import_array() # <<<<<<<<<<<<<< + * + * DTYPE = np.float64 + */ + import_array(); + + /* "sklearn/utils/graph_shortest_path.pyx":23 + * np.import_array() + * * DTYPE = np.float64 # <<<<<<<<<<<<<< * ctypedef np.float64_t DTYPE_t * */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float64); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/graph_shortest_path.pyx":24 + /* "sklearn/utils/graph_shortest_path.pyx":26 * ctypedef np.float64_t DTYPE_t * * ITYPE = np.int32 # <<<<<<<<<<<<<< * ctypedef np.int32_t ITYPE_t * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ITYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ITYPE, __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; - /* "sklearn/utils/graph_shortest_path.pyx":28 + /* "sklearn/utils/graph_shortest_path.pyx":30 * * * def graph_shortest_path(dist_matrix, directed=True, method='auto'): # <<<<<<<<<<<<<< * """ * Perform a shortest-path graph search on a positive directed or */ - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(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_k_1 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_19graph_shortest_path_graph_shortest_path, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_19graph_shortest_path_1graph_shortest_path, NULL, __pyx_n_s_20); 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 (PyObject_SetAttr(__pyx_m, __pyx_n_s__graph_shortest_path, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__graph_shortest_path, __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; /* "sklearn/utils/graph_shortest_path.pyx":1 @@ -6692,7 +6943,7 @@ PyMODINIT_FUNC PyInit_graph_shortest_path(void) if (PyObject_SetAttr(__pyx_m, __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; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -6719,7 +6970,6 @@ PyMODINIT_FUNC PyInit_graph_shortest_path(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -6760,7 +7010,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -6776,55 +7026,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -6852,7 +7124,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -6864,12 +7135,11 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); @@ -6883,9 +7153,9 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { } static CYTHON_INLINE void __Pyx_ErrRestore(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->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -6895,55 +7165,60 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -6966,7 +7241,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -6975,10 +7249,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -6988,7 +7261,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -6997,13 +7269,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } 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; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -7020,14 +7315,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -7037,8 +7327,8 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif @@ -7047,18 +7337,6 @@ static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; -} __Pyx_BufFmt_Context; - static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { @@ -7077,6 +7355,8 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; @@ -7084,7 +7364,6 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, type = type->fields->type; } } - static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; @@ -7100,15 +7379,21 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { *ts = t; return count; } - +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } - static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { - case 'b': return "'char'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; @@ -7124,14 +7409,14 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } - static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; @@ -7147,10 +7432,9 @@ static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { return 0; } } - static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'B': return 1; + case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); @@ -7167,7 +7451,6 @@ static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { } } } - typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; @@ -7178,10 +7461,9 @@ typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); @@ -7197,21 +7479,59 @@ static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { return 0; } } - +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } - static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; @@ -7236,16 +7556,37 @@ static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { parent->type->name, field->name); } } - static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; - size_t size, offset; + size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { @@ -7257,35 +7598,35 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } - offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } - ctx->fmt_offset += size; - + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; @@ -7317,7 +7658,48 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { ctx->is_complex = 0; return 0; } - +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { @@ -7332,7 +7714,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } - return ts; + return ts; case ' ': case 10: case 13: @@ -7364,12 +7746,17 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { @@ -7377,10 +7764,19 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (!ts_after_sub) return NULL; } ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ - ++ts; + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; @@ -7401,13 +7797,11 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': - case 'O': + case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { - /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { - /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; @@ -7423,20 +7817,18 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha while(*ts != ':') ++ts; ++ts; break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; default: { - int number = __Pyx_BufFmt_ParseNumber(&ts); - if (number == -1) { /* First char was not a digit */ - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%c')", *ts); - return NULL; - } - ctx->new_count = (size_t)number; + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } } } } - static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; @@ -7444,8 +7836,10 @@ static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; @@ -7465,7 +7859,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* ob } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; @@ -7476,65 +7870,146 @@ fail:; __Pyx_ZeroBuffer(buf); return -1; } - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +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 { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; } - static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { - #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} - #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); + PyObject *obj = view->obj; + CYTHON_UNUSED PyObject *releasebuffer_cobj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: Py_DECREF(obj); view->obj = NULL; - } } +#endif /* PY_MAJOR_VERSION < 3 */ -#endif -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; @@ -7560,12 +8035,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -7582,66 +8078,13 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { return module; } -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyBytes_GET_SIZE(s1) == 1) { - if (equals == Py_EQ) - return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); - else - return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); - } else { - int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_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; - } -} - -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ - return (equals == Py_EQ); - } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { - if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyUnicode_GET_SIZE(s1) == 1) { - if (equals == Py_EQ) - return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]); - else - return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]); - } else { - int result = PyUnicode_Compare(s1, s2); - if ((result == -1) && unlikely(PyErr_Occurred())) - return -1; - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { - return (equals == Py_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; - } +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { +#if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", + PyString_AsString(name)); +#else + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); +#endif } #if CYTHON_CCOMPLEX @@ -8284,8 +8727,8 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename) { +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); @@ -8322,6 +8765,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -8331,15 +8791,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -8355,7 +8810,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -8365,7 +8820,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -8379,51 +8834,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -8434,28 +8943,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -8463,11 +8989,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -8502,6 +9026,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/sklearn/utils/graph_shortest_path.pyx b/sklearn/utils/graph_shortest_path.pyx index 2fc18c5ede103..6dae31c0f6335 100644 --- a/sklearn/utils/graph_shortest_path.pyx +++ b/sklearn/utils/graph_shortest_path.pyx @@ -18,6 +18,8 @@ cimport cython from libc.stdlib cimport malloc, free +np.import_array() + DTYPE = np.float64 ctypedef np.float64_t DTYPE_t diff --git a/sklearn/utils/murmurhash.c b/sklearn/utils/murmurhash.c index 497369509f981..08e3ca6b8d432 100644 --- a/sklearn/utils/murmurhash.c +++ b/sklearn/utils/murmurhash.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17 on Thu Nov 22 22:25:51 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:54 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -53,12 +53,15 @@ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) - #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) @@ -1003,7 +1006,7 @@ static char __pyx_k_13[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_14[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_17[] = "Format string allocated too short."; static char __pyx_k_19[] = "Cython wrapper for MurmurHash3 non-cryptographic hash function\n\nMurmurHash is an extensively tested and very fast hash function that has\ngood distribution properties suitable for machine learning use cases\nsuch as feature hashing and random projections.\n\nThe original C++ code by Austin Appleby is released the public domain\nand can be found here:\n\n https://code.google.com/p/smhasher/\n\n"; -static char __pyx_k_22[] = "/home/varoquau/dev/scikit-learn/sklearn/utils/murmurhash.pyx"; +static char __pyx_k_22[] = "/scratch/apps/src/scikit-learn/sklearn/utils/murmurhash.pyx"; static char __pyx_k_23[] = "sklearn.utils.murmurhash"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; @@ -1089,7 +1092,7 @@ static PyObject *__pyx_k_tuple_18; static PyObject *__pyx_k_tuple_20; static PyObject *__pyx_k_codeobj_21; -/* "sklearn/utils/murmurhash.pyx":27 +/* "sklearn/utils/murmurhash.pyx":29 * * * cpdef np.uint32_t murmurhash3_int_u32(int key, unsigned int seed): # <<<<<<<<<<<<<< @@ -1104,7 +1107,7 @@ static __pyx_t_5numpy_uint32_t __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("murmurhash3_int_u32", 0); - /* "sklearn/utils/murmurhash.pyx":30 + /* "sklearn/utils/murmurhash.pyx":32 * """Compute the 32bit murmurhash3 of a int key at seed.""" * cdef np.uint32_t out * MurmurHash3_x86_32(&key, sizeof(int), seed, &out) # <<<<<<<<<<<<<< @@ -1113,7 +1116,7 @@ static __pyx_t_5numpy_uint32_t __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_ */ MurmurHash3_x86_32((&__pyx_v_key), (sizeof(int)), __pyx_v_seed, (&__pyx_v_out)); - /* "sklearn/utils/murmurhash.pyx":31 + /* "sklearn/utils/murmurhash.pyx":33 * cdef np.uint32_t out * MurmurHash3_x86_32(&key, sizeof(int), seed, &out) * return out # <<<<<<<<<<<<<< @@ -1158,11 +1161,11 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_1murmurhash3_int_u32(PyOb case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_int_u32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_int_u32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_int_u32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_int_u32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1170,12 +1173,12 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_1murmurhash3_int_u32(PyOb values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_key = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_key = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_int_u32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_int_u32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_int_u32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -1186,7 +1189,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_1murmurhash3_int_u32(PyOb return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":27 +/* "sklearn/utils/murmurhash.pyx":29 * * * cpdef np.uint32_t murmurhash3_int_u32(int key, unsigned int seed): # <<<<<<<<<<<<<< @@ -1203,7 +1206,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_int_u32(CYTHO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("murmurhash3_int_u32", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_u32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_u32(__pyx_v_key, __pyx_v_seed, 0)); 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_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1221,7 +1224,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_murmurhash3_int_u32(CYTHO return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":34 +/* "sklearn/utils/murmurhash.pyx":36 * * * cpdef np.int32_t murmurhash3_int_s32(int key, unsigned int seed): # <<<<<<<<<<<<<< @@ -1236,7 +1239,7 @@ static __pyx_t_5numpy_int32_t __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_i __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("murmurhash3_int_s32", 0); - /* "sklearn/utils/murmurhash.pyx":37 + /* "sklearn/utils/murmurhash.pyx":39 * """Compute the 32bit murmurhash3 of a int key at seed.""" * cdef np.int32_t out * MurmurHash3_x86_32(&key, sizeof(int), seed, &out) # <<<<<<<<<<<<<< @@ -1245,7 +1248,7 @@ static __pyx_t_5numpy_int32_t __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_i */ MurmurHash3_x86_32((&__pyx_v_key), (sizeof(int)), __pyx_v_seed, (&__pyx_v_out)); - /* "sklearn/utils/murmurhash.pyx":38 + /* "sklearn/utils/murmurhash.pyx":40 * cdef np.int32_t out * MurmurHash3_x86_32(&key, sizeof(int), seed, &out) * return out # <<<<<<<<<<<<<< @@ -1290,11 +1293,11 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_3murmurhash3_int_s32(PyOb case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_int_s32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_int_s32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_int_s32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_int_s32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1302,12 +1305,12 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_3murmurhash3_int_s32(PyOb values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_key = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_key = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_key == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_int_s32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_int_s32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_int_s32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -1318,7 +1321,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_3murmurhash3_int_s32(PyOb return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":34 +/* "sklearn/utils/murmurhash.pyx":36 * * * cpdef np.int32_t murmurhash3_int_s32(int key, unsigned int seed): # <<<<<<<<<<<<<< @@ -1335,7 +1338,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_int_s32(CYTH int __pyx_clineno = 0; __Pyx_RefNannySetupContext("murmurhash3_int_s32", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_s32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_s32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1353,7 +1356,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_2murmurhash3_int_s32(CYTH return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":41 +/* "sklearn/utils/murmurhash.pyx":43 * * * cpdef np.uint32_t murmurhash3_bytes_u32(bytes key, unsigned int seed): # <<<<<<<<<<<<<< @@ -1373,22 +1376,22 @@ static __pyx_t_5numpy_uint32_t __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("murmurhash3_bytes_u32", 0); - /* "sklearn/utils/murmurhash.pyx":44 + /* "sklearn/utils/murmurhash.pyx":46 * """Compute the 32bit murmurhash3 of a bytes key at seed.""" * cdef np.uint32_t out * MurmurHash3_x86_32( key, len(key), seed, &out) # <<<<<<<<<<<<<< * return out * */ - __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_key)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_key)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(((PyObject *)__pyx_v_key) == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_key)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_key)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} MurmurHash3_x86_32(((char *)__pyx_t_1), __pyx_t_2, __pyx_v_seed, (&__pyx_v_out)); - /* "sklearn/utils/murmurhash.pyx":45 + /* "sklearn/utils/murmurhash.pyx":47 * cdef np.uint32_t out * MurmurHash3_x86_32( key, len(key), seed, &out) * return out # <<<<<<<<<<<<<< @@ -1437,11 +1440,11 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_5murmurhash3_bytes_u32(Py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_u32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_u32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_bytes_u32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_bytes_u32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1450,17 +1453,17 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_5murmurhash3_bytes_u32(Py values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_key = ((PyObject*)values[0]); - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_u32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_u32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_u32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_bytes_u32(__pyx_self, __pyx_v_key, __pyx_v_seed); goto __pyx_L0; __pyx_L1_error:; @@ -1470,7 +1473,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_5murmurhash3_bytes_u32(Py return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":41 +/* "sklearn/utils/murmurhash.pyx":43 * * * cpdef np.uint32_t murmurhash3_bytes_u32(bytes key, unsigned int seed): # <<<<<<<<<<<<<< @@ -1487,7 +1490,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_bytes_u32(CY int __pyx_clineno = 0; __Pyx_RefNannySetupContext("murmurhash3_bytes_u32", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_u32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_u32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1505,7 +1508,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_4murmurhash3_bytes_u32(CY return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":48 +/* "sklearn/utils/murmurhash.pyx":50 * * * cpdef np.int32_t murmurhash3_bytes_s32(bytes key, unsigned int seed): # <<<<<<<<<<<<<< @@ -1525,22 +1528,22 @@ static __pyx_t_5numpy_int32_t __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_b int __pyx_clineno = 0; __Pyx_RefNannySetupContext("murmurhash3_bytes_s32", 0); - /* "sklearn/utils/murmurhash.pyx":51 + /* "sklearn/utils/murmurhash.pyx":53 * """Compute the 32bit murmurhash3 of a bytes key at seed.""" * cdef np.int32_t out * MurmurHash3_x86_32( key, len(key), seed, &out) # <<<<<<<<<<<<<< * return out * */ - __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_key)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_AsString(((PyObject *)__pyx_v_key)); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(((PyObject *)__pyx_v_key) == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_key)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_key)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} MurmurHash3_x86_32(((char *)__pyx_t_1), __pyx_t_2, __pyx_v_seed, (&__pyx_v_out)); - /* "sklearn/utils/murmurhash.pyx":52 + /* "sklearn/utils/murmurhash.pyx":54 * cdef np.int32_t out * MurmurHash3_x86_32( key, len(key), seed, &out) * return out # <<<<<<<<<<<<<< @@ -1589,11 +1592,11 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_7murmurhash3_bytes_s32(Py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_s32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_s32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_bytes_s32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_bytes_s32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1602,17 +1605,17 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_7murmurhash3_bytes_s32(Py values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_key = ((PyObject*)values[0]); - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_s32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_s32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_s32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), (&PyBytes_Type), 1, "key", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_bytes_s32(__pyx_self, __pyx_v_key, __pyx_v_seed); goto __pyx_L0; __pyx_L1_error:; @@ -1622,7 +1625,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_7murmurhash3_bytes_s32(Py return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":48 +/* "sklearn/utils/murmurhash.pyx":50 * * * cpdef np.int32_t murmurhash3_bytes_s32(bytes key, unsigned int seed): # <<<<<<<<<<<<<< @@ -1639,7 +1642,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_bytes_s32(CY int __pyx_clineno = 0; __Pyx_RefNannySetupContext("murmurhash3_bytes_s32", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_s32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_s32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1657,7 +1660,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_6murmurhash3_bytes_s32(CY return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":56 +/* "sklearn/utils/murmurhash.pyx":58 * * @cython.boundscheck(False) * cpdef np.ndarray[np.uint32_t, ndim=1] murmurhash3_bytes_array_u32( # <<<<<<<<<<<<<< @@ -1698,30 +1701,30 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr __pyx_pybuffernd_key.rcbuffer = &__pyx_pybuffer_key; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_key.rcbuffer->pybuffer, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_key.rcbuffer->pybuffer, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_key.diminfo[0].strides = __pyx_pybuffernd_key.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_key.diminfo[0].shape = __pyx_pybuffernd_key.rcbuffer->pybuffer.shape[0]; - /* "sklearn/utils/murmurhash.pyx":60 + /* "sklearn/utils/murmurhash.pyx":62 * """Compute 32bit murmurhash3 hashes of a key int array at seed.""" * # TODO make it possible to pass preallocated ouput array * cdef np.ndarray[np.uint32_t, ndim=1] out = np.zeros(key.size, np.uint32) # <<<<<<<<<<<<<< * cdef Py_ssize_t i * for i in range(key.shape[0]): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_key), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_key), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__uint32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __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 = 62; __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); @@ -1729,17 +1732,17 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __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]; } } @@ -1747,7 +1750,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr __pyx_v_out = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/utils/murmurhash.pyx":62 + /* "sklearn/utils/murmurhash.pyx":64 * cdef np.ndarray[np.uint32_t, ndim=1] out = np.zeros(key.size, np.uint32) * cdef Py_ssize_t i * for i in range(key.shape[0]): # <<<<<<<<<<<<<< @@ -1758,7 +1761,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "sklearn/utils/murmurhash.pyx":63 + /* "sklearn/utils/murmurhash.pyx":65 * cdef Py_ssize_t i * for i in range(key.shape[0]): * out[i] = murmurhash3_int_u32(key[i], seed) # <<<<<<<<<<<<<< @@ -1772,7 +1775,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_out.diminfo[0].strides) = __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_u32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_key.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_key.diminfo[0].strides)), __pyx_v_seed, 0); } - /* "sklearn/utils/murmurhash.pyx":64 + /* "sklearn/utils/murmurhash.pyx":66 * for i in range(key.shape[0]): * out[i] = murmurhash3_int_u32(key[i], seed) * return out # <<<<<<<<<<<<<< @@ -1838,11 +1841,11 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_9murmurhash3_bytes_array_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_u32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_u32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_bytes_array_u32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_bytes_array_u32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1851,17 +1854,17 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_9murmurhash3_bytes_array_ values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_key = ((PyArrayObject *)values[0]); - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_u32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_u32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_array_u32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), __pyx_ptype_5numpy_ndarray, 1, "key", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), __pyx_ptype_5numpy_ndarray, 1, "key", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5utils_10murmurhash_8murmurhash3_bytes_array_u32(__pyx_self, __pyx_v_key, __pyx_v_seed); goto __pyx_L0; __pyx_L1_error:; @@ -1871,7 +1874,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_9murmurhash3_bytes_array_ return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":56 +/* "sklearn/utils/murmurhash.pyx":58 * * @cython.boundscheck(False) * cpdef np.ndarray[np.uint32_t, ndim=1] murmurhash3_bytes_array_u32( # <<<<<<<<<<<<<< @@ -1895,11 +1898,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_8murmurhash3_bytes_array_ __pyx_pybuffernd_key.rcbuffer = &__pyx_pybuffer_key; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_key.rcbuffer->pybuffer, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_key.rcbuffer->pybuffer, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_key.diminfo[0].strides = __pyx_pybuffernd_key.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_key.diminfo[0].shape = __pyx_pybuffernd_key.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_u32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_u32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1924,7 +1927,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_8murmurhash3_bytes_array_ return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":68 +/* "sklearn/utils/murmurhash.pyx":70 * * @cython.boundscheck(False) * cpdef np.ndarray[np.int32_t, ndim=1] murmurhash3_bytes_array_s32( # <<<<<<<<<<<<<< @@ -1965,30 +1968,30 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr __pyx_pybuffernd_key.rcbuffer = &__pyx_pybuffer_key; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_key.rcbuffer->pybuffer, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_key.rcbuffer->pybuffer, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_key.diminfo[0].strides = __pyx_pybuffernd_key.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_key.diminfo[0].shape = __pyx_pybuffernd_key.rcbuffer->pybuffer.shape[0]; - /* "sklearn/utils/murmurhash.pyx":72 + /* "sklearn/utils/murmurhash.pyx":74 * """Compute 32bit murmurhash3 hashes of a key int array at seed.""" * # TODO make it possible to pass preallocated ouput array * cdef np.ndarray[np.int32_t, ndim=1] out = np.zeros(key.size, np.int32) # <<<<<<<<<<<<<< * cdef Py_ssize_t i * for i in range(key.shape[0]): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_key), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_key), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __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 = 74; __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); @@ -1996,17 +1999,17 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_out.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 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 = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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]; } } @@ -2014,7 +2017,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr __pyx_v_out = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/utils/murmurhash.pyx":74 + /* "sklearn/utils/murmurhash.pyx":76 * cdef np.ndarray[np.int32_t, ndim=1] out = np.zeros(key.size, np.int32) * cdef Py_ssize_t i * for i in range(key.shape[0]): # <<<<<<<<<<<<<< @@ -2025,7 +2028,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "sklearn/utils/murmurhash.pyx":75 + /* "sklearn/utils/murmurhash.pyx":77 * cdef Py_ssize_t i * for i in range(key.shape[0]): * out[i] = murmurhash3_int_s32(key[i], seed) # <<<<<<<<<<<<<< @@ -2039,7 +2042,7 @@ static PyArrayObject *__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_arr *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_out.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_out.diminfo[0].strides) = __pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_s32((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int32_t *, __pyx_pybuffernd_key.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_key.diminfo[0].strides)), __pyx_v_seed, 0); } - /* "sklearn/utils/murmurhash.pyx":76 + /* "sklearn/utils/murmurhash.pyx":78 * for i in range(key.shape[0]): * out[i] = murmurhash3_int_s32(key[i], seed) * return out # <<<<<<<<<<<<<< @@ -2105,11 +2108,11 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_11murmurhash3_bytes_array case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_s32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_s32", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_bytes_array_s32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_bytes_array_s32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2118,17 +2121,17 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_11murmurhash3_bytes_array values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_key = ((PyArrayObject *)values[0]); - __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_seed == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_s32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_bytes_array_s32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_bytes_array_s32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), __pyx_ptype_5numpy_ndarray, 1, "key", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_key), __pyx_ptype_5numpy_ndarray, 1, "key", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5utils_10murmurhash_10murmurhash3_bytes_array_s32(__pyx_self, __pyx_v_key, __pyx_v_seed); goto __pyx_L0; __pyx_L1_error:; @@ -2138,7 +2141,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_11murmurhash3_bytes_array return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":68 +/* "sklearn/utils/murmurhash.pyx":70 * * @cython.boundscheck(False) * cpdef np.ndarray[np.int32_t, ndim=1] murmurhash3_bytes_array_s32( # <<<<<<<<<<<<<< @@ -2162,11 +2165,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_10murmurhash3_bytes_array __pyx_pybuffernd_key.rcbuffer = &__pyx_pybuffer_key; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_key.rcbuffer->pybuffer, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_key.rcbuffer->pybuffer, (PyObject*)__pyx_v_key, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_key.diminfo[0].strides = __pyx_pybuffernd_key.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_key.diminfo[0].shape = __pyx_pybuffernd_key.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_s32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_s32(__pyx_v_key, __pyx_v_seed, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2234,7 +2237,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_13murmurhash3_32(PyObject } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "murmurhash3_32") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2251,7 +2254,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_13murmurhash3_32(PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("murmurhash3_32", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("murmurhash3_32", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.murmurhash.murmurhash3_32", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2262,7 +2265,7 @@ static PyObject *__pyx_pw_7sklearn_5utils_10murmurhash_13murmurhash3_32(PyObject return __pyx_r; } -/* "sklearn/utils/murmurhash.pyx":79 +/* "sklearn/utils/murmurhash.pyx":81 * * * def murmurhash3_32(key, seed=0, positive=False): # <<<<<<<<<<<<<< @@ -2286,7 +2289,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("murmurhash3_32", 0); - /* "sklearn/utils/murmurhash.pyx":101 + /* "sklearn/utils/murmurhash.pyx":103 * * """ * if isinstance(key, bytes): # <<<<<<<<<<<<<< @@ -2299,17 +2302,17 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "sklearn/utils/murmurhash.pyx":102 + /* "sklearn/utils/murmurhash.pyx":104 * """ * if isinstance(key, bytes): * if positive: # <<<<<<<<<<<<<< * return murmurhash3_bytes_u32(key, seed) * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "sklearn/utils/murmurhash.pyx":103 + /* "sklearn/utils/murmurhash.pyx":105 * if isinstance(key, bytes): * if positive: * return murmurhash3_bytes_u32(key, seed) # <<<<<<<<<<<<<< @@ -2317,11 +2320,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U * return murmurhash3_bytes_s32(key, seed) */ __Pyx_XDECREF(__pyx_r); - if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_key)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_key)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = __pyx_v_key; __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_u32(((PyObject*)__pyx_t_1), __pyx_t_3, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_u32(((PyObject*)__pyx_t_1), __pyx_t_3, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __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; @@ -2331,7 +2334,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":105 + /* "sklearn/utils/murmurhash.pyx":107 * return murmurhash3_bytes_u32(key, seed) * else: * return murmurhash3_bytes_s32(key, seed) # <<<<<<<<<<<<<< @@ -2339,11 +2342,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U * if positive: */ __Pyx_XDECREF(__pyx_r); - if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_key)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyBytes_CheckExact(__pyx_v_key))||((__pyx_v_key) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_key)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __pyx_v_key; __Pyx_INCREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_s32(((PyObject*)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_s32(((PyObject*)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; @@ -2354,7 +2357,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U goto __pyx_L3; } - /* "sklearn/utils/murmurhash.pyx":106 + /* "sklearn/utils/murmurhash.pyx":108 * else: * return murmurhash3_bytes_s32(key, seed) * elif isinstance(key, unicode): # <<<<<<<<<<<<<< @@ -2367,17 +2370,17 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "sklearn/utils/murmurhash.pyx":107 + /* "sklearn/utils/murmurhash.pyx":109 * return murmurhash3_bytes_s32(key, seed) * elif isinstance(key, unicode): * if positive: # <<<<<<<<<<<<<< * return murmurhash3_bytes_u32(key.encode('utf-8'), seed) * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { - /* "sklearn/utils/murmurhash.pyx":108 + /* "sklearn/utils/murmurhash.pyx":110 * elif isinstance(key, unicode): * if positive: * return murmurhash3_bytes_u32(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< @@ -2385,14 +2388,14 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U * return murmurhash3_bytes_s32(key.encode('utf-8'), seed) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_u32(((PyObject*)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_u32(((PyObject*)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; @@ -2402,7 +2405,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":110 + /* "sklearn/utils/murmurhash.pyx":112 * return murmurhash3_bytes_u32(key.encode('utf-8'), seed) * else: * return murmurhash3_bytes_s32(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< @@ -2410,14 +2413,14 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U * if positive: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_s32(((PyObject*)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_s32(((PyObject*)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; @@ -2428,7 +2431,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U goto __pyx_L3; } - /* "sklearn/utils/murmurhash.pyx":111 + /* "sklearn/utils/murmurhash.pyx":113 * else: * return murmurhash3_bytes_s32(key.encode('utf-8'), seed) * elif isinstance(key, int) or isinstance(key, np.int32): # <<<<<<<<<<<<<< @@ -2440,12 +2443,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_key, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = PyObject_IsInstance(__pyx_v_key, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_IsInstance(__pyx_v_key, __pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __pyx_t_5; } else { @@ -2453,17 +2456,17 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U } if (__pyx_t_6) { - /* "sklearn/utils/murmurhash.pyx":112 + /* "sklearn/utils/murmurhash.pyx":114 * return murmurhash3_bytes_s32(key.encode('utf-8'), seed) * elif isinstance(key, int) or isinstance(key, np.int32): * if positive: # <<<<<<<<<<<<<< * return murmurhash3_int_u32(key, seed) * else: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { - /* "sklearn/utils/murmurhash.pyx":113 + /* "sklearn/utils/murmurhash.pyx":115 * elif isinstance(key, int) or isinstance(key, np.int32): * if positive: * return murmurhash3_int_u32(key, seed) # <<<<<<<<<<<<<< @@ -2471,9 +2474,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U * return murmurhash3_int_s32(key, seed) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_key); if (unlikely((__pyx_t_7 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_u32(((__pyx_t_5numpy_int32_t)__pyx_t_7), __pyx_t_3, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_key); if (unlikely((__pyx_t_7 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_u32(((__pyx_t_5numpy_int32_t)__pyx_t_7), __pyx_t_3, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -2482,7 +2485,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":115 + /* "sklearn/utils/murmurhash.pyx":117 * return murmurhash3_int_u32(key, seed) * else: * return murmurhash3_int_s32(key, seed) # <<<<<<<<<<<<<< @@ -2490,9 +2493,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U * if key.dtype != np.int32: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_7 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_key); if (unlikely((__pyx_t_7 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_s32(((__pyx_t_5numpy_int32_t)__pyx_t_7), __pyx_t_3, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_int32(__pyx_v_key); if (unlikely((__pyx_t_7 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32(__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_int_s32(((__pyx_t_5numpy_int32_t)__pyx_t_7), __pyx_t_3, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; @@ -2502,7 +2505,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U goto __pyx_L3; } - /* "sklearn/utils/murmurhash.pyx":116 + /* "sklearn/utils/murmurhash.pyx":118 * else: * return murmurhash3_int_s32(key, seed) * elif isinstance(key, np.ndarray): # <<<<<<<<<<<<<< @@ -2515,65 +2518,65 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { - /* "sklearn/utils/murmurhash.pyx":117 + /* "sklearn/utils/murmurhash.pyx":119 * return murmurhash3_int_s32(key, seed) * elif isinstance(key, np.ndarray): * if key.dtype != np.int32: # <<<<<<<<<<<<<< * raise TypeError( * "key.dtype should be int32, got %s" % key.dtype) */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); 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_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_8, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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 = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { - /* "sklearn/utils/murmurhash.pyx":119 + /* "sklearn/utils/murmurhash.pyx":121 * if key.dtype != np.int32: * raise TypeError( * "key.dtype should be int32, got %s" % key.dtype) # <<<<<<<<<<<<<< * if positive: * return murmurhash3_bytes_array_u32(key.ravel(), */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __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 = 118; __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "sklearn/utils/murmurhash.pyx":120 + /* "sklearn/utils/murmurhash.pyx":122 * raise TypeError( * "key.dtype should be int32, got %s" % key.dtype) * if positive: # <<<<<<<<<<<<<< * return murmurhash3_bytes_array_u32(key.ravel(), * seed).reshape(key.shape) */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_positive); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { - /* "sklearn/utils/murmurhash.pyx":121 + /* "sklearn/utils/murmurhash.pyx":123 * "key.dtype should be int32, got %s" % key.dtype) * if positive: * return murmurhash3_bytes_array_u32(key.ravel(), # <<<<<<<<<<<<<< @@ -2582,50 +2585,50 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/utils/murmurhash.pyx":122 + /* "sklearn/utils/murmurhash.pyx":124 * if positive: * return murmurhash3_bytes_array_u32(key.ravel(), * seed).reshape(key.shape) # <<<<<<<<<<<<<< * else: * return murmurhash3_bytes_array_s32(key.ravel(), */ - __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__ravel); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__ravel); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - /* "sklearn/utils/murmurhash.pyx":121 + /* "sklearn/utils/murmurhash.pyx":123 * "key.dtype should be int32, got %s" % key.dtype) * if positive: * return murmurhash3_bytes_array_u32(key.ravel(), # <<<<<<<<<<<<<< * seed).reshape(key.shape) * else: */ - __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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 = 121; __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 = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/utils/murmurhash.pyx":122 + /* "sklearn/utils/murmurhash.pyx":124 * if positive: * return murmurhash3_bytes_array_u32(key.ravel(), * seed).reshape(key.shape) # <<<<<<<<<<<<<< * else: * return murmurhash3_bytes_array_s32(key.ravel(), */ - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_u32(((PyArrayObject *)__pyx_t_1), __pyx_t_3, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_u32(((PyArrayObject *)__pyx_t_1), __pyx_t_3, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__shape); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__shape); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); 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_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -2636,7 +2639,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":124 + /* "sklearn/utils/murmurhash.pyx":126 * seed).reshape(key.shape) * else: * return murmurhash3_bytes_array_s32(key.ravel(), # <<<<<<<<<<<<<< @@ -2645,50 +2648,50 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U */ __Pyx_XDECREF(__pyx_r); - /* "sklearn/utils/murmurhash.pyx":125 + /* "sklearn/utils/murmurhash.pyx":127 * else: * return murmurhash3_bytes_array_s32(key.ravel(), * seed).reshape(key.shape) # <<<<<<<<<<<<<< * else: * raise TypeError( */ - __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__ravel); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__ravel); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - /* "sklearn/utils/murmurhash.pyx":124 + /* "sklearn/utils/murmurhash.pyx":126 * seed).reshape(key.shape) * else: * return murmurhash3_bytes_array_s32(key.ravel(), # <<<<<<<<<<<<<< * seed).reshape(key.shape) * else: */ - __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/utils/murmurhash.pyx":125 + /* "sklearn/utils/murmurhash.pyx":127 * else: * return murmurhash3_bytes_array_s32(key.ravel(), * seed).reshape(key.shape) # <<<<<<<<<<<<<< * else: * raise TypeError( */ - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_s32(((PyArrayObject *)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_seed); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PyObject *)__pyx_f_7sklearn_5utils_10murmurhash_murmurhash3_bytes_array_s32(((PyArrayObject *)__pyx_t_4), __pyx_t_3, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__shape); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__shape); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __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 = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -2701,12 +2704,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U } /*else*/ { - /* "sklearn/utils/murmurhash.pyx":129 + /* "sklearn/utils/murmurhash.pyx":131 * raise TypeError( * "key %r with type %s is not supported. " * "Explicit conversion to bytes is required" % (key, type(key))) # <<<<<<<<<<<<<< */ - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_key); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_key); @@ -2714,20 +2717,20 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_key))); PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)Py_TYPE(__pyx_v_key))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_key))); - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; @@ -2746,8 +2749,8 @@ static PyObject *__pyx_pf_7sklearn_5utils_10murmurhash_12murmurhash3_32(CYTHON_U } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -3091,8 +3094,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset @@ -3167,7 +3172,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: @@ -3562,8 +3568,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -4775,8 +4781,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -4788,28 +4794,28 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/utils/murmurhash.pyx":108 + /* "sklearn/utils/murmurhash.pyx":110 * elif isinstance(key, unicode): * if positive: * return murmurhash3_bytes_u32(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< * else: * return murmurhash3_bytes_s32(key.encode('utf-8'), seed) */ - __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); - /* "sklearn/utils/murmurhash.pyx":110 + /* "sklearn/utils/murmurhash.pyx":112 * return murmurhash3_bytes_u32(key.encode('utf-8'), seed) * else: * return murmurhash3_bytes_s32(key.encode('utf-8'), seed) # <<<<<<<<<<<<<< * elif isinstance(key, int) or isinstance(key, np.int32): * if positive: */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_2)); @@ -4900,14 +4906,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_17)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); - /* "sklearn/utils/murmurhash.pyx":79 + /* "sklearn/utils/murmurhash.pyx":81 * * * def murmurhash3_32(key, seed=0, positive=False): # <<<<<<<<<<<<<< * """Compute the 32bit murmurhash3 of key at seed. * */ - __pyx_k_tuple_20 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_20 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_INCREF(((PyObject *)__pyx_n_s__key)); PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_n_s__key)); @@ -4919,7 +4925,7 @@ static int __Pyx_InitCachedConstants(void) { PyTuple_SET_ITEM(__pyx_k_tuple_20, 2, ((PyObject *)__pyx_n_s__positive)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__positive)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - __pyx_k_codeobj_21 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__murmurhash3_32, 79, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_codeobj_21 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_22, __pyx_n_s__murmurhash3_32, 81, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -4982,6 +4988,14 @@ PyMODINIT_FUNC PyInit_murmurhash(void) __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__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.utils.murmurhash")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.utils.murmurhash", __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); @@ -5033,21 +5047,30 @@ PyMODINIT_FUNC PyInit_murmurhash(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/murmurhash.pyx":79 + /* "sklearn/utils/murmurhash.pyx":26 + * void MurmurHash3_x64_128 (void *key, int len, np.uint32_t seed, void *out) + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/utils/murmurhash.pyx":81 * * * def murmurhash3_32(key, seed=0, positive=False): # <<<<<<<<<<<<<< * """Compute the 32bit murmurhash3 of key at seed. * */ - __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_1 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10murmurhash_13murmurhash3_32, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_10murmurhash_13murmurhash3_32, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__murmurhash3_32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__murmurhash3_32, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "sklearn/utils/murmurhash.pyx":1 @@ -6318,6 +6341,10 @@ static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* 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_VERSION_HEX < 0x03000000 @@ -6337,6 +6364,7 @@ static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) { if (likely(!ret)) return val; } + #endif return (npy_int32)-1; } } diff --git a/sklearn/utils/murmurhash.pyx b/sklearn/utils/murmurhash.pyx index 00014a05a1698..cd9a56f8a5061 100644 --- a/sklearn/utils/murmurhash.pyx +++ b/sklearn/utils/murmurhash.pyx @@ -23,6 +23,8 @@ cdef extern from "src/MurmurHash3.h": void MurmurHash3_x86_128(void *key, int len, np.uint32_t seed, void *out) void MurmurHash3_x64_128 (void *key, int len, np.uint32_t seed, void *out) +np.import_array() + cpdef np.uint32_t murmurhash3_int_u32(int key, unsigned int seed): """Compute the 32bit murmurhash3 of a int key at seed.""" diff --git a/sklearn/utils/seq_dataset.c b/sklearn/utils/seq_dataset.c index c8236b6a398d5..0215824e5d02c 100644 --- a/sklearn/utils/seq_dataset.c +++ b/sklearn/utils/seq_dataset.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.17.1 on Mon Dec 10 16:21:27 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:54 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -53,12 +53,15 @@ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) - #define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) @@ -727,7 +730,7 @@ struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset { -/* "sklearn/utils/seq_dataset.pyx":16 +/* "sklearn/utils/seq_dataset.pyx":18 * * * cdef class SequentialDataset: # <<<<<<<<<<<<<< @@ -742,7 +745,7 @@ struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset { static struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset *__pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset; -/* "sklearn/utils/seq_dataset.pyx":112 +/* "sklearn/utils/seq_dataset.pyx":114 * * * cdef class CSRDataset(SequentialDataset): # <<<<<<<<<<<<<< @@ -756,7 +759,7 @@ struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset { static struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset *__pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset; -/* "sklearn/utils/seq_dataset.pyx":46 +/* "sklearn/utils/seq_dataset.pyx":48 * * * cdef class ArrayDataset(SequentialDataset): # <<<<<<<<<<<<<< @@ -1186,7 +1189,7 @@ static PyObject *__pyx_k_tuple_9; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_12; -/* "sklearn/utils/seq_dataset.pyx":19 +/* "sklearn/utils/seq_dataset.pyx":21 * """Base class for datasets with sequential data access. """ * * cdef void next(self, DOUBLE **x_data_ptr, INTEGER **x_ind_ptr, # <<<<<<<<<<<<<< @@ -1202,18 +1205,18 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_17SequentialDataset_next(CYTHO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("next", 0); - /* "sklearn/utils/seq_dataset.pyx":39 + /* "sklearn/utils/seq_dataset.pyx":41 * The weight of the next example. * """ * raise NotImplementedError() # <<<<<<<<<<<<<< * * cdef void shuffle(self, seed): */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); 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_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L0; __pyx_L1_error:; @@ -1223,7 +1226,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_17SequentialDataset_next(CYTHO __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/seq_dataset.pyx":41 +/* "sklearn/utils/seq_dataset.pyx":43 * raise NotImplementedError() * * cdef void shuffle(self, seed): # <<<<<<<<<<<<<< @@ -1239,18 +1242,18 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_17SequentialDataset_shuffle(CY int __pyx_clineno = 0; __Pyx_RefNannySetupContext("shuffle", 0); - /* "sklearn/utils/seq_dataset.pyx":43 + /* "sklearn/utils/seq_dataset.pyx":45 * cdef void shuffle(self, seed): * """Permutes the ordering of examples. """ * raise NotImplementedError() # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __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 = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L0; __pyx_L1_error:; @@ -1290,16 +1293,16 @@ static int __pyx_pw_7sklearn_5utils_11seq_dataset_12ArrayDataset_1__cinit__(PyOb case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_weights)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __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 = 53; __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 = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -1314,15 +1317,15 @@ static int __pyx_pw_7sklearn_5utils_11seq_dataset_12ArrayDataset_1__cinit__(PyOb } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.seq_dataset.ArrayDataset.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __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 = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_weights), __pyx_ptype_5numpy_ndarray, 1, "sample_weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __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 = 55; __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 = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_weights), __pyx_ptype_5numpy_ndarray, 1, "sample_weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(((struct __pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset *)__pyx_v_self), __pyx_v_X, __pyx_v_Y, __pyx_v_sample_weights); goto __pyx_L0; __pyx_L1_error:; @@ -1332,7 +1335,7 @@ static int __pyx_pw_7sklearn_5utils_11seq_dataset_12ArrayDataset_1__cinit__(PyOb return __pyx_r; } -/* "sklearn/utils/seq_dataset.pyx":53 +/* "sklearn/utils/seq_dataset.pyx":55 * """ * * def __cinit__(self, np.ndarray[DOUBLE, ndim=2, mode='c'] X, # <<<<<<<<<<<<<< @@ -1389,21 +1392,21 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc __pyx_pybuffernd_sample_weights.rcbuffer = &__pyx_pybuffer_sample_weights; { __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_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __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_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __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_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __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_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __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_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sample_weights.diminfo[0].strides = __pyx_pybuffernd_sample_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weights.diminfo[0].shape = __pyx_pybuffernd_sample_weights.rcbuffer->pybuffer.shape[0]; - /* "sklearn/utils/seq_dataset.pyx":70 + /* "sklearn/utils/seq_dataset.pyx":72 * array of dtype np.float64. * """ * self.n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -1412,7 +1415,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc */ __pyx_v_self->__pyx_base.n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/utils/seq_dataset.pyx":71 + /* "sklearn/utils/seq_dataset.pyx":73 * """ * self.n_samples = X.shape[0] * self.n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -1421,21 +1424,21 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc */ __pyx_v_self->n_features = (__pyx_v_X->dimensions[1]); - /* "sklearn/utils/seq_dataset.pyx":73 + /* "sklearn/utils/seq_dataset.pyx":75 * self.n_features = X.shape[1] * cdef np.ndarray[INTEGER, ndim=1, * mode='c'] feature_indices = np.arange(0, self.n_features, # <<<<<<<<<<<<<< * dtype=np.int32) * self.feature_indices = feature_indices */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __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 = 75; __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); @@ -1443,35 +1446,35 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc PyTuple_SET_ITEM(__pyx_t_3, 1, __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 = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - /* "sklearn/utils/seq_dataset.pyx":74 + /* "sklearn/utils/seq_dataset.pyx":76 * cdef np.ndarray[INTEGER, ndim=1, * mode='c'] feature_indices = np.arange(0, self.n_features, * dtype=np.int32) # <<<<<<<<<<<<<< * self.feature_indices = feature_indices * self.feature_indices_ptr = feature_indices.data */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __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 = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 75; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __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_feature_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_INTEGER, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_feature_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_feature_indices.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_feature_indices.diminfo[0].strides = __pyx_pybuffernd_feature_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_feature_indices.diminfo[0].shape = __pyx_pybuffernd_feature_indices.rcbuffer->pybuffer.shape[0]; } } @@ -1479,7 +1482,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc __pyx_v_feature_indices = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/utils/seq_dataset.pyx":75 + /* "sklearn/utils/seq_dataset.pyx":77 * mode='c'] feature_indices = np.arange(0, self.n_features, * dtype=np.int32) * self.feature_indices = feature_indices # <<<<<<<<<<<<<< @@ -1492,7 +1495,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc __Pyx_DECREF(((PyObject *)__pyx_v_self->feature_indices)); __pyx_v_self->feature_indices = ((PyArrayObject *)__pyx_v_feature_indices); - /* "sklearn/utils/seq_dataset.pyx":76 + /* "sklearn/utils/seq_dataset.pyx":78 * dtype=np.int32) * self.feature_indices = feature_indices * self.feature_indices_ptr = feature_indices.data # <<<<<<<<<<<<<< @@ -1501,7 +1504,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc */ __pyx_v_self->feature_indices_ptr = ((__pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *)__pyx_v_feature_indices->data); - /* "sklearn/utils/seq_dataset.pyx":77 + /* "sklearn/utils/seq_dataset.pyx":79 * self.feature_indices = feature_indices * self.feature_indices_ptr = feature_indices.data * self.current_index = -1 # <<<<<<<<<<<<<< @@ -1510,26 +1513,26 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc */ __pyx_v_self->current_index = -1; - /* "sklearn/utils/seq_dataset.pyx":78 + /* "sklearn/utils/seq_dataset.pyx":80 * self.feature_indices_ptr = feature_indices.data * self.current_index = -1 * self.stride = X.strides[0] / X.itemsize # <<<<<<<<<<<<<< * self.X_data_ptr = X.data * self.Y_data_ptr = Y.data */ - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->strides[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_X->strides[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->stride = __pyx_t_7; - /* "sklearn/utils/seq_dataset.pyx":79 + /* "sklearn/utils/seq_dataset.pyx":81 * self.current_index = -1 * self.stride = X.strides[0] / X.itemsize * self.X_data_ptr = X.data # <<<<<<<<<<<<<< @@ -1538,7 +1541,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc */ __pyx_v_self->X_data_ptr = ((__pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *)__pyx_v_X->data); - /* "sklearn/utils/seq_dataset.pyx":80 + /* "sklearn/utils/seq_dataset.pyx":82 * self.stride = X.strides[0] / X.itemsize * self.X_data_ptr = X.data * self.Y_data_ptr = Y.data # <<<<<<<<<<<<<< @@ -1547,7 +1550,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc */ __pyx_v_self->Y_data_ptr = ((__pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *)__pyx_v_Y->data); - /* "sklearn/utils/seq_dataset.pyx":81 + /* "sklearn/utils/seq_dataset.pyx":83 * self.X_data_ptr = X.data * self.Y_data_ptr = Y.data * self.sample_weight_data = sample_weights.data # <<<<<<<<<<<<<< @@ -1556,21 +1559,21 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc */ __pyx_v_self->sample_weight_data = ((__pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *)__pyx_v_sample_weights->data); - /* "sklearn/utils/seq_dataset.pyx":85 + /* "sklearn/utils/seq_dataset.pyx":87 * # Use index array for fast shuffling * cdef np.ndarray[INTEGER, ndim=1, * mode='c'] index = np.arange(0, self.n_samples, # <<<<<<<<<<<<<< * dtype=np.int32) * self.index = index */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__arange); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__arange); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.n_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.n_samples); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); @@ -1578,35 +1581,35 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - /* "sklearn/utils/seq_dataset.pyx":86 + /* "sklearn/utils/seq_dataset.pyx":88 * cdef np.ndarray[INTEGER, ndim=1, * mode='c'] index = np.arange(0, self.n_samples, * dtype=np.int32) # <<<<<<<<<<<<<< * self.index = index * self.index_data_ptr = index.data */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int32); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __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_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_index.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_INTEGER, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_index.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0]; } } @@ -1614,7 +1617,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc __pyx_v_index = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/utils/seq_dataset.pyx":87 + /* "sklearn/utils/seq_dataset.pyx":89 * mode='c'] index = np.arange(0, self.n_samples, * dtype=np.int32) * self.index = index # <<<<<<<<<<<<<< @@ -1627,7 +1630,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc __Pyx_DECREF(((PyObject *)__pyx_v_self->index)); __pyx_v_self->index = ((PyArrayObject *)__pyx_v_index); - /* "sklearn/utils/seq_dataset.pyx":88 + /* "sklearn/utils/seq_dataset.pyx":90 * dtype=np.int32) * self.index = index * self.index_data_ptr = index.data # <<<<<<<<<<<<<< @@ -1668,7 +1671,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_12ArrayDataset___cinit__(struc return __pyx_r; } -/* "sklearn/utils/seq_dataset.pyx":90 +/* "sklearn/utils/seq_dataset.pyx":92 * self.index_data_ptr = index.data * * cdef void next(self, DOUBLE **x_data_ptr, INTEGER **x_ind_ptr, # <<<<<<<<<<<<<< @@ -1682,28 +1685,32 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next(struct __p int __pyx_v_offset; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; + __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *__pyx_t_3; + Py_ssize_t __pyx_t_4; __Pyx_RefNannySetupContext("next", 0); - /* "sklearn/utils/seq_dataset.pyx":92 + /* "sklearn/utils/seq_dataset.pyx":94 * cdef void next(self, DOUBLE **x_data_ptr, INTEGER **x_ind_ptr, * int *nnz, DOUBLE *y, DOUBLE *sample_weight): * cdef int current_index = self.current_index # <<<<<<<<<<<<<< * if current_index >= (self.n_samples - 1): * current_index = -1 */ - __pyx_v_current_index = __pyx_v_self->current_index; + __pyx_t_1 = __pyx_v_self->current_index; + __pyx_v_current_index = __pyx_t_1; - /* "sklearn/utils/seq_dataset.pyx":93 + /* "sklearn/utils/seq_dataset.pyx":95 * int *nnz, DOUBLE *y, DOUBLE *sample_weight): * cdef int current_index = self.current_index * if current_index >= (self.n_samples - 1): # <<<<<<<<<<<<<< * current_index = -1 * */ - __pyx_t_1 = (__pyx_v_current_index >= (__pyx_v_self->__pyx_base.n_samples - 1)); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_current_index >= (__pyx_v_self->__pyx_base.n_samples - 1)); + if (__pyx_t_2) { - /* "sklearn/utils/seq_dataset.pyx":94 + /* "sklearn/utils/seq_dataset.pyx":96 * cdef int current_index = self.current_index * if current_index >= (self.n_samples - 1): * current_index = -1 # <<<<<<<<<<<<<< @@ -1715,7 +1722,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next(struct __p } __pyx_L3:; - /* "sklearn/utils/seq_dataset.pyx":96 + /* "sklearn/utils/seq_dataset.pyx":98 * current_index = -1 * * current_index += 1 # <<<<<<<<<<<<<< @@ -1724,7 +1731,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next(struct __p */ __pyx_v_current_index = (__pyx_v_current_index + 1); - /* "sklearn/utils/seq_dataset.pyx":97 + /* "sklearn/utils/seq_dataset.pyx":99 * * current_index += 1 * cdef int sample_idx = self.index_data_ptr[current_index] # <<<<<<<<<<<<<< @@ -1733,7 +1740,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next(struct __p */ __pyx_v_sample_idx = (__pyx_v_self->index_data_ptr[__pyx_v_current_index]); - /* "sklearn/utils/seq_dataset.pyx":98 + /* "sklearn/utils/seq_dataset.pyx":100 * current_index += 1 * cdef int sample_idx = self.index_data_ptr[current_index] * cdef int offset = sample_idx * self.stride # <<<<<<<<<<<<<< @@ -1742,7 +1749,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next(struct __p */ __pyx_v_offset = (__pyx_v_sample_idx * __pyx_v_self->stride); - /* "sklearn/utils/seq_dataset.pyx":100 + /* "sklearn/utils/seq_dataset.pyx":102 * cdef int offset = sample_idx * self.stride * * y[0] = self.Y_data_ptr[sample_idx] # <<<<<<<<<<<<<< @@ -1751,7 +1758,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next(struct __p */ (__pyx_v_y[0]) = (__pyx_v_self->Y_data_ptr[__pyx_v_sample_idx]); - /* "sklearn/utils/seq_dataset.pyx":101 + /* "sklearn/utils/seq_dataset.pyx":103 * * y[0] = self.Y_data_ptr[sample_idx] * x_data_ptr[0] = self.X_data_ptr + offset # <<<<<<<<<<<<<< @@ -1760,25 +1767,27 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next(struct __p */ (__pyx_v_x_data_ptr[0]) = (__pyx_v_self->X_data_ptr + __pyx_v_offset); - /* "sklearn/utils/seq_dataset.pyx":102 + /* "sklearn/utils/seq_dataset.pyx":104 * y[0] = self.Y_data_ptr[sample_idx] * x_data_ptr[0] = self.X_data_ptr + offset * x_ind_ptr[0] = self.feature_indices_ptr # <<<<<<<<<<<<<< * nnz[0] = self.n_features * sample_weight[0] = self.sample_weight_data[sample_idx] */ - (__pyx_v_x_ind_ptr[0]) = __pyx_v_self->feature_indices_ptr; + __pyx_t_3 = __pyx_v_self->feature_indices_ptr; + (__pyx_v_x_ind_ptr[0]) = __pyx_t_3; - /* "sklearn/utils/seq_dataset.pyx":103 + /* "sklearn/utils/seq_dataset.pyx":105 * x_data_ptr[0] = self.X_data_ptr + offset * x_ind_ptr[0] = self.feature_indices_ptr * nnz[0] = self.n_features # <<<<<<<<<<<<<< * sample_weight[0] = self.sample_weight_data[sample_idx] * */ - (__pyx_v_nnz[0]) = __pyx_v_self->n_features; + __pyx_t_4 = __pyx_v_self->n_features; + (__pyx_v_nnz[0]) = __pyx_t_4; - /* "sklearn/utils/seq_dataset.pyx":104 + /* "sklearn/utils/seq_dataset.pyx":106 * x_ind_ptr[0] = self.feature_indices_ptr * nnz[0] = self.n_features * sample_weight[0] = self.sample_weight_data[sample_idx] # <<<<<<<<<<<<<< @@ -1787,7 +1796,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next(struct __p */ (__pyx_v_sample_weight[0]) = (__pyx_v_self->sample_weight_data[__pyx_v_sample_idx]); - /* "sklearn/utils/seq_dataset.pyx":106 + /* "sklearn/utils/seq_dataset.pyx":108 * sample_weight[0] = self.sample_weight_data[sample_idx] * * self.current_index = current_index # <<<<<<<<<<<<<< @@ -1799,7 +1808,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next(struct __p __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/seq_dataset.pyx":108 +/* "sklearn/utils/seq_dataset.pyx":110 * self.current_index = current_index * * cdef void shuffle(self, seed): # <<<<<<<<<<<<<< @@ -1817,39 +1826,39 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_shuffle(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("shuffle", 0); - /* "sklearn/utils/seq_dataset.pyx":109 + /* "sklearn/utils/seq_dataset.pyx":111 * * cdef void shuffle(self, seed): * np.random.RandomState(seed).shuffle(self.index) # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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[0]; __pyx_lineno = 109; __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 = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_seed); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_seed); __Pyx_GIVEREF(__pyx_v_seed); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __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 = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->index)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->index)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->index)); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -1899,26 +1908,26 @@ static int __pyx_pw_7sklearn_5utils_11seq_dataset_10CSRDataset_1__cinit__(PyObje case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indptr)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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 = 115; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -1937,17 +1946,17 @@ static int __pyx_pw_7sklearn_5utils_11seq_dataset_10CSRDataset_1__cinit__(PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.seq_dataset.CSRDataset.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_data), __pyx_ptype_5numpy_ndarray, 1, "X_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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 = 118; __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 = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_data), __pyx_ptype_5numpy_ndarray, 1, "X_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __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 = 120; __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 = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(((struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset *)__pyx_v_self), __pyx_v_X_data, __pyx_v_X_indptr, __pyx_v_X_indices, __pyx_v_Y, __pyx_v_sample_weight); goto __pyx_L0; __pyx_L1_error:; @@ -1957,7 +1966,7 @@ static int __pyx_pw_7sklearn_5utils_11seq_dataset_10CSRDataset_1__cinit__(PyObje return __pyx_r; } -/* "sklearn/utils/seq_dataset.pyx":115 +/* "sklearn/utils/seq_dataset.pyx":117 * """A ``SequentialDataset`` backed by a scipy sparse CSR matrix. """ * * def __cinit__(self, np.ndarray[DOUBLE, ndim=1, mode='c'] X_data, # <<<<<<<<<<<<<< @@ -2017,31 +2026,31 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_data, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_data, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_INTEGER, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_INTEGER, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_INTEGER, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_INTEGER, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; { __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_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __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_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - /* "sklearn/utils/seq_dataset.pyx":144 + /* "sklearn/utils/seq_dataset.pyx":146 * array of dtype np.float64. * """ * self.n_samples = Y.shape[0] # <<<<<<<<<<<<<< @@ -2050,7 +2059,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct */ __pyx_v_self->__pyx_base.n_samples = (__pyx_v_Y->dimensions[0]); - /* "sklearn/utils/seq_dataset.pyx":145 + /* "sklearn/utils/seq_dataset.pyx":147 * """ * self.n_samples = Y.shape[0] * self.current_index = -1 # <<<<<<<<<<<<<< @@ -2059,7 +2068,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct */ __pyx_v_self->current_index = -1; - /* "sklearn/utils/seq_dataset.pyx":146 + /* "sklearn/utils/seq_dataset.pyx":148 * self.n_samples = Y.shape[0] * self.current_index = -1 * self.X_data_ptr = X_data.data # <<<<<<<<<<<<<< @@ -2068,7 +2077,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct */ __pyx_v_self->X_data_ptr = ((__pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *)__pyx_v_X_data->data); - /* "sklearn/utils/seq_dataset.pyx":147 + /* "sklearn/utils/seq_dataset.pyx":149 * self.current_index = -1 * self.X_data_ptr = X_data.data * self.X_indptr_ptr = X_indptr.data # <<<<<<<<<<<<<< @@ -2077,7 +2086,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct */ __pyx_v_self->X_indptr_ptr = ((__pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *)__pyx_v_X_indptr->data); - /* "sklearn/utils/seq_dataset.pyx":148 + /* "sklearn/utils/seq_dataset.pyx":150 * self.X_data_ptr = X_data.data * self.X_indptr_ptr = X_indptr.data * self.X_indices_ptr = X_indices.data # <<<<<<<<<<<<<< @@ -2086,7 +2095,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct */ __pyx_v_self->X_indices_ptr = ((__pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *)__pyx_v_X_indices->data); - /* "sklearn/utils/seq_dataset.pyx":149 + /* "sklearn/utils/seq_dataset.pyx":151 * self.X_indptr_ptr = X_indptr.data * self.X_indices_ptr = X_indices.data * self.Y_data_ptr = Y.data # <<<<<<<<<<<<<< @@ -2095,7 +2104,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct */ __pyx_v_self->Y_data_ptr = ((__pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *)__pyx_v_Y->data); - /* "sklearn/utils/seq_dataset.pyx":150 + /* "sklearn/utils/seq_dataset.pyx":152 * self.X_indices_ptr = X_indices.data * self.Y_data_ptr = Y.data * self.sample_weight_data = sample_weight.data # <<<<<<<<<<<<<< @@ -2104,21 +2113,21 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct */ __pyx_v_self->sample_weight_data = ((__pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *)__pyx_v_sample_weight->data); - /* "sklearn/utils/seq_dataset.pyx":153 + /* "sklearn/utils/seq_dataset.pyx":155 * # Use index array for fast shuffling * cdef np.ndarray[INTEGER, ndim=1, * mode='c'] index = np.arange(0, self.n_samples, # <<<<<<<<<<<<<< * dtype=np.int32) * self.index = index */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.n_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->__pyx_base.n_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __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 = 155; __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); @@ -2126,35 +2135,35 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct PyTuple_SET_ITEM(__pyx_t_3, 1, __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 = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - /* "sklearn/utils/seq_dataset.pyx":154 + /* "sklearn/utils/seq_dataset.pyx":156 * cdef np.ndarray[INTEGER, ndim=1, * mode='c'] index = np.arange(0, self.n_samples, * dtype=np.int32) # <<<<<<<<<<<<<< * self.index = index * self.index_data_ptr = index.data */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int32); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __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_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __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 = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 155; __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; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __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_index.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11seq_dataset_INTEGER, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { __pyx_v_index = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_index.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_index.diminfo[0].strides = __pyx_pybuffernd_index.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_index.diminfo[0].shape = __pyx_pybuffernd_index.rcbuffer->pybuffer.shape[0]; } } @@ -2162,7 +2171,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct __pyx_v_index = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/utils/seq_dataset.pyx":155 + /* "sklearn/utils/seq_dataset.pyx":157 * mode='c'] index = np.arange(0, self.n_samples, * dtype=np.int32) * self.index = index # <<<<<<<<<<<<<< @@ -2175,7 +2184,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct __Pyx_DECREF(((PyObject *)__pyx_v_self->index)); __pyx_v_self->index = ((PyArrayObject *)__pyx_v_index); - /* "sklearn/utils/seq_dataset.pyx":156 + /* "sklearn/utils/seq_dataset.pyx":158 * dtype=np.int32) * self.index = index * self.index_data_ptr = index.data # <<<<<<<<<<<<<< @@ -2217,7 +2226,7 @@ static int __pyx_pf_7sklearn_5utils_11seq_dataset_10CSRDataset___cinit__(struct return __pyx_r; } -/* "sklearn/utils/seq_dataset.pyx":158 +/* "sklearn/utils/seq_dataset.pyx":160 * self.index_data_ptr = index.data * * cdef void next(self, DOUBLE **x_data_ptr, INTEGER **x_ind_ptr, # <<<<<<<<<<<<<< @@ -2231,28 +2240,30 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx int __pyx_v_offset; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("next", 0); - /* "sklearn/utils/seq_dataset.pyx":160 + /* "sklearn/utils/seq_dataset.pyx":162 * cdef void next(self, DOUBLE **x_data_ptr, INTEGER **x_ind_ptr, * int *nnz, DOUBLE *y, DOUBLE *sample_weight): * cdef int current_index = self.current_index # <<<<<<<<<<<<<< * if current_index >= (self.n_samples - 1): * current_index = -1 */ - __pyx_v_current_index = __pyx_v_self->current_index; + __pyx_t_1 = __pyx_v_self->current_index; + __pyx_v_current_index = __pyx_t_1; - /* "sklearn/utils/seq_dataset.pyx":161 + /* "sklearn/utils/seq_dataset.pyx":163 * int *nnz, DOUBLE *y, DOUBLE *sample_weight): * cdef int current_index = self.current_index * if current_index >= (self.n_samples - 1): # <<<<<<<<<<<<<< * current_index = -1 * */ - __pyx_t_1 = (__pyx_v_current_index >= (__pyx_v_self->__pyx_base.n_samples - 1)); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_current_index >= (__pyx_v_self->__pyx_base.n_samples - 1)); + if (__pyx_t_2) { - /* "sklearn/utils/seq_dataset.pyx":162 + /* "sklearn/utils/seq_dataset.pyx":164 * cdef int current_index = self.current_index * if current_index >= (self.n_samples - 1): * current_index = -1 # <<<<<<<<<<<<<< @@ -2264,7 +2275,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx } __pyx_L3:; - /* "sklearn/utils/seq_dataset.pyx":164 + /* "sklearn/utils/seq_dataset.pyx":166 * current_index = -1 * * current_index += 1 # <<<<<<<<<<<<<< @@ -2273,7 +2284,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx */ __pyx_v_current_index = (__pyx_v_current_index + 1); - /* "sklearn/utils/seq_dataset.pyx":165 + /* "sklearn/utils/seq_dataset.pyx":167 * * current_index += 1 * cdef int sample_idx = self.index_data_ptr[current_index] # <<<<<<<<<<<<<< @@ -2282,7 +2293,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx */ __pyx_v_sample_idx = (__pyx_v_self->index_data_ptr[__pyx_v_current_index]); - /* "sklearn/utils/seq_dataset.pyx":166 + /* "sklearn/utils/seq_dataset.pyx":168 * current_index += 1 * cdef int sample_idx = self.index_data_ptr[current_index] * cdef int offset = self.X_indptr_ptr[sample_idx] # <<<<<<<<<<<<<< @@ -2291,7 +2302,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx */ __pyx_v_offset = (__pyx_v_self->X_indptr_ptr[__pyx_v_sample_idx]); - /* "sklearn/utils/seq_dataset.pyx":167 + /* "sklearn/utils/seq_dataset.pyx":169 * cdef int sample_idx = self.index_data_ptr[current_index] * cdef int offset = self.X_indptr_ptr[sample_idx] * y[0] = self.Y_data_ptr[sample_idx] # <<<<<<<<<<<<<< @@ -2300,7 +2311,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx */ (__pyx_v_y[0]) = (__pyx_v_self->Y_data_ptr[__pyx_v_sample_idx]); - /* "sklearn/utils/seq_dataset.pyx":168 + /* "sklearn/utils/seq_dataset.pyx":170 * cdef int offset = self.X_indptr_ptr[sample_idx] * y[0] = self.Y_data_ptr[sample_idx] * x_data_ptr[0] = self.X_data_ptr + offset # <<<<<<<<<<<<<< @@ -2309,7 +2320,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx */ (__pyx_v_x_data_ptr[0]) = (__pyx_v_self->X_data_ptr + __pyx_v_offset); - /* "sklearn/utils/seq_dataset.pyx":169 + /* "sklearn/utils/seq_dataset.pyx":171 * y[0] = self.Y_data_ptr[sample_idx] * x_data_ptr[0] = self.X_data_ptr + offset * x_ind_ptr[0] = self.X_indices_ptr + offset # <<<<<<<<<<<<<< @@ -2318,7 +2329,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx */ (__pyx_v_x_ind_ptr[0]) = (__pyx_v_self->X_indices_ptr + __pyx_v_offset); - /* "sklearn/utils/seq_dataset.pyx":170 + /* "sklearn/utils/seq_dataset.pyx":172 * x_data_ptr[0] = self.X_data_ptr + offset * x_ind_ptr[0] = self.X_indices_ptr + offset * nnz[0] = self.X_indptr_ptr[sample_idx + 1] - offset # <<<<<<<<<<<<<< @@ -2327,7 +2338,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx */ (__pyx_v_nnz[0]) = ((__pyx_v_self->X_indptr_ptr[(__pyx_v_sample_idx + 1)]) - __pyx_v_offset); - /* "sklearn/utils/seq_dataset.pyx":171 + /* "sklearn/utils/seq_dataset.pyx":173 * x_ind_ptr[0] = self.X_indices_ptr + offset * nnz[0] = self.X_indptr_ptr[sample_idx + 1] - offset * sample_weight[0] = self.sample_weight_data[sample_idx] # <<<<<<<<<<<<<< @@ -2336,7 +2347,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx */ (__pyx_v_sample_weight[0]) = (__pyx_v_self->sample_weight_data[__pyx_v_sample_idx]); - /* "sklearn/utils/seq_dataset.pyx":173 + /* "sklearn/utils/seq_dataset.pyx":175 * sample_weight[0] = self.sample_weight_data[sample_idx] * * self.current_index = current_index # <<<<<<<<<<<<<< @@ -2348,7 +2359,7 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next(struct __pyx __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/seq_dataset.pyx":175 +/* "sklearn/utils/seq_dataset.pyx":177 * self.current_index = current_index * * cdef void shuffle(self, seed): # <<<<<<<<<<<<<< @@ -2365,37 +2376,37 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_shuffle(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("shuffle", 0); - /* "sklearn/utils/seq_dataset.pyx":176 + /* "sklearn/utils/seq_dataset.pyx":178 * * cdef void shuffle(self, seed): * np.random.RandomState(seed).shuffle(self.index) # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__RandomState); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __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[0]; __pyx_lineno = 176; __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 = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_seed); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_seed); __Pyx_GIVEREF(__pyx_v_seed); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __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_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__shuffle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __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 = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->index)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->index)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->index)); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -2412,8 +2423,8 @@ static void __pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_shuffle(struct __ } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -2757,8 +2768,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset @@ -2833,7 +2846,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: @@ -3228,8 +3242,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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)); @@ -4570,8 +4584,10 @@ static PyObject *__pyx_tp_new_7sklearn_5utils_11seq_dataset_ArrayDataset(PyTypeO static void __pyx_tp_dealloc_7sklearn_5utils_11seq_dataset_ArrayDataset(PyObject *o) { struct __pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset *p = (struct __pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->feature_indices); Py_CLEAR(p->index); + PyObject_GC_Track(o); __pyx_tp_dealloc_7sklearn_5utils_11seq_dataset_SequentialDataset(o); } @@ -4776,8 +4792,10 @@ static PyObject *__pyx_tp_new_7sklearn_5utils_11seq_dataset_CSRDataset(PyTypeObj static void __pyx_tp_dealloc_7sklearn_5utils_11seq_dataset_CSRDataset(PyObject *o) { struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset *p = (struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset *)o; + PyObject_GC_UnTrack(o); Py_CLEAR(p->feature_indices); Py_CLEAR(p->index); + PyObject_GC_Track(o); __pyx_tp_dealloc_7sklearn_5utils_11seq_dataset_SequentialDataset(o); } @@ -5015,7 +5033,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5173,6 +5191,14 @@ PyMODINIT_FUNC PyInit_seq_dataset(void) __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__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.utils.seq_dataset")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.utils.seq_dataset", __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); @@ -5194,27 +5220,27 @@ PyMODINIT_FUNC PyInit_seq_dataset(void) __pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset = &__pyx_vtable_7sklearn_5utils_11seq_dataset_SequentialDataset; __pyx_vtable_7sklearn_5utils_11seq_dataset_SequentialDataset.next = (void (*)(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE **, __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER **, int *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *))__pyx_f_7sklearn_5utils_11seq_dataset_17SequentialDataset_next; __pyx_vtable_7sklearn_5utils_11seq_dataset_SequentialDataset.shuffle = (void (*)(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *, PyObject *))__pyx_f_7sklearn_5utils_11seq_dataset_17SequentialDataset_shuffle; - if (PyType_Ready(&__pyx_type_7sklearn_5utils_11seq_dataset_SequentialDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_11seq_dataset_SequentialDataset.tp_dict, __pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "SequentialDataset", (PyObject *)&__pyx_type_7sklearn_5utils_11seq_dataset_SequentialDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5utils_11seq_dataset_SequentialDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_11seq_dataset_SequentialDataset.tp_dict, __pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SequentialDataset", (PyObject *)&__pyx_type_7sklearn_5utils_11seq_dataset_SequentialDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset = &__pyx_type_7sklearn_5utils_11seq_dataset_SequentialDataset; __pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset = &__pyx_vtable_7sklearn_5utils_11seq_dataset_ArrayDataset; __pyx_vtable_7sklearn_5utils_11seq_dataset_ArrayDataset.__pyx_base = *__pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset; __pyx_vtable_7sklearn_5utils_11seq_dataset_ArrayDataset.__pyx_base.next = (void (*)(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE **, __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER **, int *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *))__pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_next; __pyx_vtable_7sklearn_5utils_11seq_dataset_ArrayDataset.__pyx_base.shuffle = (void (*)(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *, PyObject *))__pyx_f_7sklearn_5utils_11seq_dataset_12ArrayDataset_shuffle; __pyx_type_7sklearn_5utils_11seq_dataset_ArrayDataset.tp_base = __pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset; - if (PyType_Ready(&__pyx_type_7sklearn_5utils_11seq_dataset_ArrayDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_11seq_dataset_ArrayDataset.tp_dict, __pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ArrayDataset", (PyObject *)&__pyx_type_7sklearn_5utils_11seq_dataset_ArrayDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5utils_11seq_dataset_ArrayDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_11seq_dataset_ArrayDataset.tp_dict, __pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ArrayDataset", (PyObject *)&__pyx_type_7sklearn_5utils_11seq_dataset_ArrayDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset = &__pyx_type_7sklearn_5utils_11seq_dataset_ArrayDataset; __pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset = &__pyx_vtable_7sklearn_5utils_11seq_dataset_CSRDataset; __pyx_vtable_7sklearn_5utils_11seq_dataset_CSRDataset.__pyx_base = *__pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset; __pyx_vtable_7sklearn_5utils_11seq_dataset_CSRDataset.__pyx_base.next = (void (*)(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE **, __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER **, int *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *))__pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_next; __pyx_vtable_7sklearn_5utils_11seq_dataset_CSRDataset.__pyx_base.shuffle = (void (*)(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *, PyObject *))__pyx_f_7sklearn_5utils_11seq_dataset_10CSRDataset_shuffle; __pyx_type_7sklearn_5utils_11seq_dataset_CSRDataset.tp_base = __pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset; - if (PyType_Ready(&__pyx_type_7sklearn_5utils_11seq_dataset_CSRDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_11seq_dataset_CSRDataset.tp_dict, __pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "CSRDataset", (PyObject *)&__pyx_type_7sklearn_5utils_11seq_dataset_CSRDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5utils_11seq_dataset_CSRDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_11seq_dataset_CSRDataset.tp_dict, __pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "CSRDataset", (PyObject *)&__pyx_type_7sklearn_5utils_11seq_dataset_CSRDataset) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset = &__pyx_type_7sklearn_5utils_11seq_dataset_CSRDataset; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -5245,6 +5271,15 @@ PyMODINIT_FUNC PyInit_seq_dataset(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* "sklearn/utils/seq_dataset.pyx":15 + * cimport cython + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + /* "sklearn/utils/seq_dataset.pyx":1 * # encoding: utf-8 # <<<<<<<<<<<<<< * # cython: cdivision=True @@ -6271,8 +6306,10 @@ static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, trav PyTypeObject* type = Py_TYPE(obj); while (type && type->tp_traverse != current_tp_traverse) type = type->tp_base; - if (type && type->tp_base && type->tp_base->tp_traverse) - return type->tp_base->tp_traverse(obj, v, a); + while (type && type->tp_traverse == current_tp_traverse) + type = type->tp_base; + if (type && type->tp_traverse) + return type->tp_traverse(obj, v, a); return 0; } @@ -6280,8 +6317,10 @@ static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) { PyTypeObject* type = Py_TYPE(obj); while (type && type->tp_clear != current_tp_clear) type = type->tp_base; - if (type && type->tp_base && type->tp_base->tp_clear) - type->tp_base->tp_clear(obj); + while (type && type->tp_clear == current_tp_clear) + type = type->tp_base; + if (type && type->tp_clear) + type->tp_clear(obj); } #if PY_MAJOR_VERSION < 3 diff --git a/sklearn/utils/seq_dataset.pyx b/sklearn/utils/seq_dataset.pyx index 0b52222dd4ca9..0438784440622 100644 --- a/sklearn/utils/seq_dataset.pyx +++ b/sklearn/utils/seq_dataset.pyx @@ -12,6 +12,8 @@ import numpy as np cimport numpy as np cimport cython +np.import_array() + cdef class SequentialDataset: """Base class for datasets with sequential data access. """ diff --git a/sklearn/utils/sparsefuncs.c b/sklearn/utils/sparsefuncs.c index 43d538a4afe78..8d7313476d4e5 100644 --- a/sklearn/utils/sparsefuncs.c +++ b/sklearn/utils/sparsefuncs.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Mon May 7 11:30:13 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:51:06 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #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 PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #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) #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) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 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_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])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -232,11 +251,11 @@ #include #define __PYX_HAVE__sklearn__utils__sparsefuncs #define __PYX_HAVE_API__sklearn__utils__sparsefuncs +#include "math.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#include "math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -267,7 +286,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -291,8 +310,12 @@ 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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -317,7 +340,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -327,7 +349,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -335,18 +356,54 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "sparsefuncs.pyx", "numpy.pxd", + "type.pxd", }; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + -/* "numpy.pxd":719 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -355,7 +412,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -364,7 +421,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -373,7 +430,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -382,7 +439,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -391,7 +448,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -400,7 +457,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -409,7 +466,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -418,7 +475,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -427,7 +484,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -436,7 +493,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.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 # <<<<<<<<<<<<<< @@ -445,7 +502,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -454,7 +511,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -463,7 +520,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -472,7 +529,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -481,7 +538,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -490,7 +547,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -499,7 +556,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -508,7 +565,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -517,7 +574,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -526,7 +583,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -535,15 +592,14 @@ typedef npy_double __pyx_t_5numpy_double_t; */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* "sklearn/utils/sparsefuncs.pyx":16 - * double sqrt(double f) +/* "sklearn/utils/sparsefuncs.pyx":15 + * * * ctypedef np.float64_t DOUBLE # <<<<<<<<<<<<<< * * @cython.boundscheck(False) */ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -564,9 +620,10 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE; typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -575,7 +632,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -584,7 +641,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -593,7 +650,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -601,12 +658,9 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -619,8 +673,21 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -631,7 +698,7 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -642,10 +709,11 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; @@ -653,104 +721,95 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j Py_DECREF(j); return r; } - - #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - - #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { /* inlined PySequence_GetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } + return m->sq_item(o, i); + } } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); } - return r; +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) #define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_SetItemInt_Fast(o, i, v) : \ __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) - static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; @@ -758,20 +817,38 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb Py_DECREF(j); return r; } - static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { /* inlined PySequence_SetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } + return m->sq_ass_item(o, i, v); + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif return PySequence_SetItem(o, i, v); - else { - PyObject *j = PyInt_FromSsize_t(i); - return __Pyx_SetItemInt_Generic(o, j, v); } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ @@ -782,33 +859,51 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static 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, const char *name, int exact); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + #if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); #else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release #endif -Py_ssize_t __Pyx_zeros[] = {0}; -Py_ssize_t __Pyx_minusones[] = {-1}; + + 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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ @@ -824,7 +919,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -945,15 +1039,40 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject * static int __Pyx_check_binary_version(void); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'libc.math' */ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -962,6 +1081,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -972,22 +1096,13 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ - -/* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ /* Module declarations from 'sklearn.utils.sparsefuncs' */ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE = { "DOUBLE", NULL, sizeof(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE = { "DOUBLE", NULL, sizeof(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE), { 0 }, 0, 'R', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 }; #define __Pyx_MODULE_NAME "sklearn.utils.sparsefuncs" int __pyx_module_is_main_sklearn__utils__sparsefuncs = 0; @@ -997,9 +1112,18 @@ static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4inplace_csr_row_normalize_l2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_6inplace_csr_column_scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyArrayObject *__pyx_v_scale); /* proto */ +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_8csc_mean_variance_axis0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_10inplace_csc_column_scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyArrayObject *__pyx_v_scale); /* proto */ +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_12mean_variance_axis0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "csr_mean_variance_axis0"; static char __pyx_k_2[] = "csc_mean_variance_axis0"; -static char __pyx_k_3[] = "Unsupported matrix type. Expected a CSR or CSC sparse matrix."; +static char __pyx_k_3[] = "Unsupported type; expected a CSR or CSC sparse matrix."; static char __pyx_k_5[] = "ndarray is not C contiguous"; static char __pyx_k_7[] = "ndarray is not Fortran contiguous"; static char __pyx_k_9[] = "Non-native byte order not supported"; @@ -1008,11 +1132,12 @@ static char __pyx_k_12[] = "Format string allocated too short, see comment in nu static char __pyx_k_15[] = "Format string allocated too short."; static char __pyx_k_17[] = "scipy.sparse"; static char __pyx_k_18[] = "*"; -static char __pyx_k_19[] = "sklearn.utils.sparsefuncs"; -static char __pyx_k_20[] = "inplace_csr_row_normalize_l1"; -static char __pyx_k_21[] = "inplace_csr_row_normalize_l2"; -static char __pyx_k_22[] = "inplace_csr_column_scale"; -static char __pyx_k_23[] = "inplace_csc_column_scale"; +static char __pyx_k_21[] = "/scratch/apps/src/scikit-learn/sklearn/utils/sparsefuncs.pyx"; +static char __pyx_k_22[] = "sklearn.utils.sparsefuncs"; +static char __pyx_k_25[] = "inplace_csr_row_normalize_l1"; +static char __pyx_k_28[] = "inplace_csr_row_normalize_l2"; +static char __pyx_k_31[] = "inplace_csr_column_scale"; +static char __pyx_k_36[] = "inplace_csc_column_scale"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -1026,30 +1151,43 @@ 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__j[] = "j"; 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__np[] = "np"; +static char __pyx_k__nz[] = "nz"; static char __pyx_k__sp[] = "sp"; +static char __pyx_k__ind[] = "ind"; static char __pyx_k__axis[] = "axis"; static char __pyx_k__data[] = "data"; +static char __pyx_k__diff[] = "diff"; static char __pyx_k__mean[] = "mean"; +static char __pyx_k__sum_[] = "sum_"; +static char __pyx_k__means[] = "means"; 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__X_data[] = "X_data"; +static char __pyx_k__counts[] = "counts"; static char __pyx_k__indptr[] = "indptr"; static char __pyx_k__xrange[] = "xrange"; static char __pyx_k__asarray[] = "asarray"; static char __pyx_k__indices[] = "indices"; +static char __pyx_k__X_indptr[] = "X_indptr"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__TypeError[] = "TypeError"; +static char __pyx_k__X_indices[] = "X_indices"; +static char __pyx_k__n_samples[] = "n_samples"; +static char __pyx_k__variances[] = "variances"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__csc_matrix[] = "csc_matrix"; static char __pyx_k__csr_matrix[] = "csr_matrix"; +static char __pyx_k__n_features[] = "n_features"; static char __pyx_k__zeros_like[] = "zeros_like"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__mean_variance_axis0[] = "mean_variance_axis0"; @@ -1059,13 +1197,14 @@ static PyObject *__pyx_kp_u_12; static PyObject *__pyx_kp_u_15; static PyObject *__pyx_n_s_17; static PyObject *__pyx_n_s_18; -static PyObject *__pyx_n_s_19; static PyObject *__pyx_n_s_2; -static PyObject *__pyx_n_s_20; -static PyObject *__pyx_n_s_21; +static PyObject *__pyx_kp_s_21; static PyObject *__pyx_n_s_22; -static PyObject *__pyx_n_s_23; +static PyObject *__pyx_n_s_25; +static PyObject *__pyx_n_s_28; static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_n_s_31; +static PyObject *__pyx_n_s_36; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_9; @@ -1073,23 +1212,37 @@ 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__X_data; +static PyObject *__pyx_n_s__X_indices; +static PyObject *__pyx_n_s__X_indptr; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__asarray; static PyObject *__pyx_n_s__axis; +static PyObject *__pyx_n_s__counts; static PyObject *__pyx_n_s__csc_matrix; static PyObject *__pyx_n_s__csr_matrix; static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__diff; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__ind; static PyObject *__pyx_n_s__indices; static PyObject *__pyx_n_s__indptr; +static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__mean; static PyObject *__pyx_n_s__mean_variance_axis0; +static PyObject *__pyx_n_s__means; +static PyObject *__pyx_n_s__n_features; +static PyObject *__pyx_n_s__n_samples; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__nz; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__scale; static PyObject *__pyx_n_s__shape; static PyObject *__pyx_n_s__sp; +static PyObject *__pyx_n_s__sum_; +static PyObject *__pyx_n_s__variances; static PyObject *__pyx_n_s__xrange; static PyObject *__pyx_n_s__zeros_like; static PyObject *__pyx_int_0; @@ -1103,8 +1256,35 @@ static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_13; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_16; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_29; +static PyObject *__pyx_k_tuple_32; +static PyObject *__pyx_k_tuple_34; +static PyObject *__pyx_k_tuple_37; +static PyObject *__pyx_k_codeobj_20; +static PyObject *__pyx_k_codeobj_24; +static PyObject *__pyx_k_codeobj_27; +static PyObject *__pyx_k_codeobj_30; +static PyObject *__pyx_k_codeobj_33; +static PyObject *__pyx_k_codeobj_35; +static PyObject *__pyx_k_codeobj_38; + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_1csr_mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0[] = "Compute mean and variance along axis 0 on a CSR matrix\n\n Parameters\n ----------\n X: CSR sparse matrix, shape (n_samples, n_features)\n Input data.\n\n Returns\n -------\n\n means: float array with shape (n_features,)\n Feature-wise means\n\n variances: float array with shape (n_features,)\n Feature-wise variances\n\n "; +static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_1csr_mean_variance_axis0 = {__Pyx_NAMESTR("csr_mean_variance_axis0"), (PyCFunction)__pyx_pw_7sklearn_5utils_11sparsefuncs_1csr_mean_variance_axis0, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0)}; +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_1csr_mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("csr_mean_variance_axis0 (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0(__pyx_self, ((PyObject *)__pyx_v_X)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* "sklearn/utils/sparsefuncs.pyx":21 +/* "sklearn/utils/sparsefuncs.pyx":20 * @cython.wraparound(False) * @cython.cdivision(True) * def csr_mean_variance_axis0(X): # <<<<<<<<<<<<<< @@ -1112,12 +1292,9 @@ static PyObject *__pyx_k_tuple_16; * */ -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0[] = "Compute mean and variance along axis 0 on a CSR matrix\n\n Parameters\n ----------\n X: CSR sparse matrix, shape (n_samples, n_features)\n Input data.\n\n Returns\n -------\n\n means: float array with shape (n_features,)\n Feature-wise means\n\n variances: float array with shape (n_features,)\n Feature-wise variances\n\n "; -static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0 = {__Pyx_NAMESTR("csr_mean_variance_axis0"), (PyCFunction)__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0)}; -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) { unsigned int __pyx_v_n_samples; - unsigned int __pyx_v_n_features; + CYTHON_UNUSED unsigned int __pyx_v_n_features; PyArrayObject *__pyx_v_X_data = 0; PyArrayObject *__pyx_v_X_indices = 0; PyArrayObject *__pyx_v_X_indptr = 0; @@ -1129,21 +1306,16 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( PyArrayObject *__pyx_v_variances = 0; PyObject *__pyx_v_counts = NULL; PyObject *__pyx_v_nz = NULL; - Py_buffer __pyx_bstruct_means; - Py_ssize_t __pyx_bstride_0_means = 0; - Py_ssize_t __pyx_bshape_0_means = 0; - Py_buffer __pyx_bstruct_variances; - Py_ssize_t __pyx_bstride_0_variances = 0; - Py_ssize_t __pyx_bshape_0_variances = 0; - Py_buffer __pyx_bstruct_X_indices; - Py_ssize_t __pyx_bstride_0_X_indices = 0; - Py_ssize_t __pyx_bshape_0_X_indices = 0; - Py_buffer __pyx_bstruct_X_indptr; - Py_ssize_t __pyx_bstride_0_X_indptr = 0; - Py_ssize_t __pyx_bshape_0_X_indptr = 0; - Py_buffer __pyx_bstruct_X_data; - Py_ssize_t __pyx_bstride_0_X_data = 0; - Py_ssize_t __pyx_bshape_0_X_data = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_data; + __Pyx_Buffer __pyx_pybuffer_X_data; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indices; + __Pyx_Buffer __pyx_pybuffer_X_indices; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indptr; + __Pyx_Buffer __pyx_pybuffer_X_indptr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_means; + __Pyx_Buffer __pyx_pybuffer_means; + __Pyx_LocalBuf_ND __pyx_pybuffernd_variances; + __Pyx_Buffer __pyx_pybuffer_variances; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1172,227 +1344,236 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("csr_mean_variance_axis0"); - __pyx_self = __pyx_self; - __pyx_bstruct_X_data.buf = NULL; - __pyx_bstruct_X_indices.buf = NULL; - __pyx_bstruct_X_indptr.buf = NULL; - __pyx_bstruct_means.buf = NULL; - __pyx_bstruct_variances.buf = NULL; - - /* "sklearn/utils/sparsefuncs.pyx":39 + __Pyx_RefNannySetupContext("csr_mean_variance_axis0", 0); + __pyx_pybuffer_X_data.pybuffer.buf = NULL; + __pyx_pybuffer_X_data.refcount = 0; + __pyx_pybuffernd_X_data.data = NULL; + __pyx_pybuffernd_X_data.rcbuffer = &__pyx_pybuffer_X_data; + __pyx_pybuffer_X_indices.pybuffer.buf = NULL; + __pyx_pybuffer_X_indices.refcount = 0; + __pyx_pybuffernd_X_indices.data = NULL; + __pyx_pybuffernd_X_indices.rcbuffer = &__pyx_pybuffer_X_indices; + __pyx_pybuffer_X_indptr.pybuffer.buf = NULL; + __pyx_pybuffer_X_indptr.refcount = 0; + __pyx_pybuffernd_X_indptr.data = NULL; + __pyx_pybuffernd_X_indptr.rcbuffer = &__pyx_pybuffer_X_indptr; + __pyx_pybuffer_means.pybuffer.buf = NULL; + __pyx_pybuffer_means.refcount = 0; + __pyx_pybuffernd_means.data = NULL; + __pyx_pybuffernd_means.rcbuffer = &__pyx_pybuffer_means; + __pyx_pybuffer_variances.pybuffer.buf = NULL; + __pyx_pybuffer_variances.refcount = 0; + __pyx_pybuffernd_variances.data = NULL; + __pyx_pybuffernd_variances.rcbuffer = &__pyx_pybuffer_variances; + + /* "sklearn/utils/sparsefuncs.pyx":38 * * """ * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< * cdef unsigned int n_features = X.shape[1] * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); 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_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__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(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_n_samples = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":40 + /* "sklearn/utils/sparsefuncs.pyx":39 * """ * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); 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_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__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(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n_features = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":42 + /* "sklearn/utils/sparsefuncs.pyx":41 * cdef unsigned int n_features = X.shape[1] * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); 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); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __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 = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_data, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_data.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_data = __pyx_bstruct_X_data.strides[0]; - __pyx_bshape_0_X_data = __pyx_bstruct_X_data.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; } } __pyx_t_4 = 0; __pyx_v_X_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":43 + /* "sklearn/utils/sparsefuncs.pyx":42 * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __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 = 43; __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 = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indices = __pyx_bstruct_X_indices.strides[0]; - __pyx_bshape_0_X_indices = __pyx_bstruct_X_indices.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; } } __pyx_t_5 = 0; __pyx_v_X_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":44 + /* "sklearn/utils/sparsefuncs.pyx":43 * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr # <<<<<<<<<<<<<< * * cdef unsigned int i */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __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 = 44; __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 = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indptr.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indptr = __pyx_bstruct_X_indptr.strides[0]; - __pyx_bshape_0_X_indptr = __pyx_bstruct_X_indptr.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; } } __pyx_t_6 = 0; __pyx_v_X_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":52 + /* "sklearn/utils/sparsefuncs.pyx":51 * * # means[j] contains the mean of feature j * cdef np.ndarray[DOUBLE, ndim=1] means = np.asarray(X.mean(axis=0))[0] # <<<<<<<<<<<<<< * * # variances[j] contains the variance of feature j */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__mean); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__mean); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_means, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_means = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_means.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_means = __pyx_bstruct_means.strides[0]; - __pyx_bshape_0_means = __pyx_bstruct_means.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_means = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_means.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_means.diminfo[0].strides = __pyx_pybuffernd_means.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_means.diminfo[0].shape = __pyx_pybuffernd_means.rcbuffer->pybuffer.shape[0]; } } __pyx_t_9 = 0; __pyx_v_means = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/utils/sparsefuncs.pyx":55 + /* "sklearn/utils/sparsefuncs.pyx":54 * * # variances[j] contains the variance of feature j * cdef np.ndarray[DOUBLE, ndim=1] variances = np.zeros_like(means) # <<<<<<<<<<<<<< * * # counts[j] contains the number of samples where feature j is non-zero */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_v_means)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_means)); __Pyx_GIVEREF(((PyObject *)__pyx_v_means)); - __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_variances = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_variances.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_variances = __pyx_bstruct_variances.strides[0]; - __pyx_bshape_0_variances = __pyx_bstruct_variances.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_variances = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_variances.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_variances.diminfo[0].strides = __pyx_pybuffernd_variances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variances.diminfo[0].shape = __pyx_pybuffernd_variances.rcbuffer->pybuffer.shape[0]; } } __pyx_t_10 = 0; __pyx_v_variances = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":58 + /* "sklearn/utils/sparsefuncs.pyx":57 * * # counts[j] contains the number of samples where feature j is non-zero * counts = np.zeros_like(means) # <<<<<<<<<<<<<< * * for i in xrange(n_samples): */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __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 = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_means)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_means)); __Pyx_GIVEREF(((PyObject *)__pyx_v_means)); - __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_counts = __pyx_t_8; __pyx_t_8 = 0; - /* "sklearn/utils/sparsefuncs.pyx":60 + /* "sklearn/utils/sparsefuncs.pyx":59 * counts = np.zeros_like(means) * * for i in xrange(n_samples): # <<<<<<<<<<<<<< @@ -1403,7 +1584,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_3; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "sklearn/utils/sparsefuncs.pyx":61 + /* "sklearn/utils/sparsefuncs.pyx":60 * * for i in xrange(n_samples): * for j in xrange(X_indptr[i], X_indptr[i + 1]): # <<<<<<<<<<<<<< @@ -1411,12 +1592,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( * diff = X_data[j] - means[ind] */ __pyx_t_12 = (__pyx_v_i + 1); - __pyx_t_13 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_12, __pyx_bstride_0_X_indptr)); + __pyx_t_13 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_14 = __pyx_v_i; - for (__pyx_t_15 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_14, __pyx_bstride_0_X_indptr)); __pyx_t_15 < __pyx_t_13; __pyx_t_15+=1) { + for (__pyx_t_15 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_15 < __pyx_t_13; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; - /* "sklearn/utils/sparsefuncs.pyx":62 + /* "sklearn/utils/sparsefuncs.pyx":61 * for i in xrange(n_samples): * for j in xrange(X_indptr[i], X_indptr[i + 1]): * ind = X_indices[j] # <<<<<<<<<<<<<< @@ -1424,9 +1605,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( * variances[ind] += diff * diff */ __pyx_t_16 = __pyx_v_j; - __pyx_v_ind = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indices.buf, __pyx_t_16, __pyx_bstride_0_X_indices)); + __pyx_v_ind = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_X_indices.diminfo[0].strides)); - /* "sklearn/utils/sparsefuncs.pyx":63 + /* "sklearn/utils/sparsefuncs.pyx":62 * for j in xrange(X_indptr[i], X_indptr[i + 1]): * ind = X_indices[j] * diff = X_data[j] - means[ind] # <<<<<<<<<<<<<< @@ -1435,9 +1616,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( */ __pyx_t_17 = __pyx_v_j; __pyx_t_18 = __pyx_v_ind; - __pyx_v_diff = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_17, __pyx_bstride_0_X_data)) - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_means.buf, __pyx_t_18, __pyx_bstride_0_means))); + __pyx_v_diff = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_X_data.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_means.diminfo[0].strides))); - /* "sklearn/utils/sparsefuncs.pyx":64 + /* "sklearn/utils/sparsefuncs.pyx":63 * ind = X_indices[j] * diff = X_data[j] - means[ind] * variances[ind] += diff * diff # <<<<<<<<<<<<<< @@ -1445,9 +1626,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( * */ __pyx_t_19 = __pyx_v_ind; - *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_variances.buf, __pyx_t_19, __pyx_bstride_0_variances) += (__pyx_v_diff * __pyx_v_diff); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_variances.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_variances.diminfo[0].strides) += (__pyx_v_diff * __pyx_v_diff); - /* "sklearn/utils/sparsefuncs.pyx":65 + /* "sklearn/utils/sparsefuncs.pyx":64 * diff = X_data[j] - means[ind] * variances[ind] += diff * diff * counts[ind] += 1 # <<<<<<<<<<<<<< @@ -1455,107 +1636,105 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( * nz = n_samples - counts */ __pyx_t_20 = __pyx_v_ind; - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_counts, __pyx_t_20, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_counts, __pyx_t_20, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__Pyx_SetItemInt(__pyx_v_counts, __pyx_t_20, __pyx_t_2, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_counts, __pyx_t_20, __pyx_t_2, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } } - /* "sklearn/utils/sparsefuncs.pyx":67 + /* "sklearn/utils/sparsefuncs.pyx":66 * counts[ind] += 1 * * nz = n_samples - counts # <<<<<<<<<<<<<< * variances += nz * means ** 2 * variances /= n_samples */ - __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_v_counts); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_v_counts); 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_2); __pyx_t_2 = 0; __pyx_v_nz = __pyx_t_8; __pyx_t_8 = 0; - /* "sklearn/utils/sparsefuncs.pyx":68 + /* "sklearn/utils/sparsefuncs.pyx":67 * * nz = n_samples - counts * variances += nz * means ** 2 # <<<<<<<<<<<<<< * variances /= n_samples * */ - __pyx_t_8 = PyNumber_Power(((PyObject *)__pyx_v_means), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Power(((PyObject *)__pyx_v_means), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyNumber_Multiply(__pyx_v_nz, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_v_nz, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_variances), __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_variances), __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_variances); - __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variances.rcbuffer->pybuffer); + __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_13 < 0)) { PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_v_variances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_v_variances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23); } } - __pyx_bstride_0_variances = __pyx_bstruct_variances.strides[0]; - __pyx_bshape_0_variances = __pyx_bstruct_variances.shape[0]; - if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_variances.diminfo[0].strides = __pyx_pybuffernd_variances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variances.diminfo[0].shape = __pyx_pybuffernd_variances.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_variances)); __pyx_v_variances = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; - /* "sklearn/utils/sparsefuncs.pyx":69 + /* "sklearn/utils/sparsefuncs.pyx":68 * nz = n_samples - counts * variances += nz * means ** 2 * variances /= n_samples # <<<<<<<<<<<<<< * * return means, variances */ - __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_variances), __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_variances), __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_variances); - __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variances.rcbuffer->pybuffer); + __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_13 < 0)) { PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_v_variances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_v_variances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21); } } - __pyx_bstride_0_variances = __pyx_bstruct_variances.strides[0]; - __pyx_bshape_0_variances = __pyx_bstruct_variances.shape[0]; - if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_variances.diminfo[0].strides = __pyx_pybuffernd_variances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variances.diminfo[0].shape = __pyx_pybuffernd_variances.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_variances)); __pyx_v_variances = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":71 + /* "sklearn/utils/sparsefuncs.pyx":70 * variances /= n_samples * * return means, variances # <<<<<<<<<<<<<< @@ -1563,8 +1742,8 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( * @cython.boundscheck(False) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_means)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_means)); __Pyx_GIVEREF(((PyObject *)__pyx_v_means)); @@ -1584,21 +1763,21 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( __Pyx_XDECREF(__pyx_t_8); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_means); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_variances); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_means.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variances.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.utils.sparsefuncs.csr_mean_variance_axis0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_means); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_variances); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_means.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variances.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_X_data); __Pyx_XDECREF((PyObject *)__pyx_v_X_indices); @@ -1612,7 +1791,20 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( return __pyx_r; } -/* "sklearn/utils/sparsefuncs.pyx":76 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_3inplace_csr_row_normalize_l1(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l1[] = "Inplace row normalize using the l1 norm"; +static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_3inplace_csr_row_normalize_l1 = {__Pyx_NAMESTR("inplace_csr_row_normalize_l1"), (PyCFunction)__pyx_pw_7sklearn_5utils_11sparsefuncs_3inplace_csr_row_normalize_l1, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l1)}; +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_3inplace_csr_row_normalize_l1(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("inplace_csr_row_normalize_l1 (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l1(__pyx_self, ((PyObject *)__pyx_v_X)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/sparsefuncs.pyx":75 * @cython.wraparound(False) * @cython.cdivision(True) * def inplace_csr_row_normalize_l1(X): # <<<<<<<<<<<<<< @@ -1620,27 +1812,21 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0( * cdef unsigned int n_samples = X.shape[0] */ -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normalize_l1(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normalize_l1[] = "Inplace row normalize using the l1 norm"; -static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normalize_l1 = {__Pyx_NAMESTR("inplace_csr_row_normalize_l1"), (PyCFunction)__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normalize_l1, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normalize_l1)}; -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normalize_l1(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) { unsigned int __pyx_v_n_samples; - unsigned int __pyx_v_n_features; + CYTHON_UNUSED unsigned int __pyx_v_n_features; PyArrayObject *__pyx_v_X_data = 0; - PyArrayObject *__pyx_v_X_indices = 0; + CYTHON_UNUSED PyArrayObject *__pyx_v_X_indices = 0; PyArrayObject *__pyx_v_X_indptr = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; double __pyx_v_sum_; - Py_buffer __pyx_bstruct_X_indices; - Py_ssize_t __pyx_bstride_0_X_indices = 0; - Py_ssize_t __pyx_bshape_0_X_indices = 0; - Py_buffer __pyx_bstruct_X_indptr; - Py_ssize_t __pyx_bstride_0_X_indptr = 0; - Py_ssize_t __pyx_bshape_0_X_indptr = 0; - Py_buffer __pyx_bstruct_X_data; - Py_ssize_t __pyx_bstride_0_X_data = 0; - Py_ssize_t __pyx_bshape_0_X_data = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_data; + __Pyx_Buffer __pyx_pybuffer_X_data; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indices; + __Pyx_Buffer __pyx_pybuffer_X_indices; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indptr; + __Pyx_Buffer __pyx_pybuffer_X_indptr; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1662,117 +1848,122 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("inplace_csr_row_normalize_l1"); - __pyx_self = __pyx_self; - __pyx_bstruct_X_data.buf = NULL; - __pyx_bstruct_X_indices.buf = NULL; - __pyx_bstruct_X_indptr.buf = NULL; - - /* "sklearn/utils/sparsefuncs.pyx":78 + __Pyx_RefNannySetupContext("inplace_csr_row_normalize_l1", 0); + __pyx_pybuffer_X_data.pybuffer.buf = NULL; + __pyx_pybuffer_X_data.refcount = 0; + __pyx_pybuffernd_X_data.data = NULL; + __pyx_pybuffernd_X_data.rcbuffer = &__pyx_pybuffer_X_data; + __pyx_pybuffer_X_indices.pybuffer.buf = NULL; + __pyx_pybuffer_X_indices.refcount = 0; + __pyx_pybuffernd_X_indices.data = NULL; + __pyx_pybuffernd_X_indices.rcbuffer = &__pyx_pybuffer_X_indices; + __pyx_pybuffer_X_indptr.pybuffer.buf = NULL; + __pyx_pybuffer_X_indptr.refcount = 0; + __pyx_pybuffernd_X_indptr.data = NULL; + __pyx_pybuffernd_X_indptr.rcbuffer = &__pyx_pybuffer_X_indptr; + + /* "sklearn/utils/sparsefuncs.pyx":77 * def inplace_csr_row_normalize_l1(X): * """Inplace row normalize using the l1 norm""" * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< * cdef unsigned int n_features = X.shape[1] * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __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_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_n_samples = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":79 + /* "sklearn/utils/sparsefuncs.pyx":78 * """Inplace row normalize using the l1 norm""" * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n_features = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":81 + /* "sklearn/utils/sparsefuncs.pyx":80 * cdef unsigned int n_features = X.shape[1] * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __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 = 81; __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 = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_data, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_data.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_data = __pyx_bstruct_X_data.strides[0]; - __pyx_bshape_0_X_data = __pyx_bstruct_X_data.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; } } __pyx_t_4 = 0; __pyx_v_X_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":82 + /* "sklearn/utils/sparsefuncs.pyx":81 * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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 = 82; __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indices = __pyx_bstruct_X_indices.strides[0]; - __pyx_bshape_0_X_indices = __pyx_bstruct_X_indices.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; } } __pyx_t_5 = 0; __pyx_v_X_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":83 + /* "sklearn/utils/sparsefuncs.pyx":82 * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr # <<<<<<<<<<<<<< * * # the column indices for row i are stored in: */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __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 = 83; __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 = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indptr.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indptr = __pyx_bstruct_X_indptr.strides[0]; - __pyx_bshape_0_X_indptr = __pyx_bstruct_X_indptr.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; } } __pyx_t_6 = 0; __pyx_v_X_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":93 + /* "sklearn/utils/sparsefuncs.pyx":92 * cdef double sum_ * * for i in xrange(n_samples): # <<<<<<<<<<<<<< @@ -1783,7 +1974,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "sklearn/utils/sparsefuncs.pyx":94 + /* "sklearn/utils/sparsefuncs.pyx":93 * * for i in xrange(n_samples): * sum_ = 0.0 # <<<<<<<<<<<<<< @@ -1792,7 +1983,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali */ __pyx_v_sum_ = 0.0; - /* "sklearn/utils/sparsefuncs.pyx":96 + /* "sklearn/utils/sparsefuncs.pyx":95 * sum_ = 0.0 * * for j in xrange(X_indptr[i], X_indptr[i + 1]): # <<<<<<<<<<<<<< @@ -1800,12 +1991,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali * */ __pyx_t_8 = (__pyx_v_i + 1); - __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_8, __pyx_bstride_0_X_indptr)); + __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_10 = __pyx_v_i; - for (__pyx_t_11 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_10, __pyx_bstride_0_X_indptr)); __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { + for (__pyx_t_11 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { __pyx_v_j = __pyx_t_11; - /* "sklearn/utils/sparsefuncs.pyx":97 + /* "sklearn/utils/sparsefuncs.pyx":96 * * for j in xrange(X_indptr[i], X_indptr[i + 1]): * sum_ += fabs(X_data[j]) # <<<<<<<<<<<<<< @@ -1813,10 +2004,10 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali * if sum_ == 0.0: */ __pyx_t_12 = __pyx_v_j; - __pyx_v_sum_ = (__pyx_v_sum_ + fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_12, __pyx_bstride_0_X_data)))); + __pyx_v_sum_ = (__pyx_v_sum_ + fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X_data.diminfo[0].strides)))); } - /* "sklearn/utils/sparsefuncs.pyx":99 + /* "sklearn/utils/sparsefuncs.pyx":98 * sum_ += fabs(X_data[j]) * * if sum_ == 0.0: # <<<<<<<<<<<<<< @@ -1826,19 +2017,19 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali __pyx_t_13 = (__pyx_v_sum_ == 0.0); if (__pyx_t_13) { - /* "sklearn/utils/sparsefuncs.pyx":102 + /* "sklearn/utils/sparsefuncs.pyx":101 * # do not normalize empty rows (can happen if CSR is not pruned * # correctly) * continue # <<<<<<<<<<<<<< * * for j in xrange(X_indptr[i], X_indptr[i + 1]): */ - goto __pyx_L5_continue; - goto __pyx_L9; + goto __pyx_L3_continue; + goto __pyx_L7; } - __pyx_L9:; + __pyx_L7:; - /* "sklearn/utils/sparsefuncs.pyx":104 + /* "sklearn/utils/sparsefuncs.pyx":103 * continue * * for j in xrange(X_indptr[i], X_indptr[i + 1]): # <<<<<<<<<<<<<< @@ -1846,12 +2037,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali * */ __pyx_t_14 = (__pyx_v_i + 1); - __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_14, __pyx_bstride_0_X_indptr)); + __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_11 = __pyx_v_i; - for (__pyx_t_15 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_11, __pyx_bstride_0_X_indptr)); __pyx_t_15 < __pyx_t_9; __pyx_t_15+=1) { + for (__pyx_t_15 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_15 < __pyx_t_9; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; - /* "sklearn/utils/sparsefuncs.pyx":105 + /* "sklearn/utils/sparsefuncs.pyx":104 * * for j in xrange(X_indptr[i], X_indptr[i + 1]): * X_data[j] /= sum_ # <<<<<<<<<<<<<< @@ -1859,9 +2050,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali * */ __pyx_t_16 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_16, __pyx_bstride_0_X_data) /= __pyx_v_sum_; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_X_data.diminfo[0].strides) /= __pyx_v_sum_; } - __pyx_L5_continue:; + __pyx_L3_continue:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -1871,17 +2062,17 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali __Pyx_XDECREF(__pyx_t_2); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.utils.sparsefuncs.inplace_csr_row_normalize_l1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_X_data); __Pyx_XDECREF((PyObject *)__pyx_v_X_indices); @@ -1891,7 +2082,20 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali return __pyx_r; } -/* "sklearn/utils/sparsefuncs.pyx":111 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_5inplace_csr_row_normalize_l2(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_7sklearn_5utils_11sparsefuncs_4inplace_csr_row_normalize_l2[] = "Inplace row normalize using the l2 norm"; +static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_5inplace_csr_row_normalize_l2 = {__Pyx_NAMESTR("inplace_csr_row_normalize_l2"), (PyCFunction)__pyx_pw_7sklearn_5utils_11sparsefuncs_5inplace_csr_row_normalize_l2, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_4inplace_csr_row_normalize_l2)}; +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_5inplace_csr_row_normalize_l2(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("inplace_csr_row_normalize_l2 (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_5utils_11sparsefuncs_4inplace_csr_row_normalize_l2(__pyx_self, ((PyObject *)__pyx_v_X)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/sparsefuncs.pyx":110 * @cython.wraparound(False) * @cython.cdivision(True) * def inplace_csr_row_normalize_l2(X): # <<<<<<<<<<<<<< @@ -1899,27 +2103,21 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normali * cdef unsigned int n_samples = X.shape[0] */ -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l2(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l2[] = "Inplace row normalize using the l2 norm"; -static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l2 = {__Pyx_NAMESTR("inplace_csr_row_normalize_l2"), (PyCFunction)__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l2, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l2)}; -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l2(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4inplace_csr_row_normalize_l2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) { unsigned int __pyx_v_n_samples; - unsigned int __pyx_v_n_features; + CYTHON_UNUSED unsigned int __pyx_v_n_features; PyArrayObject *__pyx_v_X_data = 0; - PyArrayObject *__pyx_v_X_indices = 0; + CYTHON_UNUSED PyArrayObject *__pyx_v_X_indices = 0; PyArrayObject *__pyx_v_X_indptr = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; double __pyx_v_sum_; - Py_buffer __pyx_bstruct_X_indices; - Py_ssize_t __pyx_bstride_0_X_indices = 0; - Py_ssize_t __pyx_bshape_0_X_indices = 0; - Py_buffer __pyx_bstruct_X_indptr; - Py_ssize_t __pyx_bstride_0_X_indptr = 0; - Py_ssize_t __pyx_bshape_0_X_indptr = 0; - Py_buffer __pyx_bstruct_X_data; - Py_ssize_t __pyx_bstride_0_X_data = 0; - Py_ssize_t __pyx_bshape_0_X_data = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_data; + __Pyx_Buffer __pyx_pybuffer_X_data; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indices; + __Pyx_Buffer __pyx_pybuffer_X_indices; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indptr; + __Pyx_Buffer __pyx_pybuffer_X_indptr; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1942,117 +2140,122 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("inplace_csr_row_normalize_l2"); - __pyx_self = __pyx_self; - __pyx_bstruct_X_data.buf = NULL; - __pyx_bstruct_X_indices.buf = NULL; - __pyx_bstruct_X_indptr.buf = NULL; - - /* "sklearn/utils/sparsefuncs.pyx":113 + __Pyx_RefNannySetupContext("inplace_csr_row_normalize_l2", 0); + __pyx_pybuffer_X_data.pybuffer.buf = NULL; + __pyx_pybuffer_X_data.refcount = 0; + __pyx_pybuffernd_X_data.data = NULL; + __pyx_pybuffernd_X_data.rcbuffer = &__pyx_pybuffer_X_data; + __pyx_pybuffer_X_indices.pybuffer.buf = NULL; + __pyx_pybuffer_X_indices.refcount = 0; + __pyx_pybuffernd_X_indices.data = NULL; + __pyx_pybuffernd_X_indices.rcbuffer = &__pyx_pybuffer_X_indices; + __pyx_pybuffer_X_indptr.pybuffer.buf = NULL; + __pyx_pybuffer_X_indptr.refcount = 0; + __pyx_pybuffernd_X_indptr.data = NULL; + __pyx_pybuffernd_X_indptr.rcbuffer = &__pyx_pybuffer_X_indptr; + + /* "sklearn/utils/sparsefuncs.pyx":112 * def inplace_csr_row_normalize_l2(X): * """Inplace row normalize using the l2 norm""" * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< * cdef unsigned int n_features = X.shape[1] * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __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_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_n_samples = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":114 + /* "sklearn/utils/sparsefuncs.pyx":113 * """Inplace row normalize using the l2 norm""" * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n_features = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":116 + /* "sklearn/utils/sparsefuncs.pyx":115 * cdef unsigned int n_features = X.shape[1] * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __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 = 116; __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_data, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_data.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_data = __pyx_bstruct_X_data.strides[0]; - __pyx_bshape_0_X_data = __pyx_bstruct_X_data.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; } } __pyx_t_4 = 0; __pyx_v_X_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":117 + /* "sklearn/utils/sparsefuncs.pyx":116 * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __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 = 117; __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 = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indices = __pyx_bstruct_X_indices.strides[0]; - __pyx_bshape_0_X_indices = __pyx_bstruct_X_indices.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; } } __pyx_t_5 = 0; __pyx_v_X_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":118 + /* "sklearn/utils/sparsefuncs.pyx":117 * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr # <<<<<<<<<<<<<< * * cdef unsigned int i */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __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 = 118; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indptr.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indptr = __pyx_bstruct_X_indptr.strides[0]; - __pyx_bshape_0_X_indptr = __pyx_bstruct_X_indptr.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; } } __pyx_t_6 = 0; __pyx_v_X_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":124 + /* "sklearn/utils/sparsefuncs.pyx":123 * cdef double sum_ * * for i in xrange(n_samples): # <<<<<<<<<<<<<< @@ -2063,7 +2266,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "sklearn/utils/sparsefuncs.pyx":125 + /* "sklearn/utils/sparsefuncs.pyx":124 * * for i in xrange(n_samples): * sum_ = 0.0 # <<<<<<<<<<<<<< @@ -2072,7 +2275,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali */ __pyx_v_sum_ = 0.0; - /* "sklearn/utils/sparsefuncs.pyx":127 + /* "sklearn/utils/sparsefuncs.pyx":126 * sum_ = 0.0 * * for j in xrange(X_indptr[i], X_indptr[i + 1]): # <<<<<<<<<<<<<< @@ -2080,12 +2283,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali * */ __pyx_t_8 = (__pyx_v_i + 1); - __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_8, __pyx_bstride_0_X_indptr)); + __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_10 = __pyx_v_i; - for (__pyx_t_11 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_10, __pyx_bstride_0_X_indptr)); __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { + for (__pyx_t_11 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { __pyx_v_j = __pyx_t_11; - /* "sklearn/utils/sparsefuncs.pyx":128 + /* "sklearn/utils/sparsefuncs.pyx":127 * * for j in xrange(X_indptr[i], X_indptr[i + 1]): * sum_ += (X_data[j] * X_data[j]) # <<<<<<<<<<<<<< @@ -2094,10 +2297,10 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali */ __pyx_t_12 = __pyx_v_j; __pyx_t_13 = __pyx_v_j; - __pyx_v_sum_ = (__pyx_v_sum_ + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_12, __pyx_bstride_0_X_data)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_13, __pyx_bstride_0_X_data)))); + __pyx_v_sum_ = (__pyx_v_sum_ + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X_data.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_X_data.diminfo[0].strides)))); } - /* "sklearn/utils/sparsefuncs.pyx":130 + /* "sklearn/utils/sparsefuncs.pyx":129 * sum_ += (X_data[j] * X_data[j]) * * if sum_ == 0.0: # <<<<<<<<<<<<<< @@ -2107,19 +2310,19 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali __pyx_t_14 = (__pyx_v_sum_ == 0.0); if (__pyx_t_14) { - /* "sklearn/utils/sparsefuncs.pyx":133 + /* "sklearn/utils/sparsefuncs.pyx":132 * # do not normalize empty rows (can happen if CSR is not pruned * # correctly) * continue # <<<<<<<<<<<<<< * * sum_ = sqrt(sum_) */ - goto __pyx_L5_continue; - goto __pyx_L9; + goto __pyx_L3_continue; + goto __pyx_L7; } - __pyx_L9:; + __pyx_L7:; - /* "sklearn/utils/sparsefuncs.pyx":135 + /* "sklearn/utils/sparsefuncs.pyx":134 * continue * * sum_ = sqrt(sum_) # <<<<<<<<<<<<<< @@ -2128,7 +2331,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali */ __pyx_v_sum_ = sqrt(__pyx_v_sum_); - /* "sklearn/utils/sparsefuncs.pyx":137 + /* "sklearn/utils/sparsefuncs.pyx":136 * sum_ = sqrt(sum_) * * for j in xrange(X_indptr[i], X_indptr[i + 1]): # <<<<<<<<<<<<<< @@ -2136,12 +2339,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali * */ __pyx_t_15 = (__pyx_v_i + 1); - __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_15, __pyx_bstride_0_X_indptr)); + __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_11 = __pyx_v_i; - for (__pyx_t_16 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_11, __pyx_bstride_0_X_indptr)); __pyx_t_16 < __pyx_t_9; __pyx_t_16+=1) { + for (__pyx_t_16 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_16 < __pyx_t_9; __pyx_t_16+=1) { __pyx_v_j = __pyx_t_16; - /* "sklearn/utils/sparsefuncs.pyx":138 + /* "sklearn/utils/sparsefuncs.pyx":137 * * for j in xrange(X_indptr[i], X_indptr[i + 1]): * X_data[j] /= sum_ # <<<<<<<<<<<<<< @@ -2149,9 +2352,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali * */ __pyx_t_17 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_17, __pyx_bstride_0_X_data) /= __pyx_v_sum_; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_X_data.diminfo[0].strides) /= __pyx_v_sum_; } - __pyx_L5_continue:; + __pyx_L3_continue:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -2161,17 +2364,17 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali __Pyx_XDECREF(__pyx_t_2); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.utils.sparsefuncs.inplace_csr_row_normalize_l2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_X_data); __Pyx_XDECREF((PyObject *)__pyx_v_X_indices); @@ -2181,86 +2384,41 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normali return __pyx_r; } -/* "sklearn/utils/sparsefuncs.pyx":144 - * @cython.wraparound(False) - * @cython.cdivision(True) - * def inplace_csr_column_scale(X, np.ndarray[DOUBLE, ndim=1] scale): # <<<<<<<<<<<<<< - * """Inplace column scaling of a CSR matrix. - * - */ - -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scale[] = "Inplace column scaling of a CSR matrix.\n\n Scale each feature of the data matrix by multiplying with specific scale\n provided by the caller assuming a (n_samples, n_features) shape.\n\n Parameters\n ----------\n X: CSR matrix with shape (n_samples, n_features)\n Matrix to normalize using the variance of the features.\n\n scale: float array with shape (n_features,)\n Array of precomputed feature-wise values to use for scaling.\n "; -static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scale = {__Pyx_NAMESTR("inplace_csr_column_scale"), (PyCFunction)__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scale)}; -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_7inplace_csr_column_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5utils_11sparsefuncs_6inplace_csr_column_scale[] = "Inplace column scaling of a CSR matrix.\n\n Scale each feature of the data matrix by multiplying with specific scale\n provided by the caller assuming a (n_samples, n_features) shape.\n\n Parameters\n ----------\n X: CSR matrix with shape (n_samples, n_features)\n Matrix to normalize using the variance of the features.\n\n scale: float array with shape (n_features,)\n Array of precomputed feature-wise values to use for scaling.\n "; +static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_7inplace_csr_column_scale = {__Pyx_NAMESTR("inplace_csr_column_scale"), (PyCFunction)__pyx_pw_7sklearn_5utils_11sparsefuncs_7inplace_csr_column_scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_6inplace_csr_column_scale)}; +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_7inplace_csr_column_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_scale = 0; - unsigned int __pyx_v_n_samples; - unsigned int __pyx_v_n_features; - PyArrayObject *__pyx_v_X_data = 0; - PyArrayObject *__pyx_v_X_indices = 0; - PyArrayObject *__pyx_v_X_indptr = 0; - unsigned int __pyx_v_i; - unsigned int __pyx_v_j; - Py_buffer __pyx_bstruct_scale; - Py_ssize_t __pyx_bstride_0_scale = 0; - Py_ssize_t __pyx_bshape_0_scale = 0; - Py_buffer __pyx_bstruct_X_indices; - Py_ssize_t __pyx_bstride_0_X_indices = 0; - Py_ssize_t __pyx_bshape_0_X_indices = 0; - Py_buffer __pyx_bstruct_X_indptr; - Py_ssize_t __pyx_bstride_0_X_indptr = 0; - Py_ssize_t __pyx_bshape_0_X_indptr = 0; - Py_buffer __pyx_bstruct_X_data; - Py_ssize_t __pyx_bstride_0_X_data = 0; - Py_ssize_t __pyx_bshape_0_X_data = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - unsigned int __pyx_t_3; - PyArrayObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - unsigned int __pyx_t_7; - long __pyx_t_8; - int __pyx_t_9; - unsigned int __pyx_t_10; - unsigned int __pyx_t_11; - unsigned int __pyx_t_12; - int __pyx_t_13; - unsigned int __pyx_t_14; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__scale,0}; - __Pyx_RefNannySetupContext("inplace_csr_column_scale"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("inplace_csr_column_scale (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__scale,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("inplace_csr_column_scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("inplace_csr_column_scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "inplace_csr_column_scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "inplace_csr_column_scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2273,129 +2431,190 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scal } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("inplace_csr_column_scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("inplace_csr_column_scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.sparsefuncs.inplace_csr_column_scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_X_data.buf = NULL; - __pyx_bstruct_X_indices.buf = NULL; - __pyx_bstruct_X_indptr.buf = NULL; - __pyx_bstruct_scale.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scale), __pyx_ptype_5numpy_ndarray, 1, "scale", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scale), __pyx_ptype_5numpy_ndarray, 1, "scale", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5utils_11sparsefuncs_6inplace_csr_column_scale(__pyx_self, __pyx_v_X, __pyx_v_scale); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/sparsefuncs.pyx":143 + * @cython.wraparound(False) + * @cython.cdivision(True) + * def inplace_csr_column_scale(X, np.ndarray[DOUBLE, ndim=1] scale): # <<<<<<<<<<<<<< + * """Inplace column scaling of a CSR matrix. + * + */ + +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_6inplace_csr_column_scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyArrayObject *__pyx_v_scale) { + unsigned int __pyx_v_n_samples; + CYTHON_UNUSED unsigned int __pyx_v_n_features; + PyArrayObject *__pyx_v_X_data = 0; + PyArrayObject *__pyx_v_X_indices = 0; + PyArrayObject *__pyx_v_X_indptr = 0; + unsigned int __pyx_v_i; + unsigned int __pyx_v_j; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_data; + __Pyx_Buffer __pyx_pybuffer_X_data; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indices; + __Pyx_Buffer __pyx_pybuffer_X_indices; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indptr; + __Pyx_Buffer __pyx_pybuffer_X_indptr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_scale; + __Pyx_Buffer __pyx_pybuffer_scale; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + unsigned int __pyx_t_3; + PyArrayObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + unsigned int __pyx_t_7; + long __pyx_t_8; + int __pyx_t_9; + unsigned int __pyx_t_10; + unsigned int __pyx_t_11; + unsigned int __pyx_t_12; + int __pyx_t_13; + unsigned int __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("inplace_csr_column_scale", 0); + __pyx_pybuffer_X_data.pybuffer.buf = NULL; + __pyx_pybuffer_X_data.refcount = 0; + __pyx_pybuffernd_X_data.data = NULL; + __pyx_pybuffernd_X_data.rcbuffer = &__pyx_pybuffer_X_data; + __pyx_pybuffer_X_indices.pybuffer.buf = NULL; + __pyx_pybuffer_X_indices.refcount = 0; + __pyx_pybuffernd_X_indices.data = NULL; + __pyx_pybuffernd_X_indices.rcbuffer = &__pyx_pybuffer_X_indices; + __pyx_pybuffer_X_indptr.pybuffer.buf = NULL; + __pyx_pybuffer_X_indptr.refcount = 0; + __pyx_pybuffernd_X_indptr.data = NULL; + __pyx_pybuffernd_X_indptr.rcbuffer = &__pyx_pybuffer_X_indptr; + __pyx_pybuffer_scale.pybuffer.buf = NULL; + __pyx_pybuffer_scale.refcount = 0; + __pyx_pybuffernd_scale.data = NULL; + __pyx_pybuffernd_scale.rcbuffer = &__pyx_pybuffer_scale; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_scale, (PyObject*)__pyx_v_scale, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scale.rcbuffer->pybuffer, (PyObject*)__pyx_v_scale, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_scale = __pyx_bstruct_scale.strides[0]; - __pyx_bshape_0_scale = __pyx_bstruct_scale.shape[0]; + __pyx_pybuffernd_scale.diminfo[0].strides = __pyx_pybuffernd_scale.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scale.diminfo[0].shape = __pyx_pybuffernd_scale.rcbuffer->pybuffer.shape[0]; - /* "sklearn/utils/sparsefuncs.pyx":158 + /* "sklearn/utils/sparsefuncs.pyx":157 * Array of precomputed feature-wise values to use for scaling. * """ * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< * cdef unsigned int n_features = X.shape[1] * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __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_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_n_samples = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":159 + /* "sklearn/utils/sparsefuncs.pyx":158 * """ * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n_features = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":161 + /* "sklearn/utils/sparsefuncs.pyx":160 * cdef unsigned int n_features = X.shape[1] * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __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 = 161; __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 = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_data, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_data.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_data = __pyx_bstruct_X_data.strides[0]; - __pyx_bshape_0_X_data = __pyx_bstruct_X_data.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; } } __pyx_t_4 = 0; __pyx_v_X_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":162 + /* "sklearn/utils/sparsefuncs.pyx":161 * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __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 = 162; __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 = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indices = __pyx_bstruct_X_indices.strides[0]; - __pyx_bshape_0_X_indices = __pyx_bstruct_X_indices.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; } } __pyx_t_5 = 0; __pyx_v_X_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":163 + /* "sklearn/utils/sparsefuncs.pyx":162 * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr # <<<<<<<<<<<<<< * * cdef unsigned int i, j */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __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 = 163; __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 = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indptr.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indptr = __pyx_bstruct_X_indptr.strides[0]; - __pyx_bshape_0_X_indptr = __pyx_bstruct_X_indptr.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; } } __pyx_t_6 = 0; __pyx_v_X_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":166 + /* "sklearn/utils/sparsefuncs.pyx":165 * * cdef unsigned int i, j * for i in xrange(n_samples): # <<<<<<<<<<<<<< @@ -2406,7 +2625,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scal for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "sklearn/utils/sparsefuncs.pyx":167 + /* "sklearn/utils/sparsefuncs.pyx":166 * cdef unsigned int i, j * for i in xrange(n_samples): * for j in xrange(X_indptr[i], X_indptr[i + 1]): # <<<<<<<<<<<<<< @@ -2414,12 +2633,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scal * */ __pyx_t_8 = (__pyx_v_i + 1); - __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_8, __pyx_bstride_0_X_indptr)); + __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_10 = __pyx_v_i; - for (__pyx_t_11 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_10, __pyx_bstride_0_X_indptr)); __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { + for (__pyx_t_11 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { __pyx_v_j = __pyx_t_11; - /* "sklearn/utils/sparsefuncs.pyx":168 + /* "sklearn/utils/sparsefuncs.pyx":167 * for i in xrange(n_samples): * for j in xrange(X_indptr[i], X_indptr[i + 1]): * X_data[j] *= scale[X_indices[j]] # <<<<<<<<<<<<<< @@ -2427,9 +2646,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scal * */ __pyx_t_12 = __pyx_v_j; - __pyx_t_13 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indices.buf, __pyx_t_12, __pyx_bstride_0_X_indices)); + __pyx_t_13 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X_indices.diminfo[0].strides)); __pyx_t_14 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_14, __pyx_bstride_0_X_data) *= (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_scale.buf, __pyx_t_13, __pyx_bstride_0_scale)); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_X_data.diminfo[0].strides) *= (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_scale.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_scale.diminfo[0].strides)); } } @@ -2440,19 +2659,19 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scal __Pyx_XDECREF(__pyx_t_2); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_scale); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scale.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.utils.sparsefuncs.inplace_csr_column_scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_scale); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scale.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_X_data); __Pyx_XDECREF((PyObject *)__pyx_v_X_indices); @@ -2462,7 +2681,20 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scal return __pyx_r; } -/* "sklearn/utils/sparsefuncs.pyx":174 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_9csc_mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_7sklearn_5utils_11sparsefuncs_8csc_mean_variance_axis0[] = "Compute mean and variance along axis 0 on a CSC matrix\n\n Parameters\n ----------\n X: CSC sparse matrix, shape (n_samples, n_features)\n Input data.\n\n Returns\n -------\n\n means: float array with shape (n_features,)\n Feature-wise means\n\n variances: float array with shape (n_features,)\n Feature-wise variances\n\n "; +static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_9csc_mean_variance_axis0 = {__Pyx_NAMESTR("csc_mean_variance_axis0"), (PyCFunction)__pyx_pw_7sklearn_5utils_11sparsefuncs_9csc_mean_variance_axis0, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_8csc_mean_variance_axis0)}; +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_9csc_mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("csc_mean_variance_axis0 (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_5utils_11sparsefuncs_8csc_mean_variance_axis0(__pyx_self, ((PyObject *)__pyx_v_X)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/sparsefuncs.pyx":173 * @cython.wraparound(False) * @cython.cdivision(True) * def csc_mean_variance_axis0(X): # <<<<<<<<<<<<<< @@ -2470,14 +2702,11 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scal * */ -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0[] = "Compute mean and variance along axis 0 on a CSC matrix\n\n Parameters\n ----------\n X: CSC sparse matrix, shape (n_samples, n_features)\n Input data.\n\n Returns\n -------\n\n means: float array with shape (n_features,)\n Feature-wise means\n\n variances: float array with shape (n_features,)\n Feature-wise variances\n\n "; -static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 = {__Pyx_NAMESTR("csc_mean_variance_axis0"), (PyCFunction)__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0)}; -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_8csc_mean_variance_axis0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) { unsigned int __pyx_v_n_samples; unsigned int __pyx_v_n_features; PyArrayObject *__pyx_v_X_data = 0; - PyArrayObject *__pyx_v_X_indices = 0; + CYTHON_UNUSED PyArrayObject *__pyx_v_X_indices = 0; PyArrayObject *__pyx_v_X_indptr = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; @@ -2486,21 +2715,16 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 PyArrayObject *__pyx_v_variances = 0; PyObject *__pyx_v_counts = NULL; PyObject *__pyx_v_nz = NULL; - Py_buffer __pyx_bstruct_means; - Py_ssize_t __pyx_bstride_0_means = 0; - Py_ssize_t __pyx_bshape_0_means = 0; - Py_buffer __pyx_bstruct_variances; - Py_ssize_t __pyx_bstride_0_variances = 0; - Py_ssize_t __pyx_bshape_0_variances = 0; - Py_buffer __pyx_bstruct_X_indices; - Py_ssize_t __pyx_bstride_0_X_indices = 0; - Py_ssize_t __pyx_bshape_0_X_indices = 0; - Py_buffer __pyx_bstruct_X_indptr; - Py_ssize_t __pyx_bstride_0_X_indptr = 0; - Py_ssize_t __pyx_bshape_0_X_indptr = 0; - Py_buffer __pyx_bstruct_X_data; - Py_ssize_t __pyx_bstride_0_X_data = 0; - Py_ssize_t __pyx_bshape_0_X_data = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_data; + __Pyx_Buffer __pyx_pybuffer_X_data; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indices; + __Pyx_Buffer __pyx_pybuffer_X_indices; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indptr; + __Pyx_Buffer __pyx_pybuffer_X_indptr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_means; + __Pyx_Buffer __pyx_pybuffer_means; + __Pyx_LocalBuf_ND __pyx_pybuffernd_variances; + __Pyx_Buffer __pyx_pybuffer_variances; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2528,227 +2752,236 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("csc_mean_variance_axis0"); - __pyx_self = __pyx_self; - __pyx_bstruct_X_data.buf = NULL; - __pyx_bstruct_X_indices.buf = NULL; - __pyx_bstruct_X_indptr.buf = NULL; - __pyx_bstruct_means.buf = NULL; - __pyx_bstruct_variances.buf = NULL; - - /* "sklearn/utils/sparsefuncs.pyx":192 + __Pyx_RefNannySetupContext("csc_mean_variance_axis0", 0); + __pyx_pybuffer_X_data.pybuffer.buf = NULL; + __pyx_pybuffer_X_data.refcount = 0; + __pyx_pybuffernd_X_data.data = NULL; + __pyx_pybuffernd_X_data.rcbuffer = &__pyx_pybuffer_X_data; + __pyx_pybuffer_X_indices.pybuffer.buf = NULL; + __pyx_pybuffer_X_indices.refcount = 0; + __pyx_pybuffernd_X_indices.data = NULL; + __pyx_pybuffernd_X_indices.rcbuffer = &__pyx_pybuffer_X_indices; + __pyx_pybuffer_X_indptr.pybuffer.buf = NULL; + __pyx_pybuffer_X_indptr.refcount = 0; + __pyx_pybuffernd_X_indptr.data = NULL; + __pyx_pybuffernd_X_indptr.rcbuffer = &__pyx_pybuffer_X_indptr; + __pyx_pybuffer_means.pybuffer.buf = NULL; + __pyx_pybuffer_means.refcount = 0; + __pyx_pybuffernd_means.data = NULL; + __pyx_pybuffernd_means.rcbuffer = &__pyx_pybuffer_means; + __pyx_pybuffer_variances.pybuffer.buf = NULL; + __pyx_pybuffer_variances.refcount = 0; + __pyx_pybuffernd_variances.data = NULL; + __pyx_pybuffernd_variances.rcbuffer = &__pyx_pybuffer_variances; + + /* "sklearn/utils/sparsefuncs.pyx":191 * * """ * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< * cdef unsigned int n_features = X.shape[1] * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __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_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_n_samples = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":193 + /* "sklearn/utils/sparsefuncs.pyx":192 * """ * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n_features = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":195 + /* "sklearn/utils/sparsefuncs.pyx":194 * cdef unsigned int n_features = X.shape[1] * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __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 = 195; __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 = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_data, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_data.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_data = __pyx_bstruct_X_data.strides[0]; - __pyx_bshape_0_X_data = __pyx_bstruct_X_data.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; } } __pyx_t_4 = 0; __pyx_v_X_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":196 + /* "sklearn/utils/sparsefuncs.pyx":195 * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __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 = 196; __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 = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indices = __pyx_bstruct_X_indices.strides[0]; - __pyx_bshape_0_X_indices = __pyx_bstruct_X_indices.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; } } __pyx_t_5 = 0; __pyx_v_X_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":197 + /* "sklearn/utils/sparsefuncs.pyx":196 * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr # <<<<<<<<<<<<<< * * cdef unsigned int i */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); 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); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __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 = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indptr.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indptr = __pyx_bstruct_X_indptr.strides[0]; - __pyx_bshape_0_X_indptr = __pyx_bstruct_X_indptr.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; } } __pyx_t_6 = 0; __pyx_v_X_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":204 + /* "sklearn/utils/sparsefuncs.pyx":203 * * # means[j] contains the mean of feature j * cdef np.ndarray[DOUBLE, ndim=1] means = np.asarray(X.mean(axis=0))[0] # <<<<<<<<<<<<<< * * # variances[j] contains the variance of feature j */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__mean); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__mean); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_means, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_means = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_means.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_means = __pyx_bstruct_means.strides[0]; - __pyx_bshape_0_means = __pyx_bstruct_means.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_means = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_means.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_means.diminfo[0].strides = __pyx_pybuffernd_means.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_means.diminfo[0].shape = __pyx_pybuffernd_means.rcbuffer->pybuffer.shape[0]; } } __pyx_t_9 = 0; __pyx_v_means = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "sklearn/utils/sparsefuncs.pyx":207 + /* "sklearn/utils/sparsefuncs.pyx":206 * * # variances[j] contains the variance of feature j * cdef np.ndarray[DOUBLE, ndim=1] variances = np.zeros_like(means) # <<<<<<<<<<<<<< * * # counts[j] contains the number of samples where feature j is non-zero */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); 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_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_7 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_v_means)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_means)); __Pyx_GIVEREF(((PyObject *)__pyx_v_means)); - __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 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 = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_variances = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_variances.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_variances = __pyx_bstruct_variances.strides[0]; - __pyx_bshape_0_variances = __pyx_bstruct_variances.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_variances = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_variances.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_variances.diminfo[0].strides = __pyx_pybuffernd_variances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variances.diminfo[0].shape = __pyx_pybuffernd_variances.rcbuffer->pybuffer.shape[0]; } } __pyx_t_10 = 0; __pyx_v_variances = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":210 + /* "sklearn/utils/sparsefuncs.pyx":209 * * # counts[j] contains the number of samples where feature j is non-zero * counts = np.zeros_like(means) # <<<<<<<<<<<<<< * * for i in xrange(n_features): */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __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 = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_means)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_means)); __Pyx_GIVEREF(((PyObject *)__pyx_v_means)); - __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_counts = __pyx_t_8; __pyx_t_8 = 0; - /* "sklearn/utils/sparsefuncs.pyx":212 + /* "sklearn/utils/sparsefuncs.pyx":211 * counts = np.zeros_like(means) * * for i in xrange(n_features): # <<<<<<<<<<<<<< @@ -2759,7 +2992,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_3; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "sklearn/utils/sparsefuncs.pyx":213 + /* "sklearn/utils/sparsefuncs.pyx":212 * * for i in xrange(n_features): * for j in xrange(X_indptr[i], X_indptr[i + 1]): # <<<<<<<<<<<<<< @@ -2767,12 +3000,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 * variances[i] += diff * diff */ __pyx_t_12 = (__pyx_v_i + 1); - __pyx_t_13 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_12, __pyx_bstride_0_X_indptr)); + __pyx_t_13 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_14 = __pyx_v_i; - for (__pyx_t_15 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_14, __pyx_bstride_0_X_indptr)); __pyx_t_15 < __pyx_t_13; __pyx_t_15+=1) { + for (__pyx_t_15 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_15 < __pyx_t_13; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; - /* "sklearn/utils/sparsefuncs.pyx":214 + /* "sklearn/utils/sparsefuncs.pyx":213 * for i in xrange(n_features): * for j in xrange(X_indptr[i], X_indptr[i + 1]): * diff = X_data[j] - means[i] # <<<<<<<<<<<<<< @@ -2781,9 +3014,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 */ __pyx_t_16 = __pyx_v_j; __pyx_t_17 = __pyx_v_i; - __pyx_v_diff = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_16, __pyx_bstride_0_X_data)) - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_means.buf, __pyx_t_17, __pyx_bstride_0_means))); + __pyx_v_diff = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_X_data.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_means.diminfo[0].strides))); - /* "sklearn/utils/sparsefuncs.pyx":215 + /* "sklearn/utils/sparsefuncs.pyx":214 * for j in xrange(X_indptr[i], X_indptr[i + 1]): * diff = X_data[j] - means[i] * variances[i] += diff * diff # <<<<<<<<<<<<<< @@ -2791,9 +3024,9 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 * */ __pyx_t_18 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_variances.buf, __pyx_t_18, __pyx_bstride_0_variances) += (__pyx_v_diff * __pyx_v_diff); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_variances.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_variances.diminfo[0].strides) += (__pyx_v_diff * __pyx_v_diff); - /* "sklearn/utils/sparsefuncs.pyx":216 + /* "sklearn/utils/sparsefuncs.pyx":215 * diff = X_data[j] - means[i] * variances[i] += diff * diff * counts[i] += 1 # <<<<<<<<<<<<<< @@ -2801,107 +3034,105 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 * nz = n_samples - counts */ __pyx_t_19 = __pyx_v_i; - __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_counts, __pyx_t_19, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_counts, __pyx_t_19, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__Pyx_SetItemInt(__pyx_v_counts, __pyx_t_19, __pyx_t_2, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_counts, __pyx_t_19, __pyx_t_2, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } } - /* "sklearn/utils/sparsefuncs.pyx":218 + /* "sklearn/utils/sparsefuncs.pyx":217 * counts[i] += 1 * * nz = n_samples - counts # <<<<<<<<<<<<<< * variances += nz * means ** 2 * variances /= n_samples */ - __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_v_counts); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Subtract(__pyx_t_2, __pyx_v_counts); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_nz = __pyx_t_8; __pyx_t_8 = 0; - /* "sklearn/utils/sparsefuncs.pyx":219 + /* "sklearn/utils/sparsefuncs.pyx":218 * * nz = n_samples - counts * variances += nz * means ** 2 # <<<<<<<<<<<<<< * variances /= n_samples * */ - __pyx_t_8 = PyNumber_Power(((PyObject *)__pyx_v_means), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Power(((PyObject *)__pyx_v_means), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyNumber_Multiply(__pyx_v_nz, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_v_nz, __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_variances), __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_variances), __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_variances); - __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variances.rcbuffer->pybuffer); + __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_13 < 0)) { PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_v_variances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_v_variances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22); } } - __pyx_bstride_0_variances = __pyx_bstruct_variances.strides[0]; - __pyx_bshape_0_variances = __pyx_bstruct_variances.shape[0]; - if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_variances.diminfo[0].strides = __pyx_pybuffernd_variances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variances.diminfo[0].shape = __pyx_pybuffernd_variances.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_variances)); __pyx_v_variances = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; - /* "sklearn/utils/sparsefuncs.pyx":220 + /* "sklearn/utils/sparsefuncs.pyx":219 * nz = n_samples - counts * variances += nz * means ** 2 * variances /= n_samples # <<<<<<<<<<<<<< * * return means, variances */ - __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_n_samples); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_variances), __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(((PyObject *)__pyx_v_variances), __pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 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 = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_variances); - __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variances.rcbuffer->pybuffer); + __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); if (unlikely(__pyx_t_13 < 0)) { PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_variances, (PyObject*)__pyx_v_variances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variances.rcbuffer->pybuffer, (PyObject*)__pyx_v_variances, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20); } } - __pyx_bstride_0_variances = __pyx_bstruct_variances.strides[0]; - __pyx_bshape_0_variances = __pyx_bstruct_variances.shape[0]; - if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_pybuffernd_variances.diminfo[0].strides = __pyx_pybuffernd_variances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variances.diminfo[0].shape = __pyx_pybuffernd_variances.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_variances)); __pyx_v_variances = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":222 + /* "sklearn/utils/sparsefuncs.pyx":221 * variances /= n_samples * * return means, variances # <<<<<<<<<<<<<< @@ -2909,8 +3140,8 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_means)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_means)); __Pyx_GIVEREF(((PyObject *)__pyx_v_means)); @@ -2930,21 +3161,21 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 __Pyx_XDECREF(__pyx_t_8); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_means); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_variances); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_means.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variances.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.utils.sparsefuncs.csc_mean_variance_axis0", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_means); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_variances); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_means.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variances.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_X_data); __Pyx_XDECREF((PyObject *)__pyx_v_X_indices); @@ -2958,85 +3189,41 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0 return __pyx_r; } -/* "sklearn/utils/sparsefuncs.pyx":228 - * @cython.wraparound(False) - * @cython.cdivision(True) - * def inplace_csc_column_scale(X, np.ndarray[DOUBLE, ndim=1] scale): # <<<<<<<<<<<<<< - * """Inplace column scaling of a CSC matrix. - * - */ - -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scale[] = "Inplace column scaling of a CSC matrix.\n\n Scale each feature of the data matrix by multiplying with specific scale\n provided by the caller assuming a (n_samples, n_features) shape.\n\n Parameters\n ----------\n X: CSC matrix with shape (n_samples, n_features)\n Matrix to normalize using the variance of the features.\n\n scale: float array with shape (n_features,)\n Array of precomputed feature-wise values to use for scaling.\n "; -static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scale = {__Pyx_NAMESTR("inplace_csc_column_scale"), (PyCFunction)__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scale)}; -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_11inplace_csc_column_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5utils_11sparsefuncs_10inplace_csc_column_scale[] = "Inplace column scaling of a CSC matrix.\n\n Scale each feature of the data matrix by multiplying with specific scale\n provided by the caller assuming a (n_samples, n_features) shape.\n\n Parameters\n ----------\n X: CSC matrix with shape (n_samples, n_features)\n Matrix to normalize using the variance of the features.\n\n scale: float array with shape (n_features,)\n Array of precomputed feature-wise values to use for scaling.\n "; +static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_11inplace_csc_column_scale = {__Pyx_NAMESTR("inplace_csc_column_scale"), (PyCFunction)__pyx_pw_7sklearn_5utils_11sparsefuncs_11inplace_csc_column_scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_10inplace_csc_column_scale)}; +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_11inplace_csc_column_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_scale = 0; - unsigned int __pyx_v_n_samples; - unsigned int __pyx_v_n_features; - PyArrayObject *__pyx_v_X_data = 0; - PyArrayObject *__pyx_v_X_indices = 0; - PyArrayObject *__pyx_v_X_indptr = 0; - unsigned int __pyx_v_i; - unsigned int __pyx_v_j; - Py_buffer __pyx_bstruct_scale; - Py_ssize_t __pyx_bstride_0_scale = 0; - Py_ssize_t __pyx_bshape_0_scale = 0; - Py_buffer __pyx_bstruct_X_indices; - Py_ssize_t __pyx_bstride_0_X_indices = 0; - Py_ssize_t __pyx_bshape_0_X_indices = 0; - Py_buffer __pyx_bstruct_X_indptr; - Py_ssize_t __pyx_bstride_0_X_indptr = 0; - Py_ssize_t __pyx_bshape_0_X_indptr = 0; - Py_buffer __pyx_bstruct_X_data; - Py_ssize_t __pyx_bstride_0_X_data = 0; - Py_ssize_t __pyx_bshape_0_X_data = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - unsigned int __pyx_t_3; - PyArrayObject *__pyx_t_4 = NULL; - PyArrayObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - unsigned int __pyx_t_7; - long __pyx_t_8; - int __pyx_t_9; - unsigned int __pyx_t_10; - unsigned int __pyx_t_11; - unsigned int __pyx_t_12; - unsigned int __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__scale,0}; - __Pyx_RefNannySetupContext("inplace_csc_column_scale"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("inplace_csc_column_scale (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__scale,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("inplace_csc_column_scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("inplace_csc_column_scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "inplace_csc_column_scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "inplace_csc_column_scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3049,129 +3236,189 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scal } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("inplace_csc_column_scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("inplace_csc_column_scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.sparsefuncs.inplace_csc_column_scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_X_data.buf = NULL; - __pyx_bstruct_X_indices.buf = NULL; - __pyx_bstruct_X_indptr.buf = NULL; - __pyx_bstruct_scale.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scale), __pyx_ptype_5numpy_ndarray, 1, "scale", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_scale), __pyx_ptype_5numpy_ndarray, 1, "scale", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5utils_11sparsefuncs_10inplace_csc_column_scale(__pyx_self, __pyx_v_X, __pyx_v_scale); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/sparsefuncs.pyx":227 + * @cython.wraparound(False) + * @cython.cdivision(True) + * def inplace_csc_column_scale(X, np.ndarray[DOUBLE, ndim=1] scale): # <<<<<<<<<<<<<< + * """Inplace column scaling of a CSC matrix. + * + */ + +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_10inplace_csc_column_scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyArrayObject *__pyx_v_scale) { + CYTHON_UNUSED unsigned int __pyx_v_n_samples; + unsigned int __pyx_v_n_features; + PyArrayObject *__pyx_v_X_data = 0; + CYTHON_UNUSED PyArrayObject *__pyx_v_X_indices = 0; + PyArrayObject *__pyx_v_X_indptr = 0; + unsigned int __pyx_v_i; + unsigned int __pyx_v_j; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_data; + __Pyx_Buffer __pyx_pybuffer_X_data; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indices; + __Pyx_Buffer __pyx_pybuffer_X_indices; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X_indptr; + __Pyx_Buffer __pyx_pybuffer_X_indptr; + __Pyx_LocalBuf_ND __pyx_pybuffernd_scale; + __Pyx_Buffer __pyx_pybuffer_scale; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + unsigned int __pyx_t_3; + PyArrayObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + unsigned int __pyx_t_7; + long __pyx_t_8; + int __pyx_t_9; + unsigned int __pyx_t_10; + unsigned int __pyx_t_11; + unsigned int __pyx_t_12; + unsigned int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("inplace_csc_column_scale", 0); + __pyx_pybuffer_X_data.pybuffer.buf = NULL; + __pyx_pybuffer_X_data.refcount = 0; + __pyx_pybuffernd_X_data.data = NULL; + __pyx_pybuffernd_X_data.rcbuffer = &__pyx_pybuffer_X_data; + __pyx_pybuffer_X_indices.pybuffer.buf = NULL; + __pyx_pybuffer_X_indices.refcount = 0; + __pyx_pybuffernd_X_indices.data = NULL; + __pyx_pybuffernd_X_indices.rcbuffer = &__pyx_pybuffer_X_indices; + __pyx_pybuffer_X_indptr.pybuffer.buf = NULL; + __pyx_pybuffer_X_indptr.refcount = 0; + __pyx_pybuffernd_X_indptr.data = NULL; + __pyx_pybuffernd_X_indptr.rcbuffer = &__pyx_pybuffer_X_indptr; + __pyx_pybuffer_scale.pybuffer.buf = NULL; + __pyx_pybuffer_scale.refcount = 0; + __pyx_pybuffernd_scale.data = NULL; + __pyx_pybuffernd_scale.rcbuffer = &__pyx_pybuffer_scale; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_scale, (PyObject*)__pyx_v_scale, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_scale.rcbuffer->pybuffer, (PyObject*)__pyx_v_scale, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_scale = __pyx_bstruct_scale.strides[0]; - __pyx_bshape_0_scale = __pyx_bstruct_scale.shape[0]; + __pyx_pybuffernd_scale.diminfo[0].strides = __pyx_pybuffernd_scale.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_scale.diminfo[0].shape = __pyx_pybuffernd_scale.rcbuffer->pybuffer.shape[0]; - /* "sklearn/utils/sparsefuncs.pyx":242 + /* "sklearn/utils/sparsefuncs.pyx":241 * Array of precomputed feature-wise values to use for scaling. * """ * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< * cdef unsigned int n_features = X.shape[1] * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __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_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_n_samples = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":243 + /* "sklearn/utils/sparsefuncs.pyx":242 * """ * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n_features = __pyx_t_3; - /* "sklearn/utils/sparsefuncs.pyx":245 + /* "sklearn/utils/sparsefuncs.pyx":244 * cdef unsigned int n_features = X.shape[1] * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__data); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __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 = 245; __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 = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_data, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_data.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_data = __pyx_bstruct_X_data.strides[0]; - __pyx_bshape_0_X_data = __pyx_bstruct_X_data.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_data.diminfo[0].strides = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_data.diminfo[0].shape = __pyx_pybuffernd_X_data.rcbuffer->pybuffer.shape[0]; } } __pyx_t_4 = 0; __pyx_v_X_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":246 + /* "sklearn/utils/sparsefuncs.pyx":245 * * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices # <<<<<<<<<<<<<< * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr * */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __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 = 246; __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 = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indices = __pyx_bstruct_X_indices.strides[0]; - __pyx_bshape_0_X_indices = __pyx_bstruct_X_indices.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indices.diminfo[0].strides = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indices.diminfo[0].shape = __pyx_pybuffernd_X_indices.rcbuffer->pybuffer.shape[0]; } } __pyx_t_5 = 0; __pyx_v_X_indices = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":247 + /* "sklearn/utils/sparsefuncs.pyx":246 * cdef np.ndarray[DOUBLE, ndim=1] X_data = X.data * cdef np.ndarray[int, ndim=1] X_indices = X.indices * cdef np.ndarray[int, ndim=1] X_indptr = X.indptr # <<<<<<<<<<<<<< * * cdef unsigned int i, j */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__indptr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __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 = 247; __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 = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_X_indptr.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_X_indptr = __pyx_bstruct_X_indptr.strides[0]; - __pyx_bshape_0_X_indptr = __pyx_bstruct_X_indptr.shape[0]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_X_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X_indptr.diminfo[0].strides = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_indptr.diminfo[0].shape = __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.shape[0]; } } __pyx_t_6 = 0; __pyx_v_X_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":250 + /* "sklearn/utils/sparsefuncs.pyx":249 * * cdef unsigned int i, j * for i in xrange(n_features): # <<<<<<<<<<<<<< @@ -3182,7 +3429,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scal for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_3; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "sklearn/utils/sparsefuncs.pyx":251 + /* "sklearn/utils/sparsefuncs.pyx":250 * cdef unsigned int i, j * for i in xrange(n_features): * for j in xrange(X_indptr[i], X_indptr[i + 1]): # <<<<<<<<<<<<<< @@ -3190,12 +3437,12 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scal * */ __pyx_t_8 = (__pyx_v_i + 1); - __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_8, __pyx_bstride_0_X_indptr)); + __pyx_t_9 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_10 = __pyx_v_i; - for (__pyx_t_11 = (*__Pyx_BufPtrStrided1d(int *, __pyx_bstruct_X_indptr.buf, __pyx_t_10, __pyx_bstride_0_X_indptr)); __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { + for (__pyx_t_11 = (*__Pyx_BufPtrStrided1d(int *, __pyx_pybuffernd_X_indptr.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_X_indptr.diminfo[0].strides)); __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { __pyx_v_j = __pyx_t_11; - /* "sklearn/utils/sparsefuncs.pyx":252 + /* "sklearn/utils/sparsefuncs.pyx":251 * for i in xrange(n_features): * for j in xrange(X_indptr[i], X_indptr[i + 1]): * X_data[j] *= scale[i] # <<<<<<<<<<<<<< @@ -3204,7 +3451,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scal */ __pyx_t_12 = __pyx_v_i; __pyx_t_13 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_13, __pyx_bstride_0_X_data) *= (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_bstruct_scale.buf, __pyx_t_12, __pyx_bstride_0_scale)); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_X_data.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_X_data.diminfo[0].strides) *= (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5utils_11sparsefuncs_DOUBLE *, __pyx_pybuffernd_scale.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_scale.diminfo[0].strides)); } } @@ -3215,19 +3462,19 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scal __Pyx_XDECREF(__pyx_t_2); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_scale); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scale.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.utils.sparsefuncs.inplace_csc_column_scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_scale); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_indptr); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_X_data); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_data.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X_indptr.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_scale.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_X_data); __Pyx_XDECREF((PyObject *)__pyx_v_X_indices); @@ -3237,7 +3484,20 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scal return __pyx_r; } -/* "sklearn/utils/sparsefuncs.pyx":254 +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_13mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_7sklearn_5utils_11sparsefuncs_12mean_variance_axis0[] = "Compute mean and variance along axis 0 on a CSR or CSC matrix\n\n Parameters\n ----------\n X: CSR or CSC sparse matrix, shape (n_samples, n_features)\n Input data.\n\n Returns\n -------\n\n means: float array with shape (n_features,)\n Feature-wise means\n\n variances: float array with shape (n_features,)\n Feature-wise variances\n\n "; +static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_13mean_variance_axis0 = {__Pyx_NAMESTR("mean_variance_axis0"), (PyCFunction)__pyx_pw_7sklearn_5utils_11sparsefuncs_13mean_variance_axis0, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_12mean_variance_axis0)}; +static PyObject *__pyx_pw_7sklearn_5utils_11sparsefuncs_13mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mean_variance_axis0 (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_5utils_11sparsefuncs_12mean_variance_axis0(__pyx_self, ((PyObject *)__pyx_v_X)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/sparsefuncs.pyx":253 * X_data[j] *= scale[i] * * def mean_variance_axis0(X): # <<<<<<<<<<<<<< @@ -3245,10 +3505,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scal * */ -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0[] = "Compute mean and variance along axis 0 on a CSR or CSC matrix\n\n Parameters\n ----------\n X: CSR or CSC sparse matrix, shape (n_samples, n_features)\n Input data.\n\n Returns\n -------\n\n means: float array with shape (n_features,)\n Feature-wise means\n\n variances: float array with shape (n_features,)\n Feature-wise variances\n\n "; -static PyMethodDef __pyx_mdef_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0 = {__Pyx_NAMESTR("mean_variance_axis0"), (PyCFunction)__pyx_pf_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0)}; -static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_12mean_variance_axis0(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3258,26 +3515,25 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0(PyO int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("mean_variance_axis0"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("mean_variance_axis0", 0); - /* "sklearn/utils/sparsefuncs.pyx":272 + /* "sklearn/utils/sparsefuncs.pyx":271 * * """ * if isinstance(X, sp.csr_matrix): # <<<<<<<<<<<<<< * return csr_mean_variance_axis0(X) * elif isinstance(X, sp.csc_matrix): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__csr_matrix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = PyObject_IsInstance(__pyx_v_X, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_IsInstance(__pyx_v_X, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_3) { - /* "sklearn/utils/sparsefuncs.pyx":273 + /* "sklearn/utils/sparsefuncs.pyx":272 * """ * if isinstance(X, sp.csr_matrix): * return csr_mean_variance_axis0(X) # <<<<<<<<<<<<<< @@ -3285,77 +3541,78 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0(PyO * return csc_mean_variance_axis0(X) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_X); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_X); __Pyx_GIVEREF(__pyx_v_X); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - /* "sklearn/utils/sparsefuncs.pyx":274 + /* "sklearn/utils/sparsefuncs.pyx":273 * if isinstance(X, sp.csr_matrix): * return csr_mean_variance_axis0(X) * elif isinstance(X, sp.csc_matrix): # <<<<<<<<<<<<<< * return csc_mean_variance_axis0(X) * else: */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__sp); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__csc_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__csc_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = PyObject_IsInstance(__pyx_v_X, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_IsInstance(__pyx_v_X, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "sklearn/utils/sparsefuncs.pyx":275 + /* "sklearn/utils/sparsefuncs.pyx":274 * return csr_mean_variance_axis0(X) * elif isinstance(X, sp.csc_matrix): * return csc_mean_variance_axis0(X) # <<<<<<<<<<<<<< * else: - * raise TypeError("Unsupported matrix type. Expected a CSR or CSC sparse matrix.") + * raise TypeError( */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_X); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_X); __Pyx_GIVEREF(__pyx_v_X); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __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_4)); __pyx_t_4 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } /*else*/ { - /* "sklearn/utils/sparsefuncs.pyx":277 + /* "sklearn/utils/sparsefuncs.pyx":276 * return csc_mean_variance_axis0(X) * else: - * raise TypeError("Unsupported matrix type. Expected a CSR or CSC sparse matrix.") # <<<<<<<<<<<<<< + * raise TypeError( # <<<<<<<<<<<<<< + * "Unsupported type; expected a CSR or CSC sparse matrix.") */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __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[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L5:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -3371,7 +3628,18 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0(PyO return __pyx_r; } -/* "numpy.pxd":190 +/* 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) { + int __pyx_r; + __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)); + __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): # <<<<<<<<<<<<<< @@ -3379,8 +3647,7 @@ static PyObject *__pyx_pf_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0(PyO * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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; int __pyx_v_ndim; @@ -3405,13 +3672,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -3422,11 +3689,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3435,7 +3702,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3444,16 +3711,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3463,7 +3730,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -3471,11 +3738,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -3484,9 +3751,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3496,37 +3763,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * 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") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.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_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3536,46 +3803,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * 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") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.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_8), 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, ((PyObject *)__pyx_k_tuple_8), 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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -3584,7 +3851,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -3593,7 +3860,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.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) # <<<<<<<<<<<<<< @@ -3602,7 +3869,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.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 # <<<<<<<<<<<<<< @@ -3611,7 +3878,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -3622,49 +3889,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -3673,25 +3940,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -3700,17 +3967,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -3719,7 +3988,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -3735,7 +4004,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -3747,49 +4016,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -3800,10 +4070,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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" */ @@ -3820,24 +4090,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), 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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (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" @@ -3846,10 +4116,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -3859,10 +4129,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -3872,10 +4142,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -3885,10 +4155,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -3898,10 +4168,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -3911,10 +4181,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -3924,10 +4194,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -3937,10 +4207,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -3950,10 +4220,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -3963,10 +4233,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -3976,10 +4246,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -3989,10 +4259,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -4002,10 +4272,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -4015,10 +4285,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -4028,10 +4298,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -4041,10 +4311,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -4054,37 +4324,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __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_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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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)); __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -4093,7 +4363,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -4102,57 +4372,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -4177,31 +4447,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* 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)); + __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 CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -4209,11 +4487,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -4223,7 +4501,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -4231,14 +4509,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -4253,9 +4531,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -4263,7 +4541,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4281,7 +4559,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -4296,9 +4574,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -4306,7 +4584,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4324,7 +4602,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -4339,9 +4617,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -4349,7 +4627,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4367,7 +4645,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -4382,9 +4660,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -4392,7 +4670,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4410,7 +4688,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -4425,9 +4703,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -4435,7 +4713,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4453,7 +4731,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.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: # <<<<<<<<<<<<<< @@ -4476,18 +4754,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -4496,7 +4775,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -4505,7 +4784,7 @@ 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":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -4513,31 +4792,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -4546,20 +4830,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} + #endif + } else if (1) { + __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -4567,99 +4880,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), 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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * 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_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), 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_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -4667,16 +4979,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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -4685,7 +4996,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -4694,430 +5005,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.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_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.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_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), 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_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.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 = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.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_11), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -5125,25 +5419,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_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __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_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -5172,7 +5466,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -5184,9 +5478,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -5196,7 +5490,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -5208,7 +5502,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -5217,7 +5511,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -5228,7 +5522,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -5237,7 +5531,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -5249,7 +5543,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5261,9 +5555,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -5273,7 +5567,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -5288,7 +5582,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -5332,13 +5626,14 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, - {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, - {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, - {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, + {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, {&__pyx_n_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 1}, - {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1}, + {&__pyx_n_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 1}, + {&__pyx_n_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 1}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_n_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 1}, + {&__pyx_n_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 1}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 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}, @@ -5346,37 +5641,51 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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__X_data, __pyx_k__X_data, sizeof(__pyx_k__X_data), 0, 0, 1, 1}, + {&__pyx_n_s__X_indices, __pyx_k__X_indices, sizeof(__pyx_k__X_indices), 0, 0, 1, 1}, + {&__pyx_n_s__X_indptr, __pyx_k__X_indptr, sizeof(__pyx_k__X_indptr), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, + {&__pyx_n_s__counts, __pyx_k__counts, sizeof(__pyx_k__counts), 0, 0, 1, 1}, {&__pyx_n_s__csc_matrix, __pyx_k__csc_matrix, sizeof(__pyx_k__csc_matrix), 0, 0, 1, 1}, {&__pyx_n_s__csr_matrix, __pyx_k__csr_matrix, sizeof(__pyx_k__csr_matrix), 0, 0, 1, 1}, {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__diff, __pyx_k__diff, sizeof(__pyx_k__diff), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__ind, __pyx_k__ind, sizeof(__pyx_k__ind), 0, 0, 1, 1}, {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1}, {&__pyx_n_s__indptr, __pyx_k__indptr, sizeof(__pyx_k__indptr), 0, 0, 1, 1}, + {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__mean, __pyx_k__mean, sizeof(__pyx_k__mean), 0, 0, 1, 1}, {&__pyx_n_s__mean_variance_axis0, __pyx_k__mean_variance_axis0, sizeof(__pyx_k__mean_variance_axis0), 0, 0, 1, 1}, + {&__pyx_n_s__means, __pyx_k__means, sizeof(__pyx_k__means), 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_samples, __pyx_k__n_samples, sizeof(__pyx_k__n_samples), 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__nz, __pyx_k__nz, sizeof(__pyx_k__nz), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 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__sp, __pyx_k__sp, sizeof(__pyx_k__sp), 0, 0, 1, 1}, + {&__pyx_n_s__sum_, __pyx_k__sum_, sizeof(__pyx_k__sum_), 0, 0, 1, 1}, + {&__pyx_n_s__variances, __pyx_k__variances, sizeof(__pyx_k__variances), 0, 0, 1, 1}, {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1}, {&__pyx_n_s__zeros_like, __pyx_k__zeros_like, sizeof(__pyx_k__zeros_like), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { #if PY_MAJOR_VERSION >= 3 - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -5384,103 +5693,380 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/utils/sparsefuncs.pyx":277 + /* "sklearn/utils/sparsefuncs.pyx":276 * return csc_mean_variance_axis0(X) * else: - * raise TypeError("Unsupported matrix type. Expected a CSR or CSC sparse matrix.") # <<<<<<<<<<<<<< + * raise TypeError( # <<<<<<<<<<<<<< + * "Unsupported type; expected a CSR or CSC sparse matrix.") */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "numpy.pxd":211 + /* "numpy.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_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "numpy.pxd":215 + /* "numpy.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_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); - /* "numpy.pxd":819 + /* "numpy.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_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); + __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_15)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + + /* "sklearn/utils/sparsefuncs.pyx":20 + * @cython.wraparound(False) + * @cython.cdivision(True) + * def csr_mean_variance_axis0(X): # <<<<<<<<<<<<<< + * """Compute mean and variance along axis 0 on a CSR matrix + * + */ + __pyx_k_tuple_19 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__n_samples)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_samples)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__n_features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_data)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__X_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indices)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__X_indices)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indices)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 6, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 7, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ind)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 8, ((PyObject *)__pyx_n_s__ind)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ind)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__diff)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 9, ((PyObject *)__pyx_n_s__diff)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__diff)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__means)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 10, ((PyObject *)__pyx_n_s__means)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__means)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__variances)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 11, ((PyObject *)__pyx_n_s__variances)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__variances)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__counts)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 12, ((PyObject *)__pyx_n_s__counts)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nz)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__nz)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nz)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(1, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s_1, 20, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/utils/sparsefuncs.pyx":75 + * @cython.wraparound(False) + * @cython.cdivision(True) + * def inplace_csr_row_normalize_l1(X): # <<<<<<<<<<<<<< + * """Inplace row normalize using the l1 norm""" + * cdef unsigned int n_samples = X.shape[0] + */ + __pyx_k_tuple_23 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 1, ((PyObject *)__pyx_n_s__n_samples)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_samples)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 2, ((PyObject *)__pyx_n_s__n_features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_data)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 3, ((PyObject *)__pyx_n_s__X_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indices)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 4, ((PyObject *)__pyx_n_s__X_indices)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indices)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 5, ((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 6, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 7, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 8, ((PyObject *)__pyx_n_s__sum_)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s_25, 75, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/utils/sparsefuncs.pyx":110 + * @cython.wraparound(False) + * @cython.cdivision(True) + * def inplace_csr_row_normalize_l2(X): # <<<<<<<<<<<<<< + * """Inplace row normalize using the l2 norm""" + * cdef unsigned int n_samples = X.shape[0] + */ + __pyx_k_tuple_26 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_26); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 1, ((PyObject *)__pyx_n_s__n_samples)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_samples)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 2, ((PyObject *)__pyx_n_s__n_features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_data)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 3, ((PyObject *)__pyx_n_s__X_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indices)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 4, ((PyObject *)__pyx_n_s__X_indices)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indices)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 5, ((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 6, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 7, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__sum_)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 8, ((PyObject *)__pyx_n_s__sum_)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sum_)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + __pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s_28, 110, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/utils/sparsefuncs.pyx":143 + * @cython.wraparound(False) + * @cython.cdivision(True) + * def inplace_csr_column_scale(X, np.ndarray[DOUBLE, ndim=1] scale): # <<<<<<<<<<<<<< + * """Inplace column scaling of a CSR matrix. + * + */ + __pyx_k_tuple_29 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_29); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__scale)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 1, ((PyObject *)__pyx_n_s__scale)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__scale)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 2, ((PyObject *)__pyx_n_s__n_samples)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_samples)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 3, ((PyObject *)__pyx_n_s__n_features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_data)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 4, ((PyObject *)__pyx_n_s__X_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indices)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 5, ((PyObject *)__pyx_n_s__X_indices)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indices)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 6, ((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 7, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 8, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); + __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s_31, 143, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/utils/sparsefuncs.pyx":173 + * @cython.wraparound(False) + * @cython.cdivision(True) + * def csc_mean_variance_axis0(X): # <<<<<<<<<<<<<< + * """Compute mean and variance along axis 0 on a CSC matrix + * + */ + __pyx_k_tuple_32 = PyTuple_New(13); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_32); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 1, ((PyObject *)__pyx_n_s__n_samples)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_samples)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 2, ((PyObject *)__pyx_n_s__n_features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_data)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 3, ((PyObject *)__pyx_n_s__X_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indices)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 4, ((PyObject *)__pyx_n_s__X_indices)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indices)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 5, ((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 6, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 7, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__diff)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 8, ((PyObject *)__pyx_n_s__diff)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__diff)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__means)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 9, ((PyObject *)__pyx_n_s__means)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__means)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__variances)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 10, ((PyObject *)__pyx_n_s__variances)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__variances)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__counts)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 11, ((PyObject *)__pyx_n_s__counts)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__counts)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nz)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 12, ((PyObject *)__pyx_n_s__nz)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nz)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + __pyx_k_codeobj_33 = (PyObject*)__Pyx_PyCode_New(1, 0, 13, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s_2, 173, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/utils/sparsefuncs.pyx":227 + * @cython.wraparound(False) + * @cython.cdivision(True) + * def inplace_csc_column_scale(X, np.ndarray[DOUBLE, ndim=1] scale): # <<<<<<<<<<<<<< + * """Inplace column scaling of a CSC matrix. + * + */ + __pyx_k_tuple_34 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_34); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__scale)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, ((PyObject *)__pyx_n_s__scale)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__scale)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 2, ((PyObject *)__pyx_n_s__n_samples)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_samples)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 3, ((PyObject *)__pyx_n_s__n_features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_data)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 4, ((PyObject *)__pyx_n_s__X_data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indices)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 5, ((PyObject *)__pyx_n_s__X_indices)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indices)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X_indptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 6, ((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X_indptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 7, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 8, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); + __pyx_k_codeobj_35 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s_36, 227, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/utils/sparsefuncs.pyx":253 + * X_data[j] *= scale[i] + * + * def mean_variance_axis0(X): # <<<<<<<<<<<<<< + * """Compute mean and variance along axis 0 on a CSR or CSC matrix + * + */ + __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_37); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); + __pyx_k_codeobj_38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__mean_variance_axis0, 253, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -5519,12 +6105,18 @@ PyMODINIT_FUNC PyInit_sparsefuncs(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_sparsefuncs(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_sparsefuncs(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -5535,16 +6127,23 @@ PyMODINIT_FUNC PyInit_sparsefuncs(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("sparsefuncs"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("sparsefuncs"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__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.utils.sparsefuncs")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.utils.sparsefuncs", __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); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5560,127 +6159,143 @@ PyMODINIT_FUNC PyInit_sparsefuncs(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "sklearn/utils/sparsefuncs.pyx":7 - * + /* "sklearn/utils/sparsefuncs.pyx":8 + * from libc.math cimport fabs, sqrt * cimport numpy as np * import numpy as np # <<<<<<<<<<<<<< * import scipy.sparse as sp * cimport cython */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/utils/sparsefuncs.pyx":8 + /* "sklearn/utils/sparsefuncs.pyx":9 * cimport numpy as np * import numpy as np * import scipy.sparse as sp # <<<<<<<<<<<<<< * cimport cython * */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s_18)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_18)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s_18)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_17), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_17), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sp, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sp, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":21 + /* "sklearn/utils/sparsefuncs.pyx":12 + * cimport cython + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/utils/sparsefuncs.pyx":20 * @cython.wraparound(False) * @cython.cdivision(True) * def csr_mean_variance_axis0(X): # <<<<<<<<<<<<<< * """Compute mean and variance along axis 0 on a CSR matrix * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_csr_mean_variance_axis0, NULL, __pyx_n_s_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_1csr_mean_variance_axis0, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_1, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":76 + /* "sklearn/utils/sparsefuncs.pyx":75 * @cython.wraparound(False) * @cython.cdivision(True) * def inplace_csr_row_normalize_l1(X): # <<<<<<<<<<<<<< * """Inplace row normalize using the l1 norm""" * cdef unsigned int n_samples = X.shape[0] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_1inplace_csr_row_normalize_l1, NULL, __pyx_n_s_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_3inplace_csr_row_normalize_l1, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_20, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_25, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":111 + /* "sklearn/utils/sparsefuncs.pyx":110 * @cython.wraparound(False) * @cython.cdivision(True) * def inplace_csr_row_normalize_l2(X): # <<<<<<<<<<<<<< * """Inplace row normalize using the l2 norm""" * cdef unsigned int n_samples = X.shape[0] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_2inplace_csr_row_normalize_l2, NULL, __pyx_n_s_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_5inplace_csr_row_normalize_l2, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_21, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_28, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":144 + /* "sklearn/utils/sparsefuncs.pyx":143 * @cython.wraparound(False) * @cython.cdivision(True) * def inplace_csr_column_scale(X, np.ndarray[DOUBLE, ndim=1] scale): # <<<<<<<<<<<<<< * """Inplace column scaling of a CSR matrix. * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_3inplace_csr_column_scale, NULL, __pyx_n_s_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_7inplace_csr_column_scale, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_22, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_31, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":174 + /* "sklearn/utils/sparsefuncs.pyx":173 * @cython.wraparound(False) * @cython.cdivision(True) * def csc_mean_variance_axis0(X): # <<<<<<<<<<<<<< * """Compute mean and variance along axis 0 on a CSC matrix * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_4csc_mean_variance_axis0, NULL, __pyx_n_s_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_9csc_mean_variance_axis0, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":228 + /* "sklearn/utils/sparsefuncs.pyx":227 * @cython.wraparound(False) * @cython.cdivision(True) * def inplace_csc_column_scale(X, np.ndarray[DOUBLE, ndim=1] scale): # <<<<<<<<<<<<<< * """Inplace column scaling of a CSC matrix. * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_5inplace_csc_column_scale, NULL, __pyx_n_s_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_11inplace_csc_column_scale, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_23, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_36, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/sparsefuncs.pyx":254 + /* "sklearn/utils/sparsefuncs.pyx":253 * X_data[j] *= scale[i] * * def mean_variance_axis0(X): # <<<<<<<<<<<<<< * """Compute mean and variance along axis 0 on a CSR or CSC matrix * */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_6mean_variance_axis0, NULL, __pyx_n_s_19); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_5utils_11sparsefuncs_13mean_variance_axis0, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mean_variance_axis0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mean_variance_axis0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/utils/sparsefuncs.pyx":1 @@ -5693,7 +6308,7 @@ PyMODINIT_FUNC PyInit_sparsefuncs(void) if (PyObject_SetAttr(__pyx_m, __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; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5720,7 +6335,6 @@ PyMODINIT_FUNC PyInit_sparsefuncs(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -5752,7 +6366,6 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { return result; } - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); @@ -5761,26 +6374,14 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { - unsigned int n = 1; - return *(unsigned char*)(&n) != 0; -} - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; -} __Pyx_BufFmt_Context; + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { @@ -5799,6 +6400,8 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; @@ -5806,7 +6409,6 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, type = type->fields->type; } } - static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; @@ -5822,15 +6424,21 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { *ts = t; return count; } - +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } - static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { - case 'b': return "'char'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; @@ -5846,14 +6454,14 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } - static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; @@ -5869,10 +6477,9 @@ static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { return 0; } } - static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'B': return 1; + case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); @@ -5889,7 +6496,6 @@ static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { } } } - typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; @@ -5900,10 +6506,9 @@ typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); @@ -5919,21 +6524,59 @@ static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { return 0; } } - +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } - static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; @@ -5958,16 +6601,37 @@ static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { parent->type->name, field->name); } } - static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; - size_t size, offset; + size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { @@ -5979,35 +6643,35 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } - offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } - ctx->fmt_offset += size; - + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; @@ -6039,7 +6703,48 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { ctx->is_complex = 0; return 0; } - +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { @@ -6054,7 +6759,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } - return ts; + return ts; case ' ': case 10: case 13: @@ -6086,12 +6791,17 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { @@ -6099,10 +6809,19 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (!ts_after_sub) return NULL; } ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ - ++ts; + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; @@ -6123,13 +6842,11 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': - case 'O': + case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { - /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { - /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; @@ -6145,20 +6862,18 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha while(*ts != ':') ++ts; ++ts; break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; default: { - int number = __Pyx_BufFmt_ParseNumber(&ts); - if (number == -1) { /* First char was not a digit */ - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%c')", *ts); - return NULL; - } - ctx->new_count = (size_t)number; + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } } } } - static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; @@ -6166,8 +6881,10 @@ static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; @@ -6187,7 +6904,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* ob } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; @@ -6198,24 +6915,21 @@ fail:; __Pyx_ZeroBuffer(buf); return -1; } - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } - static void __Pyx_RaiseBufferFallbackError(void) { PyErr_Format(PyExc_ValueError, "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } - static CYTHON_INLINE void __Pyx_ErrRestore(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->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -6225,20 +6939,24 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, @@ -6248,7 +6966,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -6260,7 +6977,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -6274,7 +6991,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -6290,55 +7007,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -6378,40 +7117,41 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed } #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -6434,7 +7174,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -6443,10 +7182,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -6456,7 +7194,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -6465,13 +7202,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } 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; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -6488,14 +7248,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -6505,64 +7260,146 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +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 { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; } - static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { - #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} - #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); + PyObject *obj = view->obj; + CYTHON_UNUSED PyObject *releasebuffer_cobj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: Py_DECREF(obj); view->obj = NULL; - } } +#endif /* PY_MAJOR_VERSION < 3 */ -#endif -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; @@ -6588,12 +7425,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -7269,6 +8127,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -7278,15 +8153,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -7302,7 +8172,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -7312,7 +8182,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -7326,51 +8196,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -7381,28 +8305,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -7410,11 +8351,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -7449,6 +8388,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/sklearn/utils/sparsefuncs.pyx b/sklearn/utils/sparsefuncs.pyx index e26c858cc304b..63f7bf9e47b31 100644 --- a/sklearn/utils/sparsefuncs.pyx +++ b/sklearn/utils/sparsefuncs.pyx @@ -3,15 +3,14 @@ # # License: BSD Style. +from libc.math cimport fabs, sqrt cimport numpy as np import numpy as np import scipy.sparse as sp cimport cython +np.import_array() -cdef extern from "math.h": - double fabs(double f) - double sqrt(double f) ctypedef np.float64_t DOUBLE @@ -274,4 +273,5 @@ def mean_variance_axis0(X): elif isinstance(X, sp.csc_matrix): return csc_mean_variance_axis0(X) else: - raise TypeError("Unsupported matrix type. Expected a CSR or CSC sparse matrix.") + raise TypeError( + "Unsupported type; expected a CSR or CSC sparse matrix.") diff --git a/sklearn/utils/weight_vector.c b/sklearn/utils/weight_vector.c index 9eba15d28dd78..dee06f66afc24 100644 --- a/sklearn/utils/weight_vector.c +++ b/sklearn/utils/weight_vector.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Sun Mar 18 20:56:50 2012 */ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:14:54 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #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 PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(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), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #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) #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) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 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_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])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -267,7 +286,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -291,8 +310,12 @@ 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 +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -317,7 +340,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -327,7 +349,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -335,18 +356,54 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "weight_vector.pyx", "numpy.pxd", + "type.pxd", }; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; -/* "numpy.pxd":719 + +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -355,7 +412,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -364,7 +421,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -373,7 +430,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -382,7 +439,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -391,7 +448,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -400,7 +457,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -409,7 +466,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -418,7 +475,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -427,7 +484,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -436,7 +493,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.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 # <<<<<<<<<<<<<< @@ -445,7 +502,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -454,7 +511,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -463,7 +520,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -472,7 +529,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -481,7 +538,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -490,7 +547,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -499,7 +556,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -508,7 +565,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -517,7 +574,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -526,7 +583,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -552,7 +609,6 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE; * */ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_5utils_13weight_vector_INTEGER; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -573,10 +629,11 @@ typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_5utils_13weight_vector_INTEGER; typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector; -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -585,7 +642,7 @@ struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -594,7 +651,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -603,7 +660,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -631,7 +688,7 @@ struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector { -/* "sklearn/utils/weight_vector.pyx":18 +/* "sklearn/utils/weight_vector.pyx":17 * * * cdef class WeightVector(object): # <<<<<<<<<<<<<< @@ -647,12 +704,9 @@ struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector { double (*norm)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *); }; static struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector; - - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -665,8 +719,21 @@ static struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__p static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -677,7 +744,7 @@ static struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__p #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -688,13 +755,16 @@ static struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__p #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ @@ -702,29 +772,8 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ @@ -734,23 +783,40 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*pr static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + #if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); #else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release #endif -Py_ssize_t __Pyx_zeros[] = {0}; -Py_ssize_t __Pyx_minusones[] = {-1}; + +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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ @@ -766,7 +832,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -892,15 +957,38 @@ static int __Pyx_check_binary_version(void); static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -909,6 +997,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -919,22 +1012,13 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ - -/* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ /* Module declarations from 'sklearn.utils.weight_vector' */ static PyTypeObject *__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector = 0; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_13weight_vector_DOUBLE = { "DOUBLE", NULL, sizeof(__pyx_t_7sklearn_5utils_13weight_vector_DOUBLE), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_13weight_vector_DOUBLE = { "DOUBLE", NULL, sizeof(__pyx_t_7sklearn_5utils_13weight_vector_DOUBLE), { 0 }, 0, 'R', 0, 0 }; #define __Pyx_MODULE_NAME "sklearn.utils.weight_vector" int __pyx_module_is_main_sklearn__utils__weight_vector = 0; @@ -942,6 +1026,9 @@ int __pyx_module_is_main_sklearn__utils__weight_vector = 0; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; +static int __pyx_pf_7sklearn_5utils_13weight_vector_12WeightVector___cinit__(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *__pyx_v_self, PyArrayObject *__pyx_v_w); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; static char __pyx_k_5[] = "Non-native byte order not supported"; @@ -997,49 +1084,32 @@ static PyObject *__pyx_k_tuple_9; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_12; -/* "sklearn/utils/weight_vector.pyx":40 - * """ - * - * def __cinit__(self, np.ndarray[DOUBLE, ndim=1, mode='c'] w): # <<<<<<<<<<<<<< - * self.w = w - * self.w_data_ptr = w.data - */ - -static int __pyx_pf_7sklearn_5utils_13weight_vector_12WeightVector___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_7sklearn_5utils_13weight_vector_12WeightVector___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_7sklearn_5utils_13weight_vector_12WeightVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5utils_13weight_vector_12WeightVector_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_w = 0; - Py_buffer __pyx_bstruct_w; - Py_ssize_t __pyx_bstride_0_w = 0; - Py_ssize_t __pyx_bshape_0_w = 0; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - double __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__w,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__w,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __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 = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -1050,22 +1120,54 @@ static int __pyx_pf_7sklearn_5utils_13weight_vector_12WeightVector___cinit__(PyO } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.utils.weight_vector.WeightVector.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_w.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5utils_13weight_vector_12WeightVector___cinit__(((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_self), __pyx_v_w); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/utils/weight_vector.pyx":39 + * """ + * + * def __cinit__(self, np.ndarray[DOUBLE, ndim=1, mode='c'] w): # <<<<<<<<<<<<<< + * self.w = w + * self.w_data_ptr = w.data + */ + +static int __pyx_pf_7sklearn_5utils_13weight_vector_12WeightVector___cinit__(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *__pyx_v_self, PyArrayObject *__pyx_v_w) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_w; + __Pyx_Buffer __pyx_pybuffer_w; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + double __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + __pyx_pybuffer_w.pybuffer.buf = NULL; + __pyx_pybuffer_w.refcount = 0; + __pyx_pybuffernd_w.data = NULL; + __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_w, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_13weight_vector_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5utils_13weight_vector_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_w = __pyx_bstruct_w.strides[0]; - __pyx_bshape_0_w = __pyx_bstruct_w.shape[0]; + __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; - /* "sklearn/utils/weight_vector.pyx":41 + /* "sklearn/utils/weight_vector.pyx":40 * * def __cinit__(self, np.ndarray[DOUBLE, ndim=1, mode='c'] w): * self.w = w # <<<<<<<<<<<<<< @@ -1074,64 +1176,64 @@ static int __pyx_pf_7sklearn_5utils_13weight_vector_12WeightVector___cinit__(PyO */ __Pyx_INCREF(((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __Pyx_GOTREF(((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_self)->w); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_self)->w)); - ((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_self)->w = ((PyArrayObject *)__pyx_v_w); + __Pyx_GOTREF(__pyx_v_self->w); + __Pyx_DECREF(((PyObject *)__pyx_v_self->w)); + __pyx_v_self->w = ((PyArrayObject *)__pyx_v_w); - /* "sklearn/utils/weight_vector.pyx":42 + /* "sklearn/utils/weight_vector.pyx":41 * def __cinit__(self, np.ndarray[DOUBLE, ndim=1, mode='c'] w): * self.w = w * self.w_data_ptr = w.data # <<<<<<<<<<<<<< * self.wscale = 1.0 * self.n_features = w.shape[0] */ - ((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_self)->w_data_ptr = ((__pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *)__pyx_v_w->data); + __pyx_v_self->w_data_ptr = ((__pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *)__pyx_v_w->data); - /* "sklearn/utils/weight_vector.pyx":43 + /* "sklearn/utils/weight_vector.pyx":42 * self.w = w * self.w_data_ptr = w.data * self.wscale = 1.0 # <<<<<<<<<<<<<< * self.n_features = w.shape[0] * self.sq_norm = np.dot(w, w) */ - ((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_self)->wscale = 1.0; + __pyx_v_self->wscale = 1.0; - /* "sklearn/utils/weight_vector.pyx":44 + /* "sklearn/utils/weight_vector.pyx":43 * self.w_data_ptr = w.data * self.wscale = 1.0 * self.n_features = w.shape[0] # <<<<<<<<<<<<<< * self.sq_norm = np.dot(w, w) * */ - ((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_self)->n_features = (__pyx_v_w->dimensions[0]); + __pyx_v_self->n_features = (__pyx_v_w->dimensions[0]); - /* "sklearn/utils/weight_vector.pyx":45 + /* "sklearn/utils/weight_vector.pyx":44 * self.wscale = 1.0 * self.n_features = w.shape[0] * self.sq_norm = np.dot(w, w) # <<<<<<<<<<<<<< * * cdef void add(self, DOUBLE *x_data_ptr, INTEGER *x_ind_ptr, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dot); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __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 = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __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_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - ((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_self)->sq_norm = __pyx_t_4; + __pyx_v_self->sq_norm = __pyx_t_4; __pyx_r = 0; goto __pyx_L0; @@ -1141,19 +1243,19 @@ static int __pyx_pf_7sklearn_5utils_13weight_vector_12WeightVector___cinit__(PyO __Pyx_XDECREF(__pyx_t_3); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_w); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("sklearn.utils.weight_vector.WeightVector.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_w); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer); __pyx_L2:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/utils/weight_vector.pyx":47 +/* "sklearn/utils/weight_vector.pyx":46 * self.sq_norm = np.dot(w, w) * * cdef void add(self, DOUBLE *x_data_ptr, INTEGER *x_ind_ptr, # <<<<<<<<<<<<<< @@ -1170,12 +1272,14 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_add(struct __ double __pyx_v_wscale; __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *__pyx_v_w_data_ptr; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + double __pyx_t_1; + __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *__pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("add"); + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("add", 0); - /* "sklearn/utils/weight_vector.pyx":67 + /* "sklearn/utils/weight_vector.pyx":66 * cdef int idx * cdef double val * cdef double innerprod = 0.0 # <<<<<<<<<<<<<< @@ -1184,7 +1288,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_add(struct __ */ __pyx_v_innerprod = 0.0; - /* "sklearn/utils/weight_vector.pyx":68 + /* "sklearn/utils/weight_vector.pyx":67 * cdef double val * cdef double innerprod = 0.0 * cdef double xsqnorm = 0.0 # <<<<<<<<<<<<<< @@ -1193,36 +1297,38 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_add(struct __ */ __pyx_v_xsqnorm = 0.0; - /* "sklearn/utils/weight_vector.pyx":71 + /* "sklearn/utils/weight_vector.pyx":70 * * # the next two lines save a factor of 2! * cdef double wscale = self.wscale # <<<<<<<<<<<<<< * cdef DOUBLE* w_data_ptr = self.w_data_ptr * */ - __pyx_v_wscale = __pyx_v_self->wscale; + __pyx_t_1 = __pyx_v_self->wscale; + __pyx_v_wscale = __pyx_t_1; - /* "sklearn/utils/weight_vector.pyx":72 + /* "sklearn/utils/weight_vector.pyx":71 * # the next two lines save a factor of 2! * cdef double wscale = self.wscale * cdef DOUBLE* w_data_ptr = self.w_data_ptr # <<<<<<<<<<<<<< * * for j in range(xnnz): */ - __pyx_v_w_data_ptr = __pyx_v_self->w_data_ptr; + __pyx_t_2 = __pyx_v_self->w_data_ptr; + __pyx_v_w_data_ptr = __pyx_t_2; - /* "sklearn/utils/weight_vector.pyx":74 + /* "sklearn/utils/weight_vector.pyx":73 * cdef DOUBLE* w_data_ptr = self.w_data_ptr * * for j in range(xnnz): # <<<<<<<<<<<<<< * idx = x_ind_ptr[j] * val = x_data_ptr[j] */ - __pyx_t_1 = __pyx_v_xnnz; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_j = __pyx_t_2; + __pyx_t_3 = __pyx_v_xnnz; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; - /* "sklearn/utils/weight_vector.pyx":75 + /* "sklearn/utils/weight_vector.pyx":74 * * for j in range(xnnz): * idx = x_ind_ptr[j] # <<<<<<<<<<<<<< @@ -1231,7 +1337,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_add(struct __ */ __pyx_v_idx = (__pyx_v_x_ind_ptr[__pyx_v_j]); - /* "sklearn/utils/weight_vector.pyx":76 + /* "sklearn/utils/weight_vector.pyx":75 * for j in range(xnnz): * idx = x_ind_ptr[j] * val = x_data_ptr[j] # <<<<<<<<<<<<<< @@ -1240,7 +1346,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_add(struct __ */ __pyx_v_val = (__pyx_v_x_data_ptr[__pyx_v_j]); - /* "sklearn/utils/weight_vector.pyx":77 + /* "sklearn/utils/weight_vector.pyx":76 * idx = x_ind_ptr[j] * val = x_data_ptr[j] * innerprod += (w_data_ptr[idx] * val) # <<<<<<<<<<<<<< @@ -1249,7 +1355,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_add(struct __ */ __pyx_v_innerprod = (__pyx_v_innerprod + ((__pyx_v_w_data_ptr[__pyx_v_idx]) * __pyx_v_val)); - /* "sklearn/utils/weight_vector.pyx":78 + /* "sklearn/utils/weight_vector.pyx":77 * val = x_data_ptr[j] * innerprod += (w_data_ptr[idx] * val) * xsqnorm += (val * val) # <<<<<<<<<<<<<< @@ -1258,18 +1364,18 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_add(struct __ */ __pyx_v_xsqnorm = (__pyx_v_xsqnorm + (__pyx_v_val * __pyx_v_val)); - /* "sklearn/utils/weight_vector.pyx":79 + /* "sklearn/utils/weight_vector.pyx":78 * innerprod += (w_data_ptr[idx] * val) * xsqnorm += (val * val) * w_data_ptr[idx] += val * (c / wscale) # <<<<<<<<<<<<<< * * self.sq_norm += (xsqnorm * c * c) + (2.0 * innerprod * wscale * c) */ - __pyx_t_3 = __pyx_v_idx; - (__pyx_v_w_data_ptr[__pyx_t_3]) = ((__pyx_v_w_data_ptr[__pyx_t_3]) + (__pyx_v_val * (__pyx_v_c / __pyx_v_wscale))); + __pyx_t_5 = __pyx_v_idx; + (__pyx_v_w_data_ptr[__pyx_t_5]) = ((__pyx_v_w_data_ptr[__pyx_t_5]) + (__pyx_v_val * (__pyx_v_c / __pyx_v_wscale))); } - /* "sklearn/utils/weight_vector.pyx":81 + /* "sklearn/utils/weight_vector.pyx":80 * w_data_ptr[idx] += val * (c / wscale) * * self.sq_norm += (xsqnorm * c * c) + (2.0 * innerprod * wscale * c) # <<<<<<<<<<<<<< @@ -1281,7 +1387,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_add(struct __ __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/weight_vector.pyx":83 +/* "sklearn/utils/weight_vector.pyx":82 * self.sq_norm += (xsqnorm * c * c) + (2.0 * innerprod * wscale * c) * * cdef double dot(self, DOUBLE *x_data_ptr, INTEGER *x_ind_ptr, int xnnz): # <<<<<<<<<<<<<< @@ -1296,11 +1402,12 @@ static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_dot(struct __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *__pyx_v_w_data_ptr; double __pyx_r; __Pyx_RefNannyDeclarations - int __pyx_t_1; + __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *__pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("dot"); + int __pyx_t_3; + __Pyx_RefNannySetupContext("dot", 0); - /* "sklearn/utils/weight_vector.pyx":102 + /* "sklearn/utils/weight_vector.pyx":101 * cdef int j * cdef int idx * cdef double innerprod = 0.0 # <<<<<<<<<<<<<< @@ -1309,27 +1416,28 @@ static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_dot(struct */ __pyx_v_innerprod = 0.0; - /* "sklearn/utils/weight_vector.pyx":103 + /* "sklearn/utils/weight_vector.pyx":102 * cdef int idx * cdef double innerprod = 0.0 * cdef DOUBLE* w_data_ptr = self.w_data_ptr # <<<<<<<<<<<<<< * for j in range(xnnz): * idx = x_ind_ptr[j] */ - __pyx_v_w_data_ptr = __pyx_v_self->w_data_ptr; + __pyx_t_1 = __pyx_v_self->w_data_ptr; + __pyx_v_w_data_ptr = __pyx_t_1; - /* "sklearn/utils/weight_vector.pyx":104 + /* "sklearn/utils/weight_vector.pyx":103 * cdef double innerprod = 0.0 * cdef DOUBLE* w_data_ptr = self.w_data_ptr * for j in range(xnnz): # <<<<<<<<<<<<<< * idx = x_ind_ptr[j] * innerprod += w_data_ptr[idx] * x_data_ptr[j] */ - __pyx_t_1 = __pyx_v_xnnz; - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { - __pyx_v_j = __pyx_t_2; + __pyx_t_2 = __pyx_v_xnnz; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_j = __pyx_t_3; - /* "sklearn/utils/weight_vector.pyx":105 + /* "sklearn/utils/weight_vector.pyx":104 * cdef DOUBLE* w_data_ptr = self.w_data_ptr * for j in range(xnnz): * idx = x_ind_ptr[j] # <<<<<<<<<<<<<< @@ -1338,7 +1446,7 @@ static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_dot(struct */ __pyx_v_idx = (__pyx_v_x_ind_ptr[__pyx_v_j]); - /* "sklearn/utils/weight_vector.pyx":106 + /* "sklearn/utils/weight_vector.pyx":105 * for j in range(xnnz): * idx = x_ind_ptr[j] * innerprod += w_data_ptr[idx] * x_data_ptr[j] # <<<<<<<<<<<<<< @@ -1348,7 +1456,7 @@ static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_dot(struct __pyx_v_innerprod = (__pyx_v_innerprod + ((__pyx_v_w_data_ptr[__pyx_v_idx]) * (__pyx_v_x_data_ptr[__pyx_v_j]))); } - /* "sklearn/utils/weight_vector.pyx":107 + /* "sklearn/utils/weight_vector.pyx":106 * idx = x_ind_ptr[j] * innerprod += w_data_ptr[idx] * x_data_ptr[j] * innerprod *= self.wscale # <<<<<<<<<<<<<< @@ -1357,7 +1465,7 @@ static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_dot(struct */ __pyx_v_innerprod = (__pyx_v_innerprod * __pyx_v_self->wscale); - /* "sklearn/utils/weight_vector.pyx":108 + /* "sklearn/utils/weight_vector.pyx":107 * innerprod += w_data_ptr[idx] * x_data_ptr[j] * innerprod *= self.wscale * return innerprod # <<<<<<<<<<<<<< @@ -1373,7 +1481,7 @@ static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_dot(struct return __pyx_r; } -/* "sklearn/utils/weight_vector.pyx":110 +/* "sklearn/utils/weight_vector.pyx":109 * return innerprod * * cdef void scale(self, double c): # <<<<<<<<<<<<<< @@ -1384,9 +1492,9 @@ static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_dot(struct static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_scale(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *__pyx_v_self, double __pyx_v_c) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("scale"); + __Pyx_RefNannySetupContext("scale", 0); - /* "sklearn/utils/weight_vector.pyx":115 + /* "sklearn/utils/weight_vector.pyx":114 * It updates ``wscale`` and ``sq_norm``. If ``wscale`` gets too * small we call ``reset_swcale``.""" * self.wscale *= c # <<<<<<<<<<<<<< @@ -1395,7 +1503,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_scale(struct */ __pyx_v_self->wscale = (__pyx_v_self->wscale * __pyx_v_c); - /* "sklearn/utils/weight_vector.pyx":116 + /* "sklearn/utils/weight_vector.pyx":115 * small we call ``reset_swcale``.""" * self.wscale *= c * self.sq_norm *= (c * c) # <<<<<<<<<<<<<< @@ -1404,7 +1512,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_scale(struct */ __pyx_v_self->sq_norm = (__pyx_v_self->sq_norm * (__pyx_v_c * __pyx_v_c)); - /* "sklearn/utils/weight_vector.pyx":117 + /* "sklearn/utils/weight_vector.pyx":116 * self.wscale *= c * self.sq_norm *= (c * c) * if self.wscale < 1e-9: # <<<<<<<<<<<<<< @@ -1414,7 +1522,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_scale(struct __pyx_t_1 = (__pyx_v_self->wscale < 1e-9); if (__pyx_t_1) { - /* "sklearn/utils/weight_vector.pyx":118 + /* "sklearn/utils/weight_vector.pyx":117 * self.sq_norm *= (c * c) * if self.wscale < 1e-9: * self.reset_wscale() # <<<<<<<<<<<<<< @@ -1429,7 +1537,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_scale(struct __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/weight_vector.pyx":120 +/* "sklearn/utils/weight_vector.pyx":119 * self.reset_wscale() * * cdef void reset_wscale(self): # <<<<<<<<<<<<<< @@ -1444,28 +1552,28 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_reset_wscale( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("reset_wscale"); + __Pyx_RefNannySetupContext("reset_wscale", 0); - /* "sklearn/utils/weight_vector.pyx":122 + /* "sklearn/utils/weight_vector.pyx":121 * cdef void reset_wscale(self): * """Scales each coef of ``w`` by ``wscale`` and resets it to 1. """ * self.w *= self.wscale # <<<<<<<<<<<<<< * self.wscale = 1.0 * */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->wscale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->wscale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_self->w), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_self->w), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __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 = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->w); __Pyx_DECREF(((PyObject *)__pyx_v_self->w)); __pyx_v_self->w = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/utils/weight_vector.pyx":123 + /* "sklearn/utils/weight_vector.pyx":122 * """Scales each coef of ``w`` by ``wscale`` and resets it to 1. """ * self.w *= self.wscale * self.wscale = 1.0 # <<<<<<<<<<<<<< @@ -1483,7 +1591,7 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_reset_wscale( __Pyx_RefNannyFinishContext(); } -/* "sklearn/utils/weight_vector.pyx":125 +/* "sklearn/utils/weight_vector.pyx":124 * self.wscale = 1.0 * * cdef double norm(self): # <<<<<<<<<<<<<< @@ -1494,9 +1602,9 @@ static void __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_reset_wscale( static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_norm(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *__pyx_v_self) { double __pyx_r; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("norm"); + __Pyx_RefNannySetupContext("norm", 0); - /* "sklearn/utils/weight_vector.pyx":127 + /* "sklearn/utils/weight_vector.pyx":126 * cdef double norm(self): * """The L2 norm of the weight vector. """ * return sqrt(self.sq_norm) # <<<<<<<<<<<<<< @@ -1510,7 +1618,18 @@ static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_norm(struct return __pyx_r; } -/* "numpy.pxd":190 +/* 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) { + int __pyx_r; + __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)); + __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): # <<<<<<<<<<<<<< @@ -1518,8 +1637,7 @@ static double __pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_norm(struct * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +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; int __pyx_v_ndim; @@ -1544,13 +1662,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -1561,11 +1679,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1574,7 +1692,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1583,16 +1701,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1602,7 +1720,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1610,11 +1728,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1623,9 +1741,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1635,37 +1753,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * 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") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.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_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), 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 = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1675,46 +1793,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * 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") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.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_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, ((PyObject *)__pyx_k_tuple_4), 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 = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1723,7 +1841,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -1732,7 +1850,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.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) # <<<<<<<<<<<<<< @@ -1741,7 +1859,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.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 # <<<<<<<<<<<<<< @@ -1750,7 +1868,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -1761,49 +1879,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1812,25 +1930,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1839,17 +1957,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1858,7 +1978,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -1874,7 +1994,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1886,49 +2006,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -1939,10 +2060,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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" */ @@ -1959,24 +2080,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (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" @@ -1985,10 +2106,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1998,10 +2119,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2011,10 +2132,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2024,10 +2145,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -2037,10 +2158,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -2050,10 +2171,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -2063,10 +2184,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -2076,10 +2197,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -2089,10 +2210,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -2102,10 +2223,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -2115,10 +2236,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2128,10 +2249,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -2141,10 +2262,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2154,10 +2275,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2167,10 +2288,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2180,10 +2301,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2193,37 +2314,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __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_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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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)); __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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__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 = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2232,7 +2353,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2241,57 +2362,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __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 = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -2316,31 +2437,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* 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)); + __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 CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +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__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2348,11 +2477,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2362,7 +2491,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2370,14 +2499,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2392,9 +2521,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2402,7 +2531,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2420,7 +2549,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2435,9 +2564,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2445,7 +2574,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2463,7 +2592,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2478,9 +2607,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2488,7 +2617,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2506,7 +2635,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2521,9 +2650,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2531,7 +2660,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2549,7 +2678,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2564,9 +2693,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2574,7 +2703,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2592,7 +2721,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.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: # <<<<<<<<<<<<<< @@ -2615,18 +2744,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2635,7 +2765,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2644,7 +2774,7 @@ 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":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2652,31 +2782,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2685,20 +2820,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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;} + #endif + } else if (1) { + __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 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(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -2706,99 +2870,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * 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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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 = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), 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_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * 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_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * 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_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), 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_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2806,16 +2969,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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2824,7 +2986,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2833,430 +2995,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.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 = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.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_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.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_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), 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_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.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 = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.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 = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.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 = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.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 = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.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 = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.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 = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.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 = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.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 = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.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 = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); 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_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_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.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 = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.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_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __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_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 = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -3264,25 +3409,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_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __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 = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __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_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3311,7 +3456,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3323,9 +3468,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3335,7 +3480,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3347,7 +3492,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3356,7 +3501,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3367,7 +3512,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3376,7 +3521,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3388,7 +3533,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3400,9 +3545,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3412,7 +3557,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3427,7 +3572,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3454,7 +3599,7 @@ static PyObject *__pyx_tp_new_7sklearn_5utils_13weight_vector_WeightVector(PyTyp p = ((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)o); p->__pyx_vtab = __pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector; p->w = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_7sklearn_5utils_13weight_vector_12WeightVector___cinit__(o, a, k) < 0) { + if (__pyx_pw_7sklearn_5utils_13weight_vector_12WeightVector_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -3462,7 +3607,9 @@ static PyObject *__pyx_tp_new_7sklearn_5utils_13weight_vector_WeightVector(PyTyp static void __pyx_tp_dealloc_7sklearn_5utils_13weight_vector_WeightVector(PyObject *o) { struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *p = (struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)o; - Py_XDECREF(((PyObject *)p->w)); + PyObject_GC_UnTrack(o); + Py_CLEAR(p->w); + PyObject_GC_Track(o); (*Py_TYPE(o)->tp_free)(o); } @@ -3679,9 +3826,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3689,87 +3836,87 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numpy.pxd":211 + /* "numpy.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_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "numpy.pxd":215 + /* "numpy.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_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.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_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.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_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "numpy.pxd":819 + /* "numpy.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_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); @@ -3808,12 +3955,18 @@ PyMODINIT_FUNC PyInit_weight_vector(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_weight_vector(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_weight_vector(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -3824,16 +3977,23 @@ PyMODINIT_FUNC PyInit_weight_vector(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("weight_vector"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("weight_vector"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__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.utils.weight_vector")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.utils.weight_vector", __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); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3854,32 +4014,48 @@ PyMODINIT_FUNC PyInit_weight_vector(void) __pyx_vtable_7sklearn_5utils_13weight_vector_WeightVector.scale = (void (*)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *, double))__pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_scale; __pyx_vtable_7sklearn_5utils_13weight_vector_WeightVector.reset_wscale = (void (*)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *))__pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_reset_wscale; __pyx_vtable_7sklearn_5utils_13weight_vector_WeightVector.norm = (double (*)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *))__pyx_f_7sklearn_5utils_13weight_vector_12WeightVector_norm; - if (PyType_Ready(&__pyx_type_7sklearn_5utils_13weight_vector_WeightVector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_13weight_vector_WeightVector.tp_dict, __pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "WeightVector", (PyObject *)&__pyx_type_7sklearn_5utils_13weight_vector_WeightVector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5utils_13weight_vector_WeightVector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5utils_13weight_vector_WeightVector.tp_dict, __pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "WeightVector", (PyObject *)&__pyx_type_7sklearn_5utils_13weight_vector_WeightVector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector = &__pyx_type_7sklearn_5utils_13weight_vector_WeightVector; /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "sklearn/utils/weight_vector.pyx":11 - * + /* "sklearn/utils/weight_vector.pyx":10 + * # License: BSD Style. * * import numpy as np # <<<<<<<<<<<<<< - * - * + * cimport numpy as np + * cimport cython */ - __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(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* "sklearn/utils/weight_vector.pyx":14 + * cimport cython + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + /* "sklearn/utils/weight_vector.pyx":1 * # encoding: utf-8 # <<<<<<<<<<<<<< * # cython: cdivision=True @@ -3890,7 +4066,7 @@ PyMODINIT_FUNC PyInit_weight_vector(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3916,7 +4092,6 @@ PyMODINIT_FUNC PyInit_weight_vector(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -3957,7 +4132,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -3973,55 +4148,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; } - if (*name) { + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -4049,7 +4246,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -4061,7 +4257,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -4090,18 +4286,6 @@ static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; -} __Pyx_BufFmt_Context; - static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { @@ -4120,6 +4304,8 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; @@ -4127,7 +4313,6 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, type = type->fields->type; } } - static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; @@ -4143,15 +4328,21 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { *ts = t; return count; } - +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } - static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { - case 'b': return "'char'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; @@ -4167,14 +4358,14 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } - static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; @@ -4190,10 +4381,9 @@ static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { return 0; } } - static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'B': return 1; + case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); @@ -4210,7 +4400,6 @@ static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { } } } - typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; @@ -4221,10 +4410,9 @@ typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); @@ -4240,21 +4428,59 @@ static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { return 0; } } - +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } - static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; @@ -4279,16 +4505,37 @@ static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { parent->type->name, field->name); } } - static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; - size_t size, offset; + size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { @@ -4300,35 +4547,35 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } - offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } - ctx->fmt_offset += size; - + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; @@ -4360,7 +4607,48 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { ctx->is_complex = 0; return 0; } - +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { @@ -4375,7 +4663,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } - return ts; + return ts; case ' ': case 10: case 13: @@ -4407,12 +4695,17 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { @@ -4420,10 +4713,19 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (!ts_after_sub) return NULL; } ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ - ++ts; + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; @@ -4444,13 +4746,11 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': - case 'O': + case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { - /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { - /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; @@ -4466,20 +4766,18 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha while(*ts != ':') ++ts; ++ts; break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; default: { - int number = __Pyx_BufFmt_ParseNumber(&ts); - if (number == -1) { /* First char was not a digit */ - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%c')", *ts); - return NULL; - } - ctx->new_count = (size_t)number; + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } } } } - static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; @@ -4487,8 +4785,10 @@ static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; @@ -4508,7 +4808,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* ob } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; @@ -4519,7 +4819,6 @@ fail:; __Pyx_ZeroBuffer(buf); return -1; } - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; @@ -4527,9 +4826,9 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { } static CYTHON_INLINE void __Pyx_ErrRestore(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->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -4539,20 +4838,24 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); @@ -4566,40 +4869,41 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { } #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -4622,7 +4926,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -4631,10 +4934,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -4644,7 +4946,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -4653,13 +4954,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } 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; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -4676,14 +5000,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -4693,64 +5012,146 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +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 { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; } - static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { - #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} - #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); + PyObject *obj = view->obj; + CYTHON_UNUSED PyObject *releasebuffer_cobj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: Py_DECREF(obj); view->obj = NULL; - } } +#endif /* PY_MAJOR_VERSION < 3 */ -#endif -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; @@ -4776,12 +5177,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -5438,8 +5860,8 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename) { +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); @@ -5493,6 +5915,23 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -5502,15 +5941,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -5526,7 +5960,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -5536,7 +5970,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -5550,51 +5984,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -5605,28 +6093,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -5634,11 +6139,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -5673,6 +6176,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/sklearn/utils/weight_vector.pyx b/sklearn/utils/weight_vector.pyx index 3c52f1f9cd2df..42d1333ea26ff 100644 --- a/sklearn/utils/weight_vector.pyx +++ b/sklearn/utils/weight_vector.pyx @@ -7,13 +7,12 @@ # # License: BSD Style. - import numpy as np - - cimport numpy as np cimport cython +np.import_array() + cdef class WeightVector(object): """Dense vector represented by a scalar and a numpy array.